mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-02 07:57:29 +00:00
widget/material: clean up package docs, add license, rename file
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
// SPDX-License-Identifier: Unlicense OR MIT
|
||||
|
||||
// Package material implements the Material design.
|
||||
package material
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Unlicense OR MIT
|
||||
|
||||
package material
|
||||
|
||||
import (
|
||||
@@ -1,6 +1,5 @@
|
||||
// SPDX-License-Identifier: Unlicense OR MIT
|
||||
|
||||
// Package material implements the Material design.
|
||||
package material
|
||||
|
||||
import (
|
||||
|
||||
+12
-10
@@ -11,12 +11,12 @@
|
||||
//
|
||||
// This snippet defines a button that prints a message when clicked:
|
||||
//
|
||||
// var gtx *layout.Context
|
||||
// button := new(widget.Button)
|
||||
// var gtx *layout.Context
|
||||
// button := new(widget.Button)
|
||||
//
|
||||
// for button.Clicked(gtx) {
|
||||
// fmt.Println("Clicked!")
|
||||
// }
|
||||
// for button.Clicked(gtx) {
|
||||
// fmt.Println("Clicked!")
|
||||
// }
|
||||
//
|
||||
// Use a Theme to draw the button:
|
||||
//
|
||||
@@ -24,26 +24,28 @@
|
||||
//
|
||||
// th.Button("Click me!").Layout(gtx, button)
|
||||
//
|
||||
// Customization
|
||||
//
|
||||
// Quite often, a program needs to customize the theme provided defaults. Several
|
||||
// options are available, depending on the nature of the change:
|
||||
//
|
||||
// - Mandatory parameters. Some parameters are not part of the widget state but
|
||||
// Mandatory parameters: Some parameters are not part of the widget state but
|
||||
// have no obvious default. In the program above, the button text is a
|
||||
// parameter to the Theme.Button method.
|
||||
//
|
||||
// - Theme-global parameters. For changing the look of all widgets drawn with a
|
||||
// Theme-global parameters: For changing the look of all widgets drawn with a
|
||||
// particular theme, adjust the `Theme` fields:
|
||||
//
|
||||
// theme.Color.Primary = color.RGBA{...}
|
||||
//
|
||||
// - Widget-local parameters. For changing the look of a particular widget,
|
||||
// Widget-local parameters: For changing the look of a particular widget,
|
||||
// adjust the widget specific theme object:
|
||||
//
|
||||
// btn := th.Button("Click me!")
|
||||
// btn.Font.Style = text.Italic
|
||||
// btn.Layout(gtx)
|
||||
//
|
||||
// - Widget variants. A widget can have several distinct representations even
|
||||
// Widget variants: A widget can have several distinct representations even
|
||||
// though the underlying state is the same. A widget.Button can be drawn as a
|
||||
// round icon button:
|
||||
//
|
||||
@@ -51,7 +53,7 @@
|
||||
//
|
||||
// th.IconButton(icon).Layout(gtx, button)
|
||||
//
|
||||
// - Specialized widgets. Theme both define a generic Label method
|
||||
// Specialized widgets: Theme both define a generic Label method
|
||||
// that takes a text size, and specialized methods for standard text
|
||||
// sizes such as Theme.H1 and Theme.Body2.
|
||||
package material
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// SPDX-License-Identifier: Unlicense OR MIT
|
||||
|
||||
// Package material implements the Material design.
|
||||
package material
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// SPDX-License-Identifier: Unlicense OR MIT
|
||||
|
||||
// Package material implements the Material design.
|
||||
package material
|
||||
|
||||
import (
|
||||
|
||||
Reference in New Issue
Block a user