Expand description
Declarative UI framework that draws shapes, text and icons analytically in one wgpu shader.
Re-exports§
Modules§
- anim
- Time-based transitions for values drawn in
paint. - kinetic
- Drag-to-scroll with fling, for widgets that scroll themselves.
- model
- Data behind lists, tables and trees, apart from the widgets that show it. Widgets ask a model how many items there are, for an item and for its key; they rebuild with the rest of the tree and diff rows by key.
- path
- Filled outlines drawn the same way as glyphs.
- widgets
- Starter widget set. Composite widgets should be plain functions over these.
Structs§
- Bitmap
- Immutable RGBA8 pixels, cheap to clone and safe to build on any thread. Decoding is up to the app; the GPU copy lives until the last clone drops.
- BuildCx
- Color
- An sRGB color with straight alpha, each channel in 0..=1. Blending happens in sRGB, as in browsers.
- Element
- A retained node description.
viewrebuilds the tree; framework-owned per-widget state survives rebuilds, keyed by tree position orkey. - EventCx
- Focus
- How a widget takes keyboard focus; see
Widget::focus. - Font
- TrueType/OpenType font data. Fonts are told apart by address, so keep each
one in a
static; it is parsed on first use, and data that doesn’t parse draws in the default font. - Handle
- Typed reference to a stateful widget’s state, cheap to capture in handlers.
- Instant
- A measurement of a monotonically nondecreasing clock.
Opaque and useful only with
Duration. - Notifier
- Asks the UI to rebuild, from any thread: worker threads hold clones and
call
notifyafter changing data the view reads;widgets::watchrebuilds its subtree when that happens. Notifies before the UI exists, or several in a burst, cost one rebuild. - PaintCx
- Pixels
- A rendered frame: sRGB RGBA8, row-major.
- Placement
- Boxes
Widget::scrollworks from, logical px. - Rect
- An axis-aligned box in logical px, y growing downward.
- Scope
- Values provided by ancestors (
provide), innermost last. - Shadow
- A soft shadow: the shape’s box moved by
offset, its edge faded overblur. - Sleep
- The future
sleepreturns. - State
- Framework-owned per-widget state slot.
- Text
- Fonts plus lazily-built glyph outlines, rendered analytically on the GPU.
- Text
Layout - Theme
- The colors widgets draw with. Return one from
App::theme, orprovideone to restyle a subtree; the default is a light look.
Enums§
- Event
- Ink
- What a widget paints with: a fixed color, a theme role, or whatever contrasts with the button or surface around it.
- Key
- Keyboard
- The soft keyboard a text field asks for.
- Layer
- What a layer widget is laid out over.
- Role
- A
Themecolor by name, resolved where the widget is painted.
Traits§
- App
- Root of the UI. State lives in
statefulwidgets and in external sources that builders read;viewruns again whenever any of it changes. - Widget
- Primitive building block. Composite widgets are plain functions returning
Element; implement this only for new layout/paint/input behavior.