• Stars
    star
    209
  • Rank 181,390 (Top 4 %)
  • Language
    Go
  • License
    Other
  • Created over 3 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Community extensions to the cross platform GUI in Go based on Material Design

Go API Reference Join us on Slack
Code Status Build Status Coverage Status

About

This repository holds community extensions for the Fyne toolkit.

This is in early development and more information will appear soon.

Layouts

Community contributed layouts.

import "fyne.io/x/fyne/layout"

Responsive Layout

The responsive layout provides a "bootstrap like" configuration to automatically make containers and canvas reponsive to the window width. It reacts to the window size to resize and move the elements. The sizes are configured with a ratio of the container width (0.5 is 50% of the container size).

The responsive layout follow the bootstrap size breakpoints:

  • extra small for window width <= 576px
  • small for window width <= 768
  • medium for window width <= 992
  • large for window width <= 1200
  • extra large for windo width > 1200

Responsive Layout

To use a responsive layout:

layout := NewResponsiveLayout(fyne.CanvasObject...)

Optionally, Each canvas object can be encapsulated with Responsive() function to give the sizes:

layout := NewResponsiveLayout(
    Responsive(object1),            // all sizes to 100%
    Responsive(object2, 0.5, 0.75), // small to 50%, medium to 75%, all others to 100% 
)

Widgets

Community contributed widgets.

import "fyne.io/x/fyne/widget"

Calendar

A date picker which returns a time object with the selected date.

Calendar widget

To use create a new calendar with a given time and a callback function:

calendar := widget.NewCalendar(time.Now(), onSelected, cellSize, padding)

Demo available for example usage

Animated Gif

A widget that will run animated gifs.

gif, err := NewAnimatedGif(storage.NewFileURI("./testdata/gif/earth.gif"))
gif.Start()

FileTree

An extension of widget.Tree for displaying a file system hierarchy.

tree := widget.NewFileTree(storage.NewFileURI("~")) // Start from home directory
tree.Filter = storage.NewExtensionFileFilter([]string{".txt"}) // Filter files
tree.Sorter = func(u1, u2 fyne.URI) bool {
    return u1.String() < u2.String() // Sort alphabetically
}

FileTree Widget

CompletionEntry

An extension of widget.Entry for displaying a popup menu for completion. The "up" and "down" keys on the keyboard are used to navigate through the menu, the "Enter" key is used to confirm the selection. The options can also be selected with the mouse. The "Escape" key closes the selection list.

entry := widget.NewCompletionEntry([]string{})

// When the use typed text, complete the list.
entry.OnChanged = func(s string) {
    // completion start for text length >= 3
    if len(s) < 3 {
        entry.HideCompletion()
        return
    }

    // Make a search on wikipedia
    resp, err := http.Get(
        "https://en.wikipedia.org/w/api.php?action=opensearch&search=" + entry.Text,
    )
    if err != nil {
        entry.HideCompletion()
        return
    }

    // Get the list of possible completion
    var results [][]string
    json.NewDecoder(resp.Body).Decode(&results)

    // no results
    if len(results) == 0 {
        entry.HideCompletion()
        return
    }

    // then show them
    entry.SetOptions(results[1])
    entry.ShowCompletion()
}

CompletionEntry Widget

7-Segment ("Hex") Display

A skeuomorphic widget simulating a 7-segment "hex" display. Supports setting digits by value, as well as directly controlling which segments are on or off.

Check out the demo for an example of usage.

h := widget.NewHexWidget()
// show the value 'F' on the display
h.Set(0xf)

Map

An OpenStreetMap widget that can the user can pan and zoom. To use this in your app and be compliant with their requirements you may need to request permission to embed in your specific software.

m := NewMap()

Data Binding

Community contributed data sources for binding.

import fyne.io/x/fyne/data/binding

WebString

A WebSocketString binding creates a String data binding to the specified web socket URL. Each time a message is read the value will be converted to a string and set on the binding. It is also Closable so you should be sure to call Close() once you are completed using it.

s, err := binding.NewWebSocketString("wss://demo.piesocket.com/v3/channel_1?api_key=oCdCMcMPQpbvNjUIzqtvF1d2X2okWpDQj4AwARJuAgtjhzKxVEjQU6IdCjwm&notify_self")
l := widget.NewLabelWithData(s)

The code above uses a test web sockets server from "PieSocket", you can run the code above and go to their test page to send messages. The widget will automatically update to the latest data sent through the socket.

MqttString

A MqttString binding creates a String data binding to the specified topic associated with the specified MQTT client connection. Each time a message is received the value will be converted to a string and set on the binding. Each time the value is edited, it will be sent back over MQTT on the specified topic. It is also a Closer so you should be sure to call Close once you are completed using it to disconnect the topic handler from the MQTT client connection.

opts := mqtt.NewClientOptions()
opts.AddBroker("tcp://broker.emqx.io:1883")
opts.SetClientID("fyne_demo")
client := mqtt.NewClient(opts)

token := client.Connect()
token.Wait()
if err := token.Error(); err != nil {
    // Handle connection error
}

s, err := binding.NewMqttString(client, "fyne.io/x/string")

Data Validation

Community contributed validators.

import fyne.io/x/fyne/data/validation

Password

A validator for validating passwords. Uses https://github.com/wagslane/go-password-validator for validation using an entropy system.

pw := validation.NewPassword(70) // Minimum password entropy allowed defined as 70.

More Repositories

1

fyne

Cross platform GUI toolkit in Go inspired by Material Design
Go
22,970
star
2

examples

Examples apps using the Fyne toolkit
Go
578
star
3

fynedesk

A full desktop environment for Linux/Unix using Fyne
Go
526
star
4

fyne-cross

Cross compiler tool for Fyne apps
Go
217
star
5

terminal

A graphical terminal emulator for Linux using Fyne
Go
217
star
6

defyne

The Fyne IDE
Go
162
star
7

calculator

Fyne Calculator application
Go
45
star
8

developer.fyne.io

Fyne developer documentation website
HTML
27
star
9

solitaire

Fyne solitaire application
Go
24
star
10

pixeledit

A image pixel editing app
Go
20
star
11

apps

Fyne App Browser
Go
18
star
12

fin

A Fyne login manager for linux desktop computers
Go
17
star
13

apps.fyne.io

A central listing site for available Fyne applications
CSS
17
star
14

fyne-io.github.io

Fyne.io Website
SCSS
15
star
15

7guis

Fyne implementation of 7GUIs: A GUI Programming Benchmark - https://eugenkiss.github.io/7guis/
Go
13
star
16

life

Fyne game of life simulation
Go
11
star
17

flatpak_demo

A demo of a Fyne application packaged as a Flatpak.
Go
6
star
18

gomobile-bridge

A bridge module for Fyne based mobile apps and libraries that rely on gomobile
Go
6
star
19

setup

Helper tools for getting your development environment set up for Fyne
Go
4
star
20

demo.fyne.io

Fyne website to demo running inside a browser
JavaScript
3
star
21

image

Collection of image codecs useful in GUI apps
Go
3
star
22

fyne-cross-images

Repository for managing fyne-cross images
Dockerfile
3
star
23

tour.fyne.io

A web based tour of the Fyne toolkit - replaced by developer.fyne.io/tour/
Go
3
star
24

proposals

Proposals that we are working on for future releases
3
star
25

docs.fyne.io

Documentation website
SCSS
3
star
26

tutorials

Source code for all of the YouTube / https://developer.fyne.io tutorials
Go
2
star
27

tools

Toolchain and helpful commands for building and managing Fyne apps
Go
2
star
28

conf.fyne.io

Website for Fyne Conference information
HTML
1
star
29

cloud

Cloud providers and helpers for the Fyne toolkit
Go
1
star