Skip to main content

Modifier

Struct Modifier 

Source
pub struct Modifier {
Show 98 fields pub key: Option<u64>, pub size: Option<Size>, pub width: Option<f32>, pub height: Option<f32>, pub required_size: Option<Size>, pub fill_max: Option<f32>, pub fill_max_w: Option<f32>, pub fill_max_h: Option<f32>, pub padding: Option<f32>, pub padding_values: Option<PaddingValues>, pub min_width: Option<f32>, pub min_height: Option<f32>, pub max_width: Option<f32>, pub max_height: Option<f32>, pub required_min_width: Option<f32>, pub required_max_width: Option<f32>, pub required_min_height: Option<f32>, pub required_max_height: Option<f32>, pub default_min_width: Option<f32>, pub default_min_height: Option<f32>, pub background: Option<Brush>, pub state_colors: Option<StateColors>, pub state_elevation: Option<StateElevation>, pub border: Option<Border>, pub flex_grow: Option<f32>, pub flex_shrink: Option<f32>, pub flex_basis: Option<f32>, pub flex_wrap: Option<FlexWrap>, pub flex_dir: Option<FlexDirection>, pub gap: Option<f32>, pub row_gap: Option<f32>, pub column_gap: Option<f32>, pub align_self: Option<AlignSelf>, pub justify_content: Option<JustifyContent>, pub align_items_container: Option<AlignItems>, pub align_content: Option<AlignContent>, pub clip_rounded: Option<[f32; 4]>, pub z_index: f32, pub render_z_index: Option<f32>, pub hit_passthrough: bool, pub input_blocker: bool, pub repaint_boundary: bool, pub click: bool, pub disabled: bool, pub focusable: Option<bool>, pub propagate_min: bool, pub focus_group: bool, pub on_scroll: Option<Rc<dyn Fn(Vec2) -> Vec2>>, pub on_pointer_down: Option<Rc<dyn Fn(PointerEvent)>>, pub on_pointer_move: Option<Rc<dyn Fn(PointerEvent)>>, pub on_pointer_up: Option<Rc<dyn Fn(PointerEvent)>>, pub on_pointer_cancel: Option<Rc<dyn Fn(PointerEvent)>>, pub on_pointer_enter: Option<Rc<dyn Fn(PointerEvent)>>, pub on_pointer_leave: Option<Rc<dyn Fn(PointerEvent)>>, pub on_click: Option<Rc<dyn Fn()>>, pub on_double_click: Option<Rc<dyn Fn()>>, pub on_long_click: Option<Rc<dyn Fn()>>, pub on_globally_positioned: Option<Rc<dyn Fn(Rect)>>, pub on_size_changed: Option<Rc<dyn Fn(Vec2)>>, pub on_key_event: Option<Rc<dyn Fn(KeyEvent) -> bool>>, pub on_preview_key_event: Option<Rc<dyn Fn(KeyEvent) -> bool>>, pub blur: Option<BlurStyle>, pub layout: Option<Rc<dyn Fn(LayoutConstraints) -> (f32, f32)>>, pub semantics: Option<Semantics>, pub alpha: Option<f32>, pub graphics_layer: Option<f32>, pub shadow: Option<ShadowSpec>, pub transform: Option<Transform>, pub grid: Option<GridConfig>, pub grid_col_span: Option<u16>, pub grid_row_span: Option<u16>, pub position_type: Option<PositionType>, pub offset_left: Option<f32>, pub offset_right: Option<f32>, pub offset_top: Option<f32>, pub offset_bottom: Option<f32>, pub margin_left: Option<f32>, pub margin_right: Option<f32>, pub margin_top: Option<f32>, pub margin_bottom: Option<f32>, pub aspect_ratio: Option<f32>, pub intrinsic_width: Option<IntrinsicSize>, pub intrinsic_height: Option<IntrinsicSize>, pub painter: Option<Rc<dyn Fn(&mut Scene, Rect, f32)>>, pub on_drag_start: Option<Rc<dyn Fn(DragStart) -> Option<DragPayload>>>, pub on_drag_end: Option<Rc<dyn Fn(DragEnd)>>, pub on_drag_enter: Option<Rc<dyn Fn(DragOver)>>, pub on_drag_over: Option<Rc<dyn Fn(DragOver)>>, pub on_drag_leave: Option<Rc<dyn Fn(DragOver)>>, pub on_drop: Option<Rc<dyn Fn(DropEvent) -> bool>>, pub on_action: Option<Rc<dyn Fn(Action) -> bool>>, pub cursor: Option<CursorIcon>, pub animate_content_size: Option<AnimationSpec>, pub focus_requester: Option<FocusRequester>, pub on_focus_changed: Option<Rc<dyn Fn(bool)>>, pub interaction_source: Option<InteractionSource>, pub text_input: Option<TextInputConfig>, pub indication: Option<Rc<dyn IndicationNodeFactory>>,
}

Fields§

§key: Option<u64>

Optional stable identity key for this view node.

If set, layout_and_paint will prefer this over child index when assigning stable ViewIds. This is the “escape hatch” for dynamic lists / conditional UI where index-based identity would otherwise shift.

§size: Option<Size>§width: Option<f32>§height: Option<f32>§required_size: Option<Size>§fill_max: Option<f32>§fill_max_w: Option<f32>§fill_max_h: Option<f32>§padding: Option<f32>§padding_values: Option<PaddingValues>§min_width: Option<f32>§min_height: Option<f32>§max_width: Option<f32>§max_height: Option<f32>§required_min_width: Option<f32>

Like [required_size] but only for min width. Overrides parent min constraints.

§required_max_width: Option<f32>

Like [required_size] but only for max width. Overrides parent max constraints.

§required_min_height: Option<f32>

Like [required_size] but only for min height. Overrides parent min constraints.

§required_max_height: Option<f32>

Like [required_size] but only for max height. Overrides parent max constraints.

§default_min_width: Option<f32>

Minimum size that only applies when the incoming constraint is 0 (unconstrained). Use [min_width] for an unconditional minimum.

§default_min_height: Option<f32>§background: Option<Brush>§state_colors: Option<StateColors>§state_elevation: Option<StateElevation>§border: Option<Border>§flex_grow: Option<f32>§flex_shrink: Option<f32>§flex_basis: Option<f32>§flex_wrap: Option<FlexWrap>§flex_dir: Option<FlexDirection>§gap: Option<f32>§row_gap: Option<f32>§column_gap: Option<f32>§align_self: Option<AlignSelf>§justify_content: Option<JustifyContent>§align_items_container: Option<AlignItems>§align_content: Option<AlignContent>§clip_rounded: Option<[f32; 4]>§z_index: f32

Z-index for hit-testing order (higher = receives events first).

§render_z_index: Option<f32>

Z-index for render order (higher = painted on top). If None, uses tree order.

§hit_passthrough: bool

If true, this view does not create hit regions.

§input_blocker: bool

If true, this view blocks pointer/touch input for hits below it.

§repaint_boundary: bool§click: bool§disabled: bool

When true, the component ignores pointer events and appears disabled.

§focusable: Option<bool>

When Some(true), the component can receive keyboard focus regardless of interactivity. When Some(false), the component cannot receive focus even if interactive. When None, focusability is determined implicitly by interactivity (click/pointer/dnd handlers).

§propagate_min: bool

When true, the Box passes its min constraints to children instead of removing them.

§focus_group: bool

When true, this node and its children form a focus group: focus cycles within the group before moving outside it.

§on_scroll: Option<Rc<dyn Fn(Vec2) -> Vec2>>§on_pointer_down: Option<Rc<dyn Fn(PointerEvent)>>§on_pointer_move: Option<Rc<dyn Fn(PointerEvent)>>§on_pointer_up: Option<Rc<dyn Fn(PointerEvent)>>§on_pointer_cancel: Option<Rc<dyn Fn(PointerEvent)>>§on_pointer_enter: Option<Rc<dyn Fn(PointerEvent)>>§on_pointer_leave: Option<Rc<dyn Fn(PointerEvent)>>§on_click: Option<Rc<dyn Fn()>>

Called when the element is clicked (pointer down then up within bounds).

§on_double_click: Option<Rc<dyn Fn()>>

Called when the element is double-clicked/tapped.

§on_long_click: Option<Rc<dyn Fn()>>

Called when the element is long-pressed.

§on_globally_positioned: Option<Rc<dyn Fn(Rect)>>

Called when the element’s global position changes after layout. Provides the element’s rect in window coordinates.

§on_size_changed: Option<Rc<dyn Fn(Vec2)>>

Called when the element’s size changes after layout. Provides the new size.

§on_key_event: Option<Rc<dyn Fn(KeyEvent) -> bool>>

Called when a key event is received while this element is focused. Return true to consume the event. This is the normal handler.

§on_preview_key_event: Option<Rc<dyn Fn(KeyEvent) -> bool>>

Called before on_key_event — if the preview handler returns true, the event is consumed and on_key_event is NOT called.

§blur: Option<BlurStyle>

Apply a gaussian blur to this element’s rendered content. When set, graphics_layer is auto-enabled if not already set. Use Modifier::blur(radius) for uniform blur, or Modifier::blur_with_edge(rx, ry, edge) for per-axis control.

§layout: Option<Rc<dyn Fn(LayoutConstraints) -> (f32, f32)>>

Custom layout callback. When set, the element’s measurement is delegated to this function instead of the default Taffy-based layout. The callback receives LayoutConstraints (min/max width/height in dp). Returns (width, height) for this element.

§semantics: Option<Semantics>§alpha: Option<f32>§graphics_layer: Option<f32>§shadow: Option<ShadowSpec>§transform: Option<Transform>§grid: Option<GridConfig>§grid_col_span: Option<u16>§grid_row_span: Option<u16>§position_type: Option<PositionType>§offset_left: Option<f32>§offset_right: Option<f32>§offset_top: Option<f32>§offset_bottom: Option<f32>§margin_left: Option<f32>§margin_right: Option<f32>§margin_top: Option<f32>§margin_bottom: Option<f32>§aspect_ratio: Option<f32>§intrinsic_width: Option<IntrinsicSize>

Size this node’s width to its min or max intrinsic content size.

§intrinsic_height: Option<IntrinsicSize>

Size this node’s height to its min or max intrinsic content size.

§painter: Option<Rc<dyn Fn(&mut Scene, Rect, f32)>>§on_drag_start: Option<Rc<dyn Fn(DragStart) -> Option<DragPayload>>>§on_drag_end: Option<Rc<dyn Fn(DragEnd)>>§on_drag_enter: Option<Rc<dyn Fn(DragOver)>>§on_drag_over: Option<Rc<dyn Fn(DragOver)>>§on_drag_leave: Option<Rc<dyn Fn(DragOver)>>§on_drop: Option<Rc<dyn Fn(DropEvent) -> bool>>§on_action: Option<Rc<dyn Fn(Action) -> bool>>§cursor: Option<CursorIcon>

Cursor icon hint for desktop/web runners.

§animate_content_size: Option<AnimationSpec>

If set, the size of this node will smoothly animate to its target size whenever content size changes. Uses the provided animation spec.

§focus_requester: Option<FocusRequester>

A FocusRequester handle that will be associated with this view. When the requester’s request_focus() is called, keyboard focus will move to this view.

§on_focus_changed: Option<Rc<dyn Fn(bool)>>

Called when this view gains or loses focus. The boolean parameter is true when focused, false when unfocused.

§interaction_source: Option<InteractionSource>

If set, this view reads its interaction state (hover/press) from this source in addition to the implicit view-ID-based matching. The source state is OR’d with the implicit state, enabling programmatic override of hover/press visuals.

When set, the layout engine also auto-wires the source to emit PointerDown/Up and HoverEnter/Leave events into the source via the hit region’s callbacks.

§text_input: Option<TextInputConfig>

Text input configuration. When set, this box acts as a text input field.

§indication: Option<Rc<dyn IndicationNodeFactory>>

Indication (ripple/overlay) factory for visual feedback on interaction.

Implementations§

Source§

impl Modifier

Source

pub fn then(self, other: Self) -> Self

Chain another modifier’s settings onto this one. Useful for creating reusable modifier templates.

Source§

impl Modifier

Source

pub fn new() -> Self

Source

pub fn key(self, key: u64) -> Self

Attaches a stable identity key to this view node. Use for dynamic lists / conditional UI where index-based identity can shift.

Source

pub fn size(self, w: f32, h: f32) -> Self

Source

pub fn width(self, w: f32) -> Self

Source

pub fn height(self, h: f32) -> Self

Source

pub fn required_size(self, w: f32, h: f32) -> Self

Set a fixed size that overrides parent constraints. Unlike size() which is bounded by the parent’s max constraints, required_size() forces the node to this size regardless of the parent, acting as both min and max.

Source

pub fn required_width_in(self, min: f32, max: f32) -> Self

Source

pub fn required_height_in(self, min: f32, max: f32) -> Self

Source

pub fn required_min_width(self, w: f32) -> Self

Source

pub fn required_max_width(self, w: f32) -> Self

Source

pub fn required_min_height(self, h: f32) -> Self

Source

pub fn required_max_height(self, h: f32) -> Self

Source

pub fn default_min_size(self, w: f32, h: f32) -> Self

Minimum size that only takes effect when the incoming constraint is 0 (unconstrained).

Source

pub fn fill_max_size(self) -> Self

Fill the available space in both dimensions. By default fills 100% (fraction = 1.0). Pass a fraction to fill partially.

Source

pub fn fill_max_size_frac(self, fraction: f32) -> Self

Source

pub fn fill_max_width(self) -> Self

Fill the available width. By default fills 100%.

Source

pub fn fill_max_width_frac(self, fraction: f32) -> Self

Source

pub fn fill_max_height(self) -> Self

Fill the available height. By default fills 100%.

Source

pub fn fill_max_height_frac(self, fraction: f32) -> Self

Source

pub fn padding(self, v: f32) -> Self

Source

pub fn padding_values(self, padding: PaddingValues) -> Self

Source

pub fn ime_padding(self) -> Self

Add padding equal to the current IME (soft keyboard) bottom inset. Combine with system_bars_padding() to handle both system bars and keyboard.

Source

pub fn system_bars_padding(self) -> Self

Add padding equal to the current system bar insets (status bar top, nav bar bottom).

Source

pub fn status_bars_padding(self) -> Self

Add status bar inset as top padding.

Source

pub fn navigation_bars_padding(self) -> Self

Add navigation bar inset as bottom padding.

Source

pub fn min_size(self, w: f32, h: f32) -> Self

Source

pub fn max_size(self, w: f32, h: f32) -> Self

Source

pub fn min_width(self, w: f32) -> Self

Source

pub fn min_height(self, h: f32) -> Self

Source

pub fn max_width(self, w: f32) -> Self

Source

pub fn max_height(self, h: f32) -> Self

Source

pub fn background(self, color: Color) -> Self

Set a solid color background.

Source

pub fn background_brush(self, brush: Brush) -> Self

Set a brush (solid, gradient, etc.) background.

Source

pub fn border(self, width: f32, color: Color, radius: f32) -> Self

Source

pub fn border_radii(self, width: f32, color: Color, radii: [f32; 4]) -> Self

Source

pub fn flex_grow(self, v: f32) -> Self

Source

pub fn flex_shrink(self, v: f32) -> Self

Source

pub fn flex_basis(self, v: f32) -> Self

Source

pub fn flex_wrap(self, w: FlexWrap) -> Self

Source

pub fn flex_dir(self, d: FlexDirection) -> Self

Source

pub fn gap(self, v: f32) -> Self

Source

pub fn row_gap(self, v: f32) -> Self

Source

pub fn column_gap(self, v: f32) -> Self

Source

pub fn align_self(self, a: AlignSelf) -> Self

Source

pub fn align_self_center(self) -> Self

Source

pub fn justify_content(self, j: JustifyContent) -> Self

Source

pub fn align_items(self, a: AlignItems) -> Self

Source

pub fn align_content(self, a: AlignContent) -> Self

Source

pub fn clip_rounded(self, radius: f32) -> Self

Source

pub fn clip_rounded_radii(self, radii: [f32; 4]) -> Self

Source

pub fn z_index(self, z: f32) -> Self

Source

pub fn render_z_index(self, z: f32) -> Self

Sets the render z-index for this view. Higher values are painted on top. Unlike z_index (which only affects hit-testing), this affects visual layering.

Source

pub fn input_blocker(self) -> Self

Prevent pointer/touch from reaching lower layers.

Source

pub fn hit_passthrough(self) -> Self

Source

pub fn clickable(self) -> Self

Source

pub fn clickable_with_source(self, source: &MutableInteractionSource) -> Self

Make this element clickable and attach an InteractionSource for state tracking. Combines .clickable() and .interaction_source(&source) in one call.

Source

pub fn state_colors(self, colors: StateColors) -> Self

Set state-driven background colors for hover, press, disabled states. The layout engine automatically selects and animates between these based on interaction.

Source

pub fn state_elevation(self, elev: StateElevation) -> Self

Set state-driven elevation values for hover, press, disabled states.

Source

pub fn disabled(self) -> Self

Mark this component as disabled - it won’t respond to pointer events.

Source

pub fn enabled(self, enabled: bool) -> Self

Mark this component as enabled or disabled.

Source

pub fn focusable(self, focusable: bool) -> Self

Set explicit focusability for this component. When true, the component can receive keyboard focus even without explicit click/pointer/dnd handlers. When false, focus is suppressed even for interactive components.

Source

pub fn focus_group(self) -> Self

Mark this node as a focus group: focus cycles within this group before moving to siblings outside it.

Source

pub fn interaction_source(self, source: &MutableInteractionSource) -> Self

Attach an InteractionSource to this view. The source provides shared interaction state (hover/press) that supplements the implicit view-ID-based state. The layout engine auto-wires pointer events into the source so it stays in sync with user interaction.

Use this when you need programmatic control of interaction state (e.g., showing pressed state during an async operation) or to share interaction state between components.

Source

pub fn hoverable( self, on_enter: impl Fn() + 'static, on_leave: impl Fn() + 'static, ) -> Self

Convenience: register hover enter/leave callbacks. Shorthand for setting on_pointer_enter and on_pointer_leave.

Source

pub fn hoverable_with_source(self, source: &MutableInteractionSource) -> Self

Attach an InteractionSource to track hover state without explicit callbacks. The source automatically receives HoverEnter/Leave events from the layout engine’s auto-wiring, so you can use it with collect_is_hovered() for custom visuals.

Source

pub fn propagate_min_constraints(self, propagate: bool) -> Self

When true, Box passes min-width/min-height constraints to its children instead of allowing them to shrink below the parent’s min constraints.

Source

pub fn on_scroll(self, f: impl Fn(Vec2) -> Vec2 + 'static) -> Self

Source

pub fn on_pointer_down(self, f: impl Fn(PointerEvent) + 'static) -> Self

Source

pub fn on_pointer_move(self, f: impl Fn(PointerEvent) + 'static) -> Self

Source

pub fn on_pointer_up(self, f: impl Fn(PointerEvent) + 'static) -> Self

Source

pub fn on_pointer_cancel(self, f: impl Fn(PointerEvent) + 'static) -> Self

Source

pub fn on_pointer_enter(self, f: impl Fn(PointerEvent) + 'static) -> Self

Source

pub fn on_pointer_leave(self, f: impl Fn(PointerEvent) + 'static) -> Self

Source

pub fn on_click(self, f: impl Fn() + 'static) -> Self

Source

pub fn on_double_click(self, f: impl Fn() + 'static) -> Self

Source

pub fn on_long_click(self, f: impl Fn() + 'static) -> Self

Source

pub fn semantics(self, s: Semantics) -> Self

Source

pub fn alpha(self, a: f32) -> Self

Source

pub fn graphics_layer(self, alpha: f32) -> Self

Render this subtree into an offscreen texture, then composite it back into the parent with the given group alpha (0.0..=1.0). Allows correct blending when children overlap inside the layer, and sets up the architecture for future layer effects (shadow, blur, clip).

Source

pub fn shadow(self, blur_radius: f32, offset_y: f32) -> Self

Drop shadow with the given blur_radius (dp) and vertical offset_y (dp). The shadow color defaults to black with alpha 64 (~25%). Combines with Modifier::graphics_layer to draw a shadow underneath the layer.

Source

pub fn shadow_with_color( self, blur_radius: f32, offset_y: f32, color: Color, ) -> Self

Drop shadow with a custom color. Alpha 0..=255.

Source

pub fn elevation(self, level: f32) -> Self

Material-style elevation. Auto-scales blur and offset by level (dp) and uses a default shadow color. Level 0 = no shadow; 4 = subtle; 16 = strong. Requires Modifier::graphics_layer to take effect.

Source

pub fn transform(self, t: Transform) -> Self

Source

pub fn grid(self, columns: usize, row_gap: f32, column_gap: f32) -> Self

Source

pub fn grid_span(self, col_span: u16, row_span: u16) -> Self

Source

pub fn absolute(self) -> Self

Source

pub fn offset( self, left: Option<f32>, top: Option<f32>, right: Option<f32>, bottom: Option<f32>, ) -> Self

Source

pub fn offset_left(self, v: f32) -> Self

Source

pub fn offset_right(self, v: f32) -> Self

Source

pub fn offset_top(self, v: f32) -> Self

Source

pub fn offset_bottom(self, v: f32) -> Self

Source

pub fn margin(self, v: f32) -> Self

Source

pub fn margin_horizontal(self, v: f32) -> Self

Source

pub fn margin_vertical(self, v: f32) -> Self

Source

pub fn aspect_ratio(self, ratio: f32) -> Self

Source

pub fn intrinsic_width(self, mode: IntrinsicSize) -> Self

Size this node’s width to its min or max intrinsic content size.

Source

pub fn intrinsic_height(self, mode: IntrinsicSize) -> Self

Size this node’s height to its min or max intrinsic content size.

Source

pub fn painter(self, f: impl Fn(&mut Scene, Rect, f32) + 'static) -> Self

Source

pub fn scale(self, s: f32) -> Self

Source

pub fn scale2(self, sx: f32, sy: f32) -> Self

Source

pub fn translate(self, x: f32, y: f32) -> Self

Source

pub fn translate_vec2(self, v: Vec2) -> Self

Source

pub fn rotate(self, radians: f32) -> Self

Source

pub fn weight(self, w: f32) -> Self

Source

pub fn repaint_boundary(self) -> Self

Marks this view as a repaint boundary candidate.

The engine may cache its painted output.

Source

pub fn on_action(self, f: impl Fn(Action) -> bool + 'static) -> Self

Source

pub fn on_drag_start( self, f: impl Fn(DragStart) -> Option<DragPayload> + 'static, ) -> Self

Mark this node as a drag source. Return Some(payload) to start dragging.

Source

pub fn on_drag_end(self, f: impl Fn(DragEnd) + 'static) -> Self

Called when a drag ends (drop accepted or canceled/ignored).

Source

pub fn on_drag_enter(self, f: impl Fn(DragOver) + 'static) -> Self

Called when a drag first enters this target.

Source

pub fn on_drag_over(self, f: impl Fn(DragOver) + 'static) -> Self

Called on every pointer move while a drag is over this target.

Source

pub fn on_drag_leave(self, f: impl Fn(DragOver) + 'static) -> Self

Called when a drag leaves this target.

Source

pub fn on_drop(self, f: impl Fn(DropEvent) -> bool + 'static) -> Self

Called on pointer release while a drag is over this target. Return true to accept the drop.

Source

pub fn cursor(self, c: CursorIcon) -> Self

Set the cursor icon hint for desktop/web runners.

Source

pub fn animate_content_size(self, spec: AnimationSpec) -> Self

Animate size changes smoothly when the content’s natural size changes. Uses the provided AnimationSpec for the transition. The content will be clipped to the animated size during transitions.

Source

pub fn focus_requester(self, fr: FocusRequester) -> Self

Attach a FocusRequester to this view. The requester will be associated with the view’s focusable element, allowing programmatic focus requests.

Source

pub fn focus_target(self) -> Self

Make this composable a focus target (.focusable(true)). Corresponds to Compose’s Modifier.focusTarget().

Source

pub fn on_focus_changed(self, f: impl Fn(bool) + 'static) -> Self

Register a callback that fires when this view gains or loses keyboard focus. The argument is true when the view receives focus, false when it loses it.

Source

pub fn on_globally_positioned(self, f: impl Fn(Rect) + 'static) -> Self

Called after layout when this element’s position changes. The callback receives the element’s rect in dp (device-independent pixels). Fires whenever the rect changes, including on the initial layout.

Source

pub fn on_size_changed(self, f: impl Fn(Vec2) + 'static) -> Self

Called after layout when this element’s size changes. Provides the new (width, height) in dp.

Source

pub fn on_key_event(self, f: impl Fn(KeyEvent) -> bool + 'static) -> Self

Called when a key event is received while this element is focused. Return true to indicate the event was consumed and should not propagate further (e.g. to text input handling or shortcut dispatch).

Source

pub fn on_preview_key_event( self, f: impl Fn(KeyEvent) -> bool + 'static, ) -> Self

Preview variant of on_key_event. Called before on_key_event; if the preview handler returns true, the event is consumed and on_key_event is NOT called.

Source

pub fn blur(self, radius_dp: f32) -> Self

Apply a gaussian blur to this element’s rendered content. radius_dp is the uniform blur radius in device-independent pixels. Larger values produce a stronger blur. Uses Rectangle edge treatment (clip to bounds).

Requires graphics_layer to be enabled (set automatically if not).

Source

pub fn blur_with_edge( self, radius_x: f32, radius_y: f32, edge_treatment: BlurredEdgeTreatment, ) -> Self

Apply a gaussian blur with separate horizontal/vertical radii. edge_treatment controls how edge pixels are handled.

Requires graphics_layer to be enabled (set automatically if not).

Source

pub fn layout( self, f: impl Fn(LayoutConstraints) -> (f32, f32) + 'static, ) -> Self

Override this element’s measured size with a custom callback. The callback receives LayoutConstraints (min/max width/height in dp), where max_width/max_height may be f32::INFINITY if unbounded. Returns (width, height) for this element.

Child placement is handled by the parent layout (same as Compose’s Modifier.size family).

Source

pub fn text_input(self, config: TextInputConfig) -> Self

Mark this Box as a text input field with the given configuration.

Source

pub fn indication(self, factory: Rc<dyn IndicationNodeFactory>) -> Self

Attach an indication (ripple/highlight) factory for visual feedback. The factory is paired with an InteractionSource (via .interaction_source(...)) to draw press/hover/focus visual feedback.

Trait Implementations§

Source§

impl Clone for Modifier

Source§

fn clone(&self) -> Modifier

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 Modifier

Source§

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

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

impl Default for Modifier

Source§

fn default() -> Modifier

Returns the “default value” for a type. 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.