Expand description
Baseline widget set: Text, Button, Image, Column/Row, Stack, ScrollView, CustomScrollView and its slivers, etc.
Ships the text leaf plus the primitive layout containers —
Row/Column (FlexView), Stack, IndexedStack, Padding,
Align, and SizedBox — built as View/Widget pairs over frust-core’s
AnyView/ChildPod
substrate. Containers own their children directly as ChildPods (the arena
stays single-root); see frust_core::widget::ChildPod for the rationale.
§Shared child plumbing
The container modules build/rebuild/teardown their heterogeneous children
through the authoring::build_child/authoring::rebuild_child/
authoring::teardown_child helpers and route pointer events through
authoring::route_event (multi-child containers — Flex/Stack) or
authoring::route_event_single (one-child wrappers —
Padding/Align/SizedBox). Each child is an
AnyView whose element (Box<dyn Widget>) is stored
double-boxed inside a ChildPod, so a later rebuild can recover
&mut Box<dyn Widget> to drive AnyView’s type-erased reconciliation.
That toolkit is public — see the authoring module — so a design
system is authored outside this crate against exactly the surface the
baseline widgets use themselves. No design-system catalog lives here any
more: the three built-in ones ship as their own plugin crates
(frust-glyph/frust-material/frust-cupertino), each depending on the
frust facade alone, so the authoring boundary is now enforced by the
crate graph rather than by a source scan.
Re-exports§
pub use drag::AUTO_SCROLL_EDGE_PX;pub use drag::AUTO_SCROLL_MAX_PX_PER_S;pub use drag::AutoScroll;pub use drag::AutoScrollZone;pub use drag::AutoScrollZoneWidget;pub use drag::DRAG_THRESHOLD;pub use drag::DragCoordinator;pub use drag::DragHighlight;pub use drag::DragKind;pub use drag::DragPhase;pub use drag::DragPolicy;pub use drag::DragSession;pub use drag::DragSourceId;pub use drag::DragState;pub use drag::DragStateChange;pub use drag::DragSubscription;pub use drag::DragTargetId;pub use drag::DragTargetView;pub use drag::DragTargetWidget;pub use drag::DraggableView;pub use drag::DraggableWidget;pub use drag::GHOST_OPACITY;pub use drag::HIGHLIGHT_FALLBACK;pub use drag::ReorderableListView;pub use drag::SourceFeedback;pub use drag::auto_scroll_zone;pub use drag::drag_target;pub use drag::draggable;pub use drag::draggable;pub use drag::reorderable_list;pub use either::Either;pub use either::EitherOf3;pub use either::EitherOf3Widget;pub use either::EitherOf4;pub use either::EitherOf4Widget;pub use either::EitherOf5;pub use either::EitherOf5Widget;pub use either::EitherOf6;pub use either::EitherOf6Widget;pub use either::EitherOf7;pub use either::EitherOf7Widget;pub use either::EitherOf8;pub use either::EitherOf8Widget;pub use either::EitherWidget;pub use either::either;pub use nav::hero::HeroView;pub use nav::hero::HeroWidget;pub use nav::hero::hero;pub use nav::navigator::BackPolicy;pub use nav::navigator::PageBuilder;pub use nav::navigator::PageVisibility;pub use nav::navigator::PopResult;pub use nav::navigator::PushOptions;pub use nav::navigator::ReplaceOptions;pub use nav::navigator::ResultCallback;pub use nav::navigator::RouteChangeCallback;pub use nav::navigator::VisibilityCallback;pub use nav::navigator::overlay_host;pub use nav::path::Location;pub use nav::path::PathPattern;pub use nav::path::RouteParams;pub use nav::route_state::RouteStack;pub use nav::router::DEFAULT_REDIRECT_LIMIT;pub use nav::router::ErrorBuilder;pub use nav::router::Redirect;pub use nav::router::Resolution;pub use nav::router::ResolvedPage;pub use nav::router::Route;pub use nav::router::RouteBuilder;pub use nav::router::Router;pub use nav::router::shell_route;pub use nav::transition::PageTransition;pub use nav::transition::Timing;pub use nav::transition::TransitionSpec;pub use nav::transition::TransitionState;pub use physics::effect::OverscrollEffect;pub use physics::parity::AlwaysScrollable;pub use physics::parity::Bouncing;pub use physics::parity::Clamping;pub use physics::parity::DecelerationRate;pub use physics::parity::NeverScrollable;pub use physics::rubber_band::RubberBand;pub use physics::MAX_FLING_VELOCITY;pub use physics::MIN_FLING_VELOCITY;pub use physics::ScrollMetrics;pub use physics::ScrollPhysics;pub use physics::Simulation;pub use physics::SpringDescription;pub use physics::Tolerance;pub use pinch::PINCH_SLOP;pub use pinch::PinchDetectorView;pub use pinch::PinchDetectorWidget;pub use pinch::PinchRecognizer;pub use pinch::pinch_detector;pub use scroll_controller::AnimateTo;pub use scroll_controller::ScrollController;pub use scroll_controller::ScrollSubscription;
Modules§
- authoring
- The widget-authoring toolkit: the shared child plumbing, event routing and callback erasure every container/interactive widget is assembled from — the surface for authoring widgets, and whole design systems, outside this crate.
- drag
- Drag-and-drop session model: the
DragCoordinatorhandle every draggable source and drop target in one scope shares. - either
- Statically-typed branching views: the two-arm
Eitherwith its lazyeitherhelper, and the three-to-eight-armEitherOf3..EitherOf8. - icons
- Vendored Material Symbols starter set — GENERATED, do not hand-edit.
- keep_
alive keep_alive: keeps a lazy list’s row alive when it scrolls out of the list’s window — Flutter’sKeepAlive/AutomaticKeepAlive(widgets/automatic_keep_alive.dart), answered bysliver_list.- motion
- Motion module: declarative single-child animation wrappers built over
frust-core’sanimvocabulary (frust_core::AnimationController/frust_core::Curve/frust_core::Tween/frust_core::Spring) and the paint-onlypush_layer/push_transformcompositing primitives (frust_core::PaintScene). - nav
- Imperative navigation: a retained page stack with push/pop/replace and per-page result callbacks, opaque-page paint culling, and test-pinned capture/focus/IME page-switch semantics.
- physics
- Pluggable scroll physics, mirroring Flutter’s
ScrollPhysicscontract: a chainable strategy object a scroll surface (todaycrate::ScrollView/crate::ListView, hard-coded to one behavior) consults for user-offset mapping, boundary rejection, and post-release ballistic motion instead of having that math wired in directly. - pinch
- Touch pinch recognition:
PinchRecognizer, a pure two-contact state machine, andpinch_detector, a transparent wrapper view that feeds it. - scroll_
controller ScrollController: a cloneable, reactive-free handle onto aScrollViewor aListView— the programmatic-scroll seam.
Macros§
- visit_
children - Implement
Widget::visit_childrenfor the container whoseimpl Widgetblock this is written in, forwarding the named fields in the order given.
Structs§
- Align
View - A declarative alignment container. See the module docs.
- Align
Widget - The retained widget for an
AlignView. - Alignment
- A relative alignment within a box: each axis runs
-1.0(start) through0.0(center) to1.0(end). - Button
View - A declarative pressable button. See the module docs.
- Button
Widget - The retained widget for a
ButtonView. The label is a nestedcrate::TextWidgetowned as aChildPod. - Canvas
View - A declarative custom-painting canvas. See the module docs.
- Canvas
Widget - The retained widget for a
CanvasView. See the module docs. - Checkbox
View - A declarative checkbox. See the module docs.
- Checkbox
Widget - The retained widget for a
CheckboxView. - Child
Key - A stable identity for a list child, so a container’s reconciliation can match a child to its live widget by key across reorders/inserts instead of by position — the difference between “the third row’s widget” and “row #42’s widget” when the list is shuffled.
- Container
View - A declarative decorated box. See the module docs.
- Container
Widget - The retained widget for a
ContainerView. See the module docs. - Custom
Scroll View - A declarative scroll surface over a sequence of slivers. See the module docs.
- Divider
View - A declarative hairline separator. See the module docs.
- Divider
Widget - The retained widget for a
DividerView. See the module docs. - Edge
Insets - Per-edge inset amounts, in logical pixels.
- Flex
Child - One child of a
FlexView: an erased child view, itsflexfactor (0= inflexible;> 0= takes a proportional share of the free main space), and an optionalChildKeyfor keyed reconciliation. - Flex
View - A declarative flex container. See the module docs.
- Flex
Widget - The retained widget for a
FlexView. Holds a parallelchildren/flexpair (same length) so layout can index both without a per-child wrapper. - Gesture
Detector View - A declarative gesture wrapper. See the module docs.
- Gesture
Detector Widget - The retained widget for a
GestureDetectorView. - Icon
Button View - A declarative pressable vector icon. See the module docs.
- Icon
Button Widget - The retained widget for an
IconButtonView. The mark is a nestedcrate::IconWidgetowned as aChildPod. - Icon
Data - A cheap-clone handle around an icon’s path data and its design box.
- Icon
Source - A generated icon: SVG path
ddata plus the side length of its square design box. - Icon
View - A declarative icon. See the module docs.
- Icon
Widget - The retained widget for an
IconView. - Image
Error - Error decoding image bytes via
ImageSource::decode. - Image
Source - A decode-once, cheaply-clonable handle around a decoded RGBA8 image.
- Image
View - A declarative description of an image.
- Image
Widget - The retained widget for an
ImageView. - Indexed
Stack View - A declarative indexed stack. See
IndexedStackand the module docs. - Indexed
Stack Widget - The retained widget for an
IndexedStackView. - Keep
Alive Handle - A keep-alive request bound to the lazy-list row it was acquired in. See the module docs.
- Keep
Alive View - A keep-alive wrapper. See
keep_alive. - Keep
Alive Widget - The retained widget for a
KeepAliveView: the child’s pod and the handle bound to its row (Noneoutside a lazy list). - List
View - A declarative, virtualized vertical list. See the module docs.
- List
View Widget - The retained widget for a
ListView: the materialized window of children (children[j]renders itemkeys[j]), the scroll offset + cached viewport, and the same fling bookkeeping ascrate::ScrollWidget. - Overlay
Placement - A resolved placement request: which side, how it lines up, how far off the anchor it sits, and how it may move to stay inside the area.
- Overlay
Portal View - A declarative overlay portal. See
overlay_portal. - Overlay
Portal Widget - The retained widget for an
OverlayPortalView. - Overlay
Slot - One floated surface an owner hosts: the pod, where it goes, and the routing of the input the root sends back to it.
- Padding
View - A declarative padding container. See the module docs.
- Padding
Widget - The retained widget for a
PaddingView. - PanZoom
Controller - A cloneable handle onto a
PanZoomView: drive it withjump_to/fit_to_bounds/fit_rectand read where it stands withtransform. Every clone shares one state, so the handle an app keeps in its state and the one attached to the view are the same. - PanZoom
Transform - Where the content sits:
view = offset + scale · content. - PanZoom
View - A declarative pan/zoom container. See the module docs.
- PanZoom
Widget - The retained widget for a
PanZoomView. - Platform
View View - A declarative platform-view slot. See the module docs.
- Platform
View Widget - The retained widget for a
PlatformViewView. See the module docs. - Radio
View - A declarative radio button. See the module docs.
- Radio
Widget - The retained widget for a
RadioView. - Repaint
Boundary View - A declarative retained-page boundary. See the module docs.
- Repaint
Boundary Widget - The retained widget for a
RepaintBoundaryView. - Safe
Area View - A declarative safe-area container. See the module docs.
- Safe
Area Widget - The retained widget for a
SafeAreaView. - Scaffold
View - A declarative scaffold. See the module docs.
- Scaffold
Widget - The retained widget for a
ScaffoldView. - Scroll
Info - A scroll observation snapshot handed to
ScrollView::on_scroll. - Scroll
View - A declarative vertical scroll surface. See the module docs.
- Scroll
Widget - The retained widget for a
ScrollView: a thin owner of the viewport geometry (its own size, the child’s measured content, the child origin) around the crate’s shared scroll surface core, which runs the drag, fling, overscroll, nested-claim and controller machinery (the module docs’ Shared core). - Shield
View - A declarative z-shield wrapper. See
shieldand the module docs. - Shield
Widget - The retained widget for a
ShieldView. Seeshield. - Sized
BoxView - A declarative fixed-size box, optionally wrapping a child. See the module docs.
- Sized
BoxWidget - The retained widget for a
SizedBoxView. - Slider
View - A declarative slider. See the module docs.
- Slider
Widget - The retained widget for a
SliderView. - Sliver
BoxView - A box child adapted to the sliver protocol. See the module docs.
- Sliver
BoxWidget - The retained widget for a
SliverBoxView: the child’s pod, plus whether the last sliver layout cut the child (so paint clips it). - Sliver
Fill Remaining View - A box child filling the rest of the viewport. See the module docs.
- Sliver
Fill Remaining Widget - The retained widget for a
SliverFillRemainingView: the child’s pod, the mode, and whether the last sliver layout cut the child (so paint clips it). - Sliver
Fixed Extent List View - A lazy list of equal-extent rows. See the module docs.
- Sliver
Fixed Extent List Widget - The retained widget for a
SliverFixedExtentListView: the materialised rows, the constraints rebuild windows against, and the near-edge state. - Sliver
Grid View - A lazy grid of equal cells. See the module docs.
- Sliver
Grid Widget - The retained widget for a
SliverGridView: the materialised cells, the constraints rebuild windows against, and the delegate. - Sliver
List View - A lazy, keyed list of rows that size themselves. See the module docs.
- Sliver
List Widget - The retained widget for a
SliverListView: the materialised rows and their identities, the parked keep-alive rows, the measured extents, the anchor, and the near-edge state. - Sliver
Padding View - Insets around a sliver. See the module docs.
- Sliver
Padding Widget - The retained widget for a
SliverPaddingView. - Sliver
Persistent Header Delegate - What a
sliver_persistent_headershows: its extent range and how to build its content for a shrink offset — Flutter’sSliverPersistentHeaderDelegate. - Sliver
Persistent Header View - A sliver header with a min/max extent. See the module docs.
- Sliver
Persistent Header Widget - The retained widget for a
SliverPersistentHeaderView: the content’s pod, the build inputs it holds and the ones the last layout asked for, and a floating header’s effective scroll offset. - Stack
View - A declarative z-ordered stack. See the module docs.
- Stack
Widget - The retained widget for a
StackView. - Text
Input View - A declarative text field, single-line by default. See the module docs.
- Text
Input Widget - The retained widget for a
TextInputView. - Text
View - A declarative description of a run of text.
- Text
Widget - Retained widget for
TextView: caches the shapedTextLayoutproduced during layout for reuse in paint. - Texture
View - A declarative view of an externally rendered scene texture. See the module docs.
- Texture
Widget - The retained widget for a
TextureView. - Viewport
Widget - The retained widget for a
CustomScrollView: the children’s pods and what the last layout decided for each, the scroll position, and the shared scroll core (the module docs).
Enums§
- Axis
- The axis a
FlexViewlays its children along. - Border
Style - A border’s stroke style, set via
ContainerView::border_style. Solid by default;ContainerView::borderalone (with no.border_stylecall) keeps the pre-existing solid-only behavior unchanged. - Button
Style - Visual style variant for
Button. Additive: the default preserves today’s only look byte-for-byte under every theme. See the module docs for the full role-mapping intent. - Cross
Axis Alignment - How children are aligned along the cross axis.
- Image
Fit - How an
Image’s laid-out box relates to its source’s natural pixel size at paint time. - Main
Axis Alignment - How children are distributed along the main axis.
- Overlay
Align - How a floated surface lines up with its anchor on the cross axis.
- Overlay
Anchor - What a slot places its surface against.
- Overlay
Side - The side of the anchor a floated surface opens on.
- Scroll
Axis - The axis a
CustomScrollViewscrolls along, re-exported so itsaxisbuilder needs no directfrust-coreimport. The axis a viewport scrolls along — Flutter’sAxis, as a sliver’sSliverConstraints.axisreads it. - Sliver
Grid Delegate - How a
sliver_griddivides its cross axis into cells — Flutter’s two stockSliverGridDelegates. Spacings are logical px;child_aspect_ratiois a cell’s cross-axis extent over its main-axis extent (width over height in a vertical grid). - Texture
Fit - How a
TextureViewplaces its texture in the widget’s box.
Constants§
- DEFAULT_
CACHE_ EXTENT - How far past each end of the visible region a
CustomScrollViewlays children out by default, in logical px — Flutter’sRenderAbstractViewport.defaultCacheExtent. - DEFAULT_
MAX_ SCALE - The largest scale a
PanZoomViewallows unlessmax_scalesays otherwise. - DEFAULT_
MIN_ SCALE - The smallest scale a
PanZoomViewallows unlessmin_scalesays otherwise. - DEFAULT_
OFFSET - The default gap between an anchor and the surface placed against it, in logical px.
- DEFAULT_
PADDING - The default margin a placed surface keeps from every edge of the area, in logical px — the viewport padding the collision clamp works against.
Functions§
- Align
- Position
childwithin the align’s box peralignment. - Button
- PascalCase alias for
button, matching the container view-fn vocabulary. - Checkbox
- PascalCase alias for
checkbox. - Column
- A vertical flex (
Axis::Vertical) of inflexible children — the common sugar. UseFlexView::newwithflexiblechildren when some should expand. - Gesture
Detector - Wrap
childin a gesture detector (no recognisers until one is attached, e.g. withGestureDetectorView::on_taporGestureDetectorView::on_long_press). - Icon
- PascalCase alias for
icon. - Icon
Button - PascalCase alias for
icon_button, matching the container view-fn vocabulary (seecrate::Icon/crate::Button’s own aliases). - Image
- Create an image view over a decoded
ImageSource, defaulting toImageFit::Contain. - Indexed
Stack - Keep every child of
childrenmounted and show only the one atindex. - Padding
- Inset
childbyinsetson each edge. - Radio
- PascalCase alias for
radio. - Row
- A horizontal flex (
Axis::Horizontal) of inflexible children — the common sugar. UseFlexView::newwithflexiblechildren when some should expand. - Sized
Box - A box that forces
width/heightwhereSome, passing through whereNone. - Slider
- PascalCase alias for
slider. - Stack
- Overlay
childrenin a z-order stack (first child at the bottom). - Text
Input - PascalCase alias for
text_input. - button
- Create a button labelled
labelthat runson_pressagainst the app state when released inside its bounds. - canvas
- Create a canvas that paints by calling
paint(scene, size, ctx)every time it actually repaints — full-bleed by default (seeCanvasView::expand). See the module docs for the local-space/clip contract and the builder methods that round out the declaration. - checkbox
- Create a checkbox reflecting
checked, labelledlabel, that fireson_toggle(state, !checked)on release inside its bounds. - colored_
box - A childless
ContainerView— the leaf/background family. See the module docs. - column
- An empty vertical flex, ready for fluent children (no
any(..)wrapping). - container
- Wrap
childin aContainerView— the single-child wrapper family. See the module docs. - custom_
scroll_ view - A vertical
CustomScrollViewoverslivers. - divider
- A horizontal hairline of
color, [DEFAULT_THICKNESS] (1px) thick, filling the available width.coloris a required argument, not defaulted — see the module docs’ “Color: required, noThemedependency” section. - flexible
- A flexible child taking
flexproportional shares of the free main-axis space. - icon
- Create an icon view over any
IconDatasource (a generatedIconSource, or a user path viaIconData::from_path), at the default 24.0 logical size with the theme’son_surfacecolor. - icon_
button - Create a pressable vector icon painting
mark, labelledlabelfor accessibility, that runson_pressagainst the app state when released inside its bounds. See the module docs. - indexed_
stack - An empty indexed stack selecting
index, ready for fluent children (noany(..)wrapping). SeeIndexedStack. - inflexible
- An inflexible child, sized to its natural main-axis extent.
- keep_
alive - Keep
child’s lazy-list row alive outside the list’s window (see the module docs). Transparent everywhere else:childis laid out, painted and routed to exactly as if it stood alone. - keyed
- An inflexible child tagged with a stable
ChildKey, for a list whose items reorder, insert, or delete between frames. - list_
view - Create a virtualized
ListView— the free-function spelling ofListView::builder.buildermay return anyView; it is erased here. - overlay_
portal - Float
overlayabove the whole app, anchored tochild’s bounds — the declarative half of the portal. - pan_
zoom - Wrap
childin a pan/zoom view: identity transform, scale boundsDEFAULT_MIN_SCALE..=DEFAULT_MAX_SCALE, no inertia. - place
- Place a
content-sized surface againstanchorinsidearea. - platform_
view - Reserve layout space for a native platform view created by
view_type(the"dev.frust.<Factory>"convention), filling its container by default (see [SlotSize::Expand]). See the module docs for the full builder contract. - radio
- Create a radio reflecting
selected, labelledlabel. Attach a callback withRadioView::on_select; a radio with none is inert (still paints and captures the press, but never fires) — the same optional-callback shape a design system’s own list-item row uses. - repaint_
boundary - Paint
childthrough a retained-page boundary: its body is recorded once and composited from the renderer’s cached page on every later frame where nothing under it changed — see the module docs. Layout, hit-testing and semantics are the child’s own, unchanged. - row
- An empty horizontal flex, ready for fluent children. See [
column]. - safe_
area - Pad
childby the window’s resolved safe-area insets — all four edges enabled by default (opt an edge out with.left/.top/.right/.bottom), never less than.minimum(zero by default) on an enabled edge. The enabled edges’ insets are consumed:child’s subtree reads zero safe-area padding there (see the module docs). - scaffold
- Scaffold
bodyunder no chrome — attachapp_bar/bottom_bar/fabwith the builder methods below. - scroll_
view - Wrap
childin a verticalScrollView— the free-function spelling ofScrollView::new. - selection_
toolbar - Build the baseline framework-drawn selection-toolbar view for
request: a pill of text buttons for whichever verbsrequest.actionsenables. See the module docs. - shield
- Mark
childas frust content that must keep receiving pointer input even where it paints over aninteractiveplatform-view slot (the z-shield — see the module docs). - slider
- Create a slider at
value(clamped to0.0..=1.0) that fireson_change(state, new_value)as it is dragged. - sliver_
box - Adapt
child— any box view — to a sliver: it scrolls by its own main-axis extent and paints the part of itself inside the viewport. See the module docs. - sliver_
fill_ remaining - Fill what is left of the viewport with
child— with a scroll body by default; seeSliverFillRemainingView::has_scroll_bodyand the module docs. - sliver_
fixed_ extent_ list - A lazy list of
item_countrows, eachitem_extentlogical px along the scroll axis, whose row atindexisbuilder(index)— reconciled by item index, withListView::builder’s contract. See the module docs. - sliver_
fixed_ extent_ list_ keyed sliver_fixed_extent_listreconciled by the stable keykey_of(index)instead of by item index, withListView::builder_keyed’s contract:key_ofruns once per materialised row per rebuild, and a duplicate key in one window trips adebug_assert!. See the module docs.- sliver_
grid - A lazy grid of
item_countcells, the cell atindexbeingbuilder(index), laid out bySliverGridView::delegate(two square cells per row unless set) — reconciled by item index. See the module docs. - sliver_
grid_ keyed sliver_gridreconciled by the stable keykey_of(index)instead of by item index, withsliver_fixed_extent_list_keyed’s contract.- sliver_
list - A lazy list of
item_countrows, the row atindexbeingbuilder(index)keyed bykey_of(index), each as long along the scroll axis as it lays itself out. See the module docs. - sliver_
padding - Surround
sliverwithinsets: the main-axis insets scroll before and after it, the cross-axis insets narrow it. A NaN, infinite or negative inset is treated as0.0. See the module docs. - sliver_
persistent_ header - A header sliver that shrinks from
delegate.max_extenttodelegate.min_extentas it scrolls, its content rebuilt bydelegate.buildfor the current shrink offset. It scrolls away like a box unless madepinnedorfloating. See the module docs. - stack
- An empty z-order stack, ready for fluent children (no
any(..)wrapping). - text
- Create a text view rendering
contentwith default styling (16px). Its glyph color defaults to the active theme’son_surfacerole, falling back to black when no theme is set; an explicitTextView::coloroverrides both. - text_
input - Create a controlled text field showing
valuethat fireson_change(state, new_text)on every edit. - texture_
fit_ rect - The rect (relative to the widget’s own origin) a
natural-sized texture is drawn into inside adest-sized box underfit. - texture_
view - A view drawing the scene texture registered under
scene_texture_id, full-bleed andTextureFit::Containby default. See the module docs.