#[non_exhaustive]pub enum ViewKind {
Show 21 variants
Surface,
Box,
Row,
Column,
Stack,
ZStack,
OverlayHost,
ScrollV {
on_scroll: Option<ScrollCallback>,
set_viewport_height: Option<Rc<dyn Fn(f32)>>,
set_content_height: Option<Rc<dyn Fn(f32)>>,
get_scroll_offset: Option<Rc<dyn Fn() -> f32>>,
set_scroll_offset: Option<Rc<dyn Fn(f32)>>,
show_scrollbar: bool,
tick_scroll: Option<Rc<dyn Fn()>>,
},
ScrollXY {
on_scroll: Option<ScrollCallback>,
set_viewport_width: Option<Rc<dyn Fn(f32)>>,
set_viewport_height: Option<Rc<dyn Fn(f32)>>,
set_content_width: Option<Rc<dyn Fn(f32)>>,
set_content_height: Option<Rc<dyn Fn(f32)>>,
get_scroll_offset_xy: Option<Rc<dyn Fn() -> (f32, f32)>>,
set_scroll_offset_xy: Option<Rc<dyn Fn(f32, f32)>>,
show_scrollbar: bool,
tick_scroll: Option<Rc<dyn Fn()>>,
},
Text {
text: String,
color: Color,
font_size: f32,
soft_wrap: bool,
max_lines: Option<usize>,
overflow: TextOverflow,
font_family: Option<&'static str>,
annotations: Option<Arc<[TextSpan]>>,
},
Button {
on_click: Option<Callback>,
},
TextField {
state_key: ViewId,
hint: String,
multiline: bool,
on_change: Option<Rc<dyn Fn(String)>>,
on_submit: Option<Rc<dyn Fn(String)>>,
focus_tracker: Option<Rc<Cell<bool>>>,
value: String,
visual_transformation: Option<Rc<dyn VisualTransformation>>,
keyboard_type: Option<KeyboardType>,
ime_action: Option<ImeAction>,
},
Slider {
value: f32,
min: f32,
max: f32,
step: Option<f32>,
on_change: Option<CallbackF32>,
},
RangeSlider {
start: f32,
end: f32,
min: f32,
max: f32,
step: Option<f32>,
on_change: Option<CallbackRange>,
},
ProgressBar {
value: f32,
min: f32,
max: f32,
circular: bool,
},
Image {
handle: ImageHandle,
tint: Color,
fit: ImageFit,
},
Ellipse {
rect: Rect,
color: Color,
},
EllipseBorder {
rect: Rect,
color: Color,
width: f32,
},
SubcomposeLayout {
content: Arc<dyn Fn(&SubcomposeScope) -> Vec<(u64, View)>>,
},
Expander {
expanded: bool,
on_toggle: Option<Callback>,
},
TreeRow {
depth: usize,
has_children: bool,
is_expanded: bool,
is_selected: bool,
on_toggle: Option<Callback>,
on_select: Option<Callback>,
},
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Surface
Box
Row
Column
Stack
ZStack
OverlayHost
ScrollV
Fields
on_scroll: Option<ScrollCallback>ScrollXY
Fields
on_scroll: Option<ScrollCallback>Text
Fields
overflow: TextOverflowButton
TextField
Fields
focus_tracker: Option<Rc<Cell<bool>>>Set by the component (e.g. OutlinedTextField) to receive focus-change signals from the layout/paint phase.
visual_transformation: Option<Rc<dyn VisualTransformation>>Optional text display transformation (e.g., password masking).
keyboard_type: Option<KeyboardType>Keyboard type hint for the platform IME.
Slider
RangeSlider
ProgressBar
Image
Ellipse
EllipseBorder
SubcomposeLayout
A layout whose children are produced by calling content with the
current SubcomposeScope. The closure is invoked during reconciliation
and returns a list of (slot_id, view) pairs. Each slot id is a stable
identity used to reconcile the returned view across frames. This is
the building block for BoxWithConstraints and other
constraints-driven layouts.
Note: any Modifier::key set on a returned view is overwritten by its
slot id so the slot’s identity is stable across frames.
Expander
A collapsible section with a clickable header. First child is the header content; remaining children shown only when expanded.
TreeRow
A single row in a tree view with indentation and expand/select support. First child is rendered as the row label/content.