Skip to main content

Widget

Trait Widget 

Source
pub trait Widget: Send + Sync {
    // Provided methods
    fn children(&self) -> Children<'_> { ... }
    fn layout(&self, ctx: &LayoutCtx<'_>) -> Size { ... }
    fn paint(&self, ctx: &mut PaintCtx<'_>) { ... }
    fn flex_factor(&self) -> f32 { ... }
    fn into_element(self) -> Element
       where Self: Sized + 'static { ... }
}

Provided Methods§

Source

fn children(&self) -> Children<'_>

Declare this widget’s children. Drives every default below.

Source

fn layout(&self, ctx: &LayoutCtx<'_>) -> Size

Measure under ctx.constraints and return a size within them.

Defaults: leaf → smallest allowed size; One → the child’s size; Many → stack-like (max of children) — real containers override.

Source

fn paint(&self, ctx: &mut PaintCtx<'_>)

Record draw commands for ctx.rect.

Defaults: leaf → nothing; One → paint the child in this rect; Many → stack-like (all children in this rect) — containers that position children override.

Source

fn flex_factor(&self) -> f32

Flex weight inside Row/Column. Wrappers are transparent by default.

Source

fn into_element(self) -> Element
where Self: Sized + 'static,

Wrap this widget in an Element so it can be returned from Component::build().

Trait Implementations§

Source§

impl Widget for Box<dyn Widget>

Box<dyn Widget> is itself a Widget (D093) — builders accepting impl Widget take boxed children without adapter structs. Fully transparent delegation: no extra tree node, no behavior change.

Source§

fn children(&self) -> Children<'_>

Declare this widget’s children. Drives every default below.
Source§

fn layout(&self, ctx: &LayoutCtx<'_>) -> Size

Measure under ctx.constraints and return a size within them. Read more
Source§

fn paint(&self, ctx: &mut PaintCtx<'_>)

Record draw commands for ctx.rect. Read more
Source§

fn flex_factor(&self) -> f32

Flex weight inside Row/Column. Wrappers are transparent by default.
Source§

fn into_element(self) -> Element
where Self: Sized + 'static,

Wrap this widget in an Element so it can be returned from Component::build().

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Widget for Box<dyn Widget>

Box<dyn Widget> is itself a Widget (D093) — builders accepting impl Widget take boxed children without adapter structs. Fully transparent delegation: no extra tree node, no behavior change.

Source§

fn children(&self) -> Children<'_>

Source§

fn layout(&self, ctx: &LayoutCtx<'_>) -> Size

Source§

fn paint(&self, ctx: &mut PaintCtx<'_>)

Source§

fn flex_factor(&self) -> f32

Implementors§

Source§

impl Widget for Accordion

Source§

impl Widget for AppBar

Source§

impl Widget for AspectRatio

Source§

impl Widget for Autocomplete

Source§

impl Widget for Avatar

Source§

impl Widget for Badge

Source§

impl Widget for BottomNavigationBar

Source§

impl Widget for Button

Source§

impl Widget for Card

Source§

impl Widget for Checkbox

Source§

impl Widget for Chip

Source§

impl Widget for CircularProgress

Source§

impl Widget for Column

Source§

impl Widget for Container

Source§

impl Widget for CustomPaint

Source§

impl Widget for DataTable

Source§

impl Widget for DatePicker

Source§

impl Widget for Dialog

Source§

impl Widget for Dismissible

Source§

impl Widget for Divider

Source§

impl Widget for Dropdown

Source§

impl Widget for Expanded

Source§

impl Widget for FloatingActionButton

Source§

impl Widget for Grid

Source§

impl Widget for Icon

Source§

impl Widget for Image

Source§

impl Widget for ListTile

Source§

impl Widget for ListView

Source§

impl Widget for Menu

Source§

impl Widget for NavItem

Source§

impl Widget for NavRail

Source§

impl Widget for Positioned

Source§

impl Widget for ProgressBar

Source§

impl Widget for PullToRefresh

Source§

impl Widget for Radio

Source§

impl Widget for RatingBar

Source§

impl Widget for RectReader

Source§

impl Widget for Row

Source§

impl Widget for Scaffold

Source§

impl Widget for ScreenTransitionView

Source§

impl Widget for ScrollView

Source§

impl Widget for SegmentedControl

Source§

impl Widget for ShaderPaint

Source§

impl Widget for Sheet

Source§

impl Widget for Skeleton

Source§

impl Widget for Slider

Source§

impl Widget for Snackbar

Source§

impl Widget for Spacer

Source§

impl Widget for Stack

Source§

impl Widget for Stepper

Source§

impl Widget for Switch

Source§

impl Widget for TabBar

Source§

impl Widget for TabView

Source§

impl Widget for Table

Source§

impl Widget for Tabs

Source§

impl Widget for Text

Source§

impl Widget for TextArea

Source§

impl Widget for TextInput

Source§

impl Widget for TimePicker

Source§

impl Widget for Toast

Source§

impl Widget for Tooltip

Source§

impl Widget for Wrap

Source§

impl<W: Widget + Send + Sync + 'static> Widget for AbsorbPointer<W>

Source§

impl<W: Widget + Send + Sync + 'static> Widget for Hero<W>

Source§

impl<W: Widget + Send + Sync + 'static> Widget for IgnorePointer<W>

Source§

impl<W: Widget + Send + Sync + 'static> Widget for InteractiveViewer<W>

Source§

impl<W: Widget + Send + Sync + 'static> Widget for LongPressable<W>

Source§

impl<W: Widget + Send + Sync + 'static> Widget for Pressable<W>

Source§

impl<W: Widget + Send + Sync + 'static> Widget for RepaintBoundary<W>

Source§

impl<W: Widget + Send + Sync + 'static> Widget for TransformLayer<W>

Source§

impl<W: Widget + Send + Sync + 'static> Widget for WithFocus<W>

Source§

impl<W: Widget + Send + Sync + 'static> Widget for WithOverlay<W>