Skip to main content

Widget

Enum Widget 

Source
#[repr(C)]
pub enum Widget {
Show 20 variants Text { content: String, style: TextStyle, }, Image { source: String, shape: ImageShape, ratio: ImageRatio, }, Badge { label: String, tone: Tone, }, ColorDot { color: ProjectColor, }, Divider, Spacer { size: Spacing, }, Row { children: Vec<Widget>, }, Column { children: Vec<Widget>, }, Card { child: Box<Widget>, style: CardStyle, on_press: Option<String>, }, Box { children: Vec<Widget>, align: BoxAlign, scrim: bool, }, Grid { children: Vec<Widget>, }, Button { label: String, style: ButtonStyle, on_press: String, }, IconButton { icon: Icon, on_press: String, }, Chip { label: String, selected: bool, on_press: String, }, TextField { id: String, placeholder: String, value: String, }, Switch { id: String, label: String, value: bool, }, Checkbox { id: String, label: String, value: bool, }, Slider { id: String, value: i32, max: i32, }, Stepper { value: i32, on_decrement: String, on_increment: String, }, Scaffold { title: String, body: Box<Widget>, tabs: Vec<Tab>, back: Option<String>, dark_mode: bool, route: String, depth: u32, },
}
Expand description

The app-agnostic widget tree the shell renders. Fixed across all apps.

Variants§

§

Text

Fields

§content: String
§

Image

Fields

§source: String
§

Badge

Fields

§label: String
§tone: Tone
§

ColorDot

Small non-interactive colored dot — a project/identity hint.

Fields

§

Divider

§

Spacer

Fields

§size: Spacing
§

Row

Fields

§children: Vec<Widget>
§

Column

Fields

§children: Vec<Widget>
§

Card

Card; tappable when on_press is set.

Fields

§child: Box<Widget>
§on_press: Option<String>
§

Box

Z-stack: children layered back-to-front, positioned by align. With scrim, the first child is a background image, darkened for legibility, and the rest render on top in light content.

Fields

§children: Vec<Widget>
§align: BoxAlign
§scrim: bool
§

Grid

Fixed 2-column grid; children flow left-to-right, top-to-bottom.

Fields

§children: Vec<Widget>
§

Button

Fields

§label: String
§on_press: String
§

IconButton

Fields

§icon: Icon
§on_press: String
§

Chip

Fields

§label: String
§selected: bool
§on_press: String
§

TextField

Fields

§placeholder: String
§value: String
§

Switch

Fields

§label: String
§value: bool
§

Checkbox

Fields

§label: String
§value: bool
§

Slider

Continuous 0..=max slider; emits Input { id, Int }.

Fields

§value: i32
§max: i32
§

Stepper

Numeric stepper with −/+ controls carrying their own events.

Fields

§value: i32
§on_decrement: String
§on_increment: String
§

Scaffold

App shell: a top bar (title + optional back), a scrollable body, and bottom-nav tabs. dark_mode is theme-as-data — the shell themes the whole app from it.

route + depth drive navigation: the shell animates the body when route (the current screen’s identity) changes — slide for push/pop (direction from whether depth grew or shrank), crossfade for a lateral move at the same depth — and wires the system back button to back.

Fields

§title: String
§body: Box<Widget>
§tabs: Vec<Tab>
§dark_mode: bool
§route: String
§depth: u32

Trait Implementations§

Source§

impl Clone for Widget

Source§

fn clone(&self) -> Widget

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Widget

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Widget

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Widget, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'ʄ> Facet<'ʄ> for Widget

Source§

const SHAPE: &'static Shape

The shape of this type, including: whether it’s a Struct, an Enum, something else? Read more
Source§

impl Serialize for Widget

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,