pub struct TaskListItem { /* private fields */ }Expand description
A task list item with a checkbox
Implementations§
Source§impl TaskListItem
impl TaskListItem
Sourcepub fn new(checked: bool) -> TaskListItem
pub fn new(checked: bool) -> TaskListItem
Create a new task list item
Sourcepub fn with_config(checked: bool, config: ListConfig) -> TaskListItem
pub fn with_config(checked: bool, config: ListConfig) -> TaskListItem
Create a new task list item with custom config
Sourcepub fn child(self, child: impl ElementBuilder + 'static) -> TaskListItem
pub fn child(self, child: impl ElementBuilder + 'static) -> TaskListItem
Add content to the task item
Content is added after the checkbox in a flex row layout.
Sourcepub fn child_box(self, child: Box<dyn ElementBuilder>) -> TaskListItem
pub fn child_box(self, child: Box<dyn ElementBuilder>) -> TaskListItem
Add a boxed child element (for dynamic element types)
Sourcepub fn is_checked(&self) -> bool
pub fn is_checked(&self) -> bool
Check if this task item is checked
Methods from Deref<Target = Div>§
Sourcepub fn element_id(&self) -> Option<&str>
pub fn element_id(&self) -> Option<&str>
Get the element ID if set
Sourcepub fn stateful_context_key(&self) -> Option<&str>
pub fn stateful_context_key(&self) -> Option<&str>
Get the stateful context key if set
Sourcepub fn swap(&mut self) -> Div
pub fn swap(&mut self) -> Div
Swap this Div with a default, returning the original
This is a convenience method for use in state callbacks where you need
to consume self to chain builder methods, then assign back.
Note: This takes ownership of the current Div and leaves a default in its place. All properties are preserved in the returned Div. You must assign the result back to complete the update.
For updating specific properties without the swap pattern, consider using
the setter methods directly (e.g., set_bg(), set_transform()).
§Example
.on_state(|state, div| match state {
ButtonState::Idle => {
*div = div.swap().bg(Color::BLUE).rounded(4.0);
}
ButtonState::Hovered => {
*div = div.swap().bg(Color::CYAN).rounded(8.0);
}
})Sourcepub fn set_bg(&mut self, color: impl Into<Brush>)
pub fn set_bg(&mut self, color: impl Into<Brush>)
Set the background color/brush without consuming self
This is useful in state callbacks where you want to update properties without using the swap pattern.
Sourcepub fn set_rounded(&mut self, radius: f32)
pub fn set_rounded(&mut self, radius: f32)
Set the corner radius without consuming self
Sourcepub fn set_transform(&mut self, transform: Transform)
pub fn set_transform(&mut self, transform: Transform)
Set the transform without consuming self
Sourcepub fn set_shadow(&mut self, shadow: Shadow)
pub fn set_shadow(&mut self, shadow: Shadow)
Set the shadow without consuming self
Sourcepub fn set_opacity(&mut self, opacity: f32)
pub fn set_opacity(&mut self, opacity: f32)
Set the opacity without consuming self
Sourcepub fn set_border(&mut self, width: f32, color: Color)
pub fn set_border(&mut self, width: f32, color: Color)
Set border with width and color without consuming self
Sourcepub fn set_overflow_clip(&mut self, clip: bool)
pub fn set_overflow_clip(&mut self, clip: bool)
Set overflow clip without consuming self
Sourcepub fn set_padding_x(&mut self, px: f32)
pub fn set_padding_x(&mut self, px: f32)
Set horizontal padding without consuming self
Sourcepub fn set_padding_y(&mut self, px: f32)
pub fn set_padding_y(&mut self, px: f32)
Set vertical padding without consuming self
Sourcepub fn set_child(&mut self, child: impl ElementBuilder + 'static)
pub fn set_child(&mut self, child: impl ElementBuilder + 'static)
Clear all children and add a single child
Sourcepub fn clear_children(&mut self)
pub fn clear_children(&mut self)
Clear all children
Sourcepub fn set_w(&mut self, px: f32)
pub fn set_w(&mut self, px: f32)
Set width in pixels without consuming self
This is useful in state callbacks where you want to update layout properties without using the swap pattern.
Sourcepub fn set_h_auto(&mut self)
pub fn set_h_auto(&mut self)
Set height to auto without consuming self
Sourcepub fn set_style(&mut self, style: &ElementStyle)
pub fn set_style(&mut self, style: &ElementStyle)
Sourcepub fn merge(&mut self, other: Div)
pub fn merge(&mut self, other: Div)
Merge properties from another Div into this one
This applies the other Div’s non-default properties on top of this one.
Useful in on_state callbacks to apply changes without reassignment:
.on_state(|state, div| {
div.merge(div().bg(color).child(label));
})Sourcepub fn style_mut(&mut self) -> &mut Style
pub fn style_mut(&mut self) -> &mut Style
Get direct access to the taffy style for advanced configuration
Sourcepub fn event_handlers(&self) -> &EventHandlers
pub fn event_handlers(&self) -> &EventHandlers
Get a reference to the event handlers
Sourcepub fn event_handlers_mut(&mut self) -> &mut EventHandlers
pub fn event_handlers_mut(&mut self) -> &mut EventHandlers
Get a mutable reference to the event handlers
Trait Implementations§
Source§impl Default for TaskListItem
impl Default for TaskListItem
Source§fn default() -> TaskListItem
fn default() -> TaskListItem
Source§impl Deref for TaskListItem
impl Deref for TaskListItem
Source§impl DerefMut for TaskListItem
impl DerefMut for TaskListItem
Source§impl ElementBuilder for TaskListItem
impl ElementBuilder for TaskListItem
Source§fn build(&self, tree: &mut LayoutTree) -> LayoutNodeId
fn build(&self, tree: &mut LayoutTree) -> LayoutNodeId
Source§fn render_props(&self) -> RenderProps
fn render_props(&self) -> RenderProps
Source§fn children_builders(&self) -> &[Box<dyn ElementBuilder>]
fn children_builders(&self) -> &[Box<dyn ElementBuilder>]
Source§fn element_type_id(&self) -> ElementTypeId
fn element_type_id(&self) -> ElementTypeId
Source§fn semantic_type_name(&self) -> Option<&'static str>
fn semantic_type_name(&self) -> Option<&'static str>
Source§fn element_classes(&self) -> &[String]
fn element_classes(&self) -> &[String]
Source§fn text_render_info(&self) -> Option<TextRenderInfo>
fn text_render_info(&self) -> Option<TextRenderInfo>
Source§fn styled_text_render_info(&self) -> Option<StyledTextRenderInfo>
fn styled_text_render_info(&self) -> Option<StyledTextRenderInfo>
Source§fn svg_render_info(&self) -> Option<SvgRenderInfo>
fn svg_render_info(&self) -> Option<SvgRenderInfo>
Source§fn image_render_info(&self) -> Option<ImageRenderInfo>
fn image_render_info(&self) -> Option<ImageRenderInfo>
Source§fn canvas_render_info(
&self,
) -> Option<Rc<dyn Fn(&mut dyn DrawContext, CanvasBounds)>>
fn canvas_render_info( &self, ) -> Option<Rc<dyn Fn(&mut dyn DrawContext, CanvasBounds)>>
Source§fn event_handlers(&self) -> Option<&EventHandlers>
fn event_handlers(&self) -> Option<&EventHandlers>
Source§fn scroll_info(&self) -> Option<ScrollRenderInfo>
fn scroll_info(&self) -> Option<ScrollRenderInfo>
Source§fn scroll_physics(&self) -> Option<Arc<Mutex<ScrollPhysics>>>
fn scroll_physics(&self) -> Option<Arc<Mutex<ScrollPhysics>>>
Source§fn motion_animation_for_child(
&self,
_child_index: usize,
) -> Option<MotionAnimation>
fn motion_animation_for_child( &self, _child_index: usize, ) -> Option<MotionAnimation>
Source§fn motion_bindings(&self) -> Option<MotionBindings>
fn motion_bindings(&self) -> Option<MotionBindings>
Source§fn motion_stable_id(&self) -> Option<&str>
fn motion_stable_id(&self) -> Option<&str>
Source§fn motion_should_replay(&self) -> bool
fn motion_should_replay(&self) -> bool
Source§fn motion_is_suspended(&self) -> bool
fn motion_is_suspended(&self) -> bool
Source§fn motion_is_exiting(&self) -> bool
fn motion_is_exiting(&self) -> bool
Source§fn layout_bounds_storage(&self) -> Option<Arc<Mutex<Option<ElementBounds>>>>
fn layout_bounds_storage(&self) -> Option<Arc<Mutex<Option<ElementBounds>>>>
Source§fn layout_bounds_callback(
&self,
) -> Option<Arc<dyn Fn(ElementBounds) + Send + Sync>>
fn layout_bounds_callback( &self, ) -> Option<Arc<dyn Fn(ElementBounds) + Send + Sync>>
Source§fn bound_scroll_ref(&self) -> Option<&ScrollRef>
fn bound_scroll_ref(&self) -> Option<&ScrollRef>
Source§fn motion_on_ready_callback(
&self,
) -> Option<Arc<dyn Fn(ElementBounds) + Send + Sync>>
fn motion_on_ready_callback( &self, ) -> Option<Arc<dyn Fn(ElementBounds) + Send + Sync>>
Source§fn layout_animation_config(&self) -> Option<LayoutAnimationConfig>
fn layout_animation_config(&self) -> Option<LayoutAnimationConfig>
Source§fn visual_animation_config(&self) -> Option<VisualAnimationConfig>
fn visual_animation_config(&self) -> Option<VisualAnimationConfig>
Auto Trait Implementations§
impl Freeze for TaskListItem
impl !RefUnwindSafe for TaskListItem
impl !Send for TaskListItem
impl !Sync for TaskListItem
impl Unpin for TaskListItem
impl UnsafeUnpin for TaskListItem
impl !UnwindSafe for TaskListItem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.