# go-flutter-desktop-hover **Repository Path**: netscript/go-flutter-desktop-hover ## Basic Information - **Project Name**: go-flutter-desktop-hover - **Description**: https://gitee.com/luzhanzhao/hover ι•œεƒεΊ“ - **Primary Language**: Unknown - **License**: BSD-3-Clause - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-01-12 - **Last Updated**: 2022-06-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Hover - Run Flutter apps on the desktop with hot-reload Hover is a simple build tool to create [Flutter](https://flutter.dev) desktop applications. **Hover is brand new and under development, it should be considered alpha. Anything can break, please backup your data before using hover** Hover is part of the [go-flutter](https://github.com/go-flutter-desktop/go-flutter) project. Please report issues at the [go-flutter issue tracker](https://github.com/go-flutter-desktop/go-flutter/issues/). ## Install Hover uses [Go](https://golang.org) to build your Flutter application to desktop. Hover itself is also written using the Go language. You will need to [install go](https://golang.org/doc/install) on your development machine. Then install hover like this: ```bash $ go version go version go1.13 XX/YYY $ go get -u github.com/go-flutter-desktop/hover ``` Go 1.13 is required and `GO111MODULE` must not be set to `on` (`auto` and `off` is fine) Run the same command to update when a newer version becomes available. Install these dependencies: * You need to make sure you have a C compiler. The recommended C compiler are documented [here](https://github.com/golang/go/wiki/InstallFromSource#install-c-tools). * You need to make sure you have dependencies of GLFW: * On macOS, you need Xcode or Command Line Tools for Xcode (`xcode-select --install`) for required headers and libraries. * On Ubuntu/Debian-like Linux distributions, you need `libgl1-mesa-dev xorg-dev` packages. * On CentOS/Fedora-like Linux distributions, you need `libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel mesa-libGL-devel libXi-devel` packages. * See [here](http://www.glfw.org/docs/latest/compile.html#compile_deps) for full details. ## Getting started with an existing Flutter project This assumes you have an existing flutter project which you want to run on desktop. If you don't have a project yet, follow the flutter tutorial for setting up a new project first. ### Init project for hover cd into a flutter project. ```bash cd projects/simpleApplication ``` The first time you use hover for a project, you'll need to initialize the project for desktop. An argument can be passed to `hover init` to set the project path. This is usually the path for your project on github or a self-hosted git service. _If you are unsure, use `hover init`, the generated path can always be changed later._ ```bash hover init github.com/my-organization/simpleApplication ``` This creates the directory `go` and adds boilerplate files such as Go code and a default logo. Make sure you have the following [main_desktop.dart](https://github.com/go-flutter-desktop/examples/blob/5508a59ff4916fca9c05dfde4929d8848fd2a947/pointer_demo/lib/main_desktop.dart) in the root librairie of your application. It's the following code before `runApp(..)` that makes Flutter run on other platforms: ```dart debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; ``` Optionally, you may add [plugins](https://github.com/go-flutter-desktop/plugins) to `go/cmd/options.go` Optionally, change the logo in `go/assets/logo.png`, which is used as icon for the window. ### Run with hot-reload To run the application and attach flutter for hot-reload support: ```bash hover run ``` The hot-reload is manual because you'll need to press 'r' in the terminal to hot-reload the application. By default, hover uses the file `lib/main_desktop.dart` as entrypoint. You may specify a different endpoint by using the `--target` flag. If you want to integrate go-flutter with VSCode, read this [issue](https://github.com/go-flutter-desktop/go-flutter/issues/129#issuecomment-513590141). ### Build standalone application To create a standalone release (JIT mode) build run this command: ```bash hover build linux # or darwin or windows ``` You can create a build for any of the supported OSs using cross-compiling which needs [Docker to be installed](https://docs.docker.com/install/). Then just run the command from above and it will do everything for you. The output will be in `go/build/outputs/linux` or windows or darwin. To start the binary: (replace `yourApplicationName` with your app name) ```bash ./go/build/outputs/linux/yourApplicationName ``` It's possible to zip the whole dir `go/build/outputs/linux` and ship it to a different machine. ### Packaging You can package your application for different packaging formats. First initialize the packaging format: ```bash hover init-packaging linux-appimage ``` Update the configuration files located in `go/packaging/linux-appimage/`to your needs. Then create a build and package it using this command: ```bash hover build linux-appimage ``` The packaging output will be located in `go/build/outputs/linux-appimage/` To get a list of all available packaging formats run: ```bash hover build --help ``` ## Fonts No text visible? Make sure to use fonts who are included in the flutter assets/fonts system. The default font for `MaterialApp`, Roboto, is not installed on all machines. ## Issues Please report issues at the [go-flutter issue tracker](https://github.com/go-flutter-desktop/go-flutter/issues/).