gutter

package module
v0.2.1-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2018 License: LGPL-3.0 Imports: 9 Imported by: 0

README

Go Flutter desktop embedder

A Go (golang) Custom Flutter Engine Embedder for desktop

Purpose

This project doesn't compete with this awesome one. The purpose of this project is to support the Flutter framework on Windows, MacOS, and Linux using a SINGLE code base.

GLFW fits the job because it provides the right abstractions over the OpenGL's Buffer/mouse/keyboard for each platform.

The choice of Golang comes from the fact that it has the same tooling on every platform.
Plus golang is a great language because it keeps everything simple and readable, which, I hope, will encourage people to contribute 😁.

How to install

For this Flutter version:

$ flutter --version
Flutter 0.7.3 • channel beta • https://github.com/flutter/flutter.git
Framework • revision 3b309bda07 (2 weeks ago) • 2018-08-28 12:39:24 -0700
Engine • revision af42b6dc95
Tools • Dart 2.1.0-dev.1.0.flutter-ccb16f7282
:package: :penguin: Linux

From binaries

Check out the Release page for prebuilt versions.

From source

Go read first: go-gl/glfw

# Clone
git clone https://github.com/Drakirus/go-flutter-desktop-embedder.git
cd go-flutter-desktop-embedder

# Build the flutter simpleDemo project
cd example/simpleDemo/
cd flutter_project/demo/
flutter build bundle
cd ../..

# Download the share library (CORRESPONDING to the Flutter's version shown above)
wget https://storage.googleapis.com/flutter_infra/flutter/af42b6dc95bd9f719e43c4e9f29a00640f0f0bba/linux-x64/linux-x64-embedder -O .build/temp.zip

# Extract the share library
unzip .build/temp.zip -x flutter_embedder.h

# REQUIRED: When using `go build` or `go run main.go`, the go library need to know where to look for the share library
export CGO_LDFLAGS="-L${PWD}"

# If you `go build`, the share library must stay in the same path, relative to the go binary

# Get the libraries
go get -u -v github.com/Drakirus/go-flutter-desktop-embedder

# Make sure the path in "main.go" to the `icudtl.dat` is correct.
# Build the example project
go build
:package: :checkered_flag: Windows

From binaries

Check out the Release page for prebuilt versions.

From source

Go read first: go-gl/glfw

# Clone
git clone https://github.com/Drakirus/go-flutter-desktop-embedder.git
cd go-flutter-desktop-embedder

# Build the flutter simpleDemo project
cd example/simpleDemo/
cd flutter_project/demo/
flutter build bundle
cd ../..

# Download the share library (CORRESPONDING to the Flutter's version shown above)
# => https://storage.googleapis.com/flutter_infra/flutter/af42b6dc95bd9f719e43c4e9f29a00640f0f0bba/windows-x64/windows-x64-embedder.zip

# Move the share library
# => "flutter_engine.dll" must be in the flutter example project (where the main.go is)

# REQUIRED: When using `go build` or `go run main.go`, the go library need to know where to look for the share library
set CGO_LDFLAGS=-L%cd%

# If you `go build`, the share library must stay in the same path, relative to the go binary

# Get the libraries
go get -u -v github.com/Drakirus/go-flutter-desktop-embedder

# Make sure the path in "main.go" to the `icudtl.dat` is correct.
# Build or Run the example project
go run main.go
:package: :apple: MacOS

From binaries

Check out the Release page for prebuilt versions.

From source

Go read first: go-gl/glfw

# Clone
git clone https://github.com/Drakirus/go-flutter-desktop-embedder.git
cd go-flutter-desktop-embedder

# Build the flutter simpleDemo project
cd example/simpleDemo/
cd flutter_project/demo/
flutter build bundle
cd ../..

# Download the share library (CORRESPONDING to the Flutter's version shown above)
wget https://storage.googleapis.com/flutter_infra/flutter/af42b6dc95bd9f719e43c4e9f29a00640f0f0bba/darwin-x64/FlutterEmbedder.framework.zip -O .build/temp.zip

# Move the share library
unzip .build/temp.zip -d .build && unzip .build/FlutterEmbedder.framework.zip -d .build/FlutterEmbedder.framework
mv .build/FlutterEmbedder.framework .

# REQUIRED: When using `go build` or `go run main.go`, the go library need to know where to look for the share library
export CGO_LDFLAGS="-F${PWD} -Wl,-rpath,@executable_path"

# If you `go build`, the share library must stay in the same path, relative to the go binary

# Get the libraries
go get -u -v github.com/Drakirus/go-flutter-desktop-embedder

# Make sure the path in "main.go" to the `icudtl.dat` is correct.
# Build the example project
go build

Flutter Demos Projects

The examples are available here

Support

  • Linux 🐧
  • Windows 🏁
  • MacOS 🍎
  • Text input
  • Plugins
  • Importable go library
  • Clipboard (through shortcuts)
  • Clipboard (through the click)
  • Keyboard shortcuts
    • ctrl-c ctrl-v ctrl-x ctrl-a
    • Home End shift-Home shift-End
    • Left ctrl-Left ctrl-shift-Left
    • Right ctrl-Right ctrl-shift-Right
    • Backspace ctrl-Backspace Delete
    • ctrl-Delete
  • Key events

Documentation

Index

Constants

View Source
const (
	ModNone         int = 0
	ModShift        int = 1
	ModControl      int = 2
	ModShiftControl int = 3
	ModAlt          int = 4
	ModSuper        int = 8
)

Modifier keys from glfw

Variables

This section is empty.

Functions

func Run

func Run(options ...Option) (err error)

Run executes a flutter application with the provided options. given limitations this method must be called by the main function directly.

Types

type Option

type Option func(*config)

Option for gutter

func OptionAssetPath

func OptionAssetPath(p string) Option

OptionAssetPath specify the flutter asset directory.

func OptionICUDataPath

func OptionICUDataPath(p string) Option

OptionICUDataPath specify the path to the ICUData.

func OptionPixelRatio

func OptionPixelRatio(ratio float64) Option

OptionPixelRatio specify the scale factor for the physical screen.

func OptionVmArguments

func OptionVmArguments(a []string) Option

OptionVmArguments specify the arguments to the Dart VM.

func OptionWindowDimension

func OptionWindowDimension(x int, y int) Option

OptionWindowDimension specify the startup's dimention of the window.

func OptionWindowInitializer

func OptionWindowInitializer(ini func(*glfw.Window) error) Option

OptionWindowInitializer allow initializing the window.

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL