Expand description
Baseline widget set: Text, Button, Image, Column/Row, Stack, ScrollView, etc.
Ships the text leaf plus the primitive layout containers —
Row/Column (FlexView), Stack, 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 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;
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.
- icons
- Vendored Material Symbols starter set — GENERATED, do not hand-edit.
- 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.
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. - 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. - 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. - 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. - 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. - 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.
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.
Constants§
- 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. - 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. - container
- Wrap
childin aContainerView— the single-child wrapper family. See the module docs. - 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. - inflexible
- An inflexible child, sized to its natural main-axis extent.
- 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. - 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. - 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. - 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.