mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +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
|
// SPDX-License-Identifier: Unlicense OR MIT
|
||||||
|
|
||||||
// Package material implements the Material design.
|
|
||||||
package material
|
package material
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Unlicense OR MIT
|
||||||
|
|
||||||
package material
|
package material
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Unlicense OR MIT
|
// SPDX-License-Identifier: Unlicense OR MIT
|
||||||
|
|
||||||
// Package material implements the Material design.
|
|
||||||
package material
|
package material
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
+12
-10
@@ -11,12 +11,12 @@
|
|||||||
//
|
//
|
||||||
// This snippet defines a button that prints a message when clicked:
|
// This snippet defines a button that prints a message when clicked:
|
||||||
//
|
//
|
||||||
// var gtx *layout.Context
|
// var gtx *layout.Context
|
||||||
// button := new(widget.Button)
|
// button := new(widget.Button)
|
||||||
//
|
//
|
||||||
// for button.Clicked(gtx) {
|
// for button.Clicked(gtx) {
|
||||||
// fmt.Println("Clicked!")
|
// fmt.Println("Clicked!")
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// Use a Theme to draw the button:
|
// Use a Theme to draw the button:
|
||||||
//
|
//
|
||||||
@@ -24,26 +24,28 @@
|
|||||||
//
|
//
|
||||||
// th.Button("Click me!").Layout(gtx, button)
|
// th.Button("Click me!").Layout(gtx, button)
|
||||||
//
|
//
|
||||||
|
// Customization
|
||||||
|
//
|
||||||
// Quite often, a program needs to customize the theme provided defaults. Several
|
// Quite often, a program needs to customize the theme provided defaults. Several
|
||||||
// options are available, depending on the nature of the change:
|
// 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
|
// have no obvious default. In the program above, the button text is a
|
||||||
// parameter to the Theme.Button method.
|
// 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:
|
// particular theme, adjust the `Theme` fields:
|
||||||
//
|
//
|
||||||
// theme.Color.Primary = color.RGBA{...}
|
// 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:
|
// adjust the widget specific theme object:
|
||||||
//
|
//
|
||||||
// btn := th.Button("Click me!")
|
// btn := th.Button("Click me!")
|
||||||
// btn.Font.Style = text.Italic
|
// btn.Font.Style = text.Italic
|
||||||
// btn.Layout(gtx)
|
// 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
|
// though the underlying state is the same. A widget.Button can be drawn as a
|
||||||
// round icon button:
|
// round icon button:
|
||||||
//
|
//
|
||||||
@@ -51,7 +53,7 @@
|
|||||||
//
|
//
|
||||||
// th.IconButton(icon).Layout(gtx, button)
|
// 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
|
// that takes a text size, and specialized methods for standard text
|
||||||
// sizes such as Theme.H1 and Theme.Body2.
|
// sizes such as Theme.H1 and Theme.Body2.
|
||||||
package material
|
package material
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Unlicense OR MIT
|
// SPDX-License-Identifier: Unlicense OR MIT
|
||||||
|
|
||||||
// Package material implements the Material design.
|
|
||||||
package material
|
package material
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Unlicense OR MIT
|
// SPDX-License-Identifier: Unlicense OR MIT
|
||||||
|
|
||||||
// Package material implements the Material design.
|
|
||||||
package material
|
package material
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
Reference in New Issue
Block a user