sparky

package module
v0.0.0-...-1a09719 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 6 Imported by: 1

README

Sparky ⚡️

Simple and useful helpers for my Fyne projects 🤓

Sparky context

Sparky widgets

Sparky containers

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRenderer

func CreateRenderer(r Renderer) fyne.WidgetRenderer

CreateRenderer creates a widget renderer from a sparky.Renderer.

func MaxFloat32

func MaxFloat32(nums ...float32) float32

MaxFloat32 returns the larger of the passed values.

func MinFloat32

func MinFloat32(nums ...float32) float32

MinFloat32 returns the smaller of the passed values.

Types

type Context

type Context interface {
	// Child creates a child context for a child window. The new context
	// will inherit all the parent context values.
	Child(win fyne.Window) Context
	// Window returns the underlying window.
	Window() fyne.Window
	// PutValue puts a value into the context, that later can be retrieved
	// with GetValue.
	PutValue(key ValueKey, v interface{})
	// GetValue gets a value previously added with PutValue.
	GetValue(key ValueKey) interface{}
	// ShowLoader shows a loader dialog.
	ShowLoader(message string) *Loader
	// ShowModal shows a modal with the specified content.
	ShowModal(content fyne.CanvasObject) *widget.PopUp
	// ShowInfo shows an information alert.
	ShowInfo(title, message string)
	// ShowSuccess shows a success alert.
	ShowSuccess(title, message string)
	// ShowError shows an error alert.
	ShowError(title, message string)
	// ShowConfirm shows a confirm alert. This will return a boolean
	// channel that will have the confirmation response.
	ShowConfirm(title, message, confirmButtonText string) <-chan bool
	// ShowTextInput shows a text input dialog. It will return a nil string
	// if the user cancels the dialog.
	ShowTextInput(title, message, submitText string) <-chan *string
	// ShowPasswordInput shows a password input dialog. It will return a nil string
	// if the user cancels the dialog.
	ShowPasswordInput(title, message, submitText string) <-chan *string
}

Context defines a sparky context.

func NewContext

func NewContext(win fyne.Window) Context

NewContext creates a new sparky context.

func NewContextWithStyle

func NewContextWithStyle(win fyne.Window, s *DialogStyle) Context

NewContextWithStyle creates a new sparky context with style options.

type DialogStyle

type DialogStyle struct {
	MinWidth     float32
	LoaderTitles LoaderTitles
}

DialogStyle define context dialog style.

type Loader

type Loader struct {
	// contains filtered or unexported fields
}

Loader defines sparky loader.

func (*Loader) Done

func (l *Loader) Done(s string) <-chan interface{}

Done stops the loader with a done message.

func (*Loader) Error

func (l *Loader) Error(s string) <-chan interface{}

Error stops the loader with an error message.

func (*Loader) Hide

func (l *Loader) Hide()

Hide hides the loader.

func (*Loader) UpdateMessage

func (l *Loader) UpdateMessage(s string)

UpdateMessage updates loader message.

type LoaderTitles

type LoaderTitles struct {
	Loading string
	Done    string
	Error   string
}

LoaderTitles defines the title text on the specified loader state.

type Renderer

type Renderer interface {
	// CreateContent creates the render content.
	// This function is called only the first time the render is created.
	CreateContent() *fyne.Container
	// Destroy destroys the render content.
	Destroy()
	// Refresh refreshes the render content.
	Refresh()
}

Renderer defines sparky renderer interface.

type ValueKey

type ValueKey int

ValueKey defines key type for injected values.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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