fix: toggler width fixes & cleanup

This commit is contained in:
Ashley Wulber 2026-02-25 11:10:34 -05:00
parent bee2d591db
commit 904133397b
6 changed files with 12 additions and 9 deletions

View file

@ -85,7 +85,7 @@ impl<Message: Clone + 'static> ContextMenu<'_, Message> {
// close existing popups
state.menu_states.clear();
state.active_root.clear();
dbg!("closing existing popups");
shell.publish(self.on_surface_action.as_ref().unwrap()(destroy_popup(id)));
state.view_cursor = view_cursor;
(

View file

@ -350,7 +350,7 @@ pub use toaster::{Toast, ToastId, Toasts, toaster};
mod toggler;
#[doc(inline)]
pub use toggler::toggler;
pub use toggler::{Toggler, toggler};
#[doc(inline)]
pub use tooltip::{Tooltip, tooltip};

View file

@ -41,6 +41,7 @@ pub fn item_row<Message>(children: Vec<Element<Message>>) -> Row<Message> {
row::with_children(children)
.spacing(theme::spacing().space_xs)
.align_y(iced::Alignment::Center)
.width(Length::Fill)
}
/// A settings item aligned in a flex row
@ -59,8 +60,9 @@ pub fn flex_item<'a, Message: 'static>(
.wrapping(Wrapping::Word)
.width(Length::Fill)
.into(),
container(widget).into(),
container(widget).width(Length::Shrink).into(),
])
.width(Length::Fill)
}
inner(title.into(), widget.into())
@ -141,6 +143,10 @@ impl<'a, Message: 'static> Item<'a, Message> {
is_checked: bool,
message: impl Fn(bool) -> Message + 'static,
) -> Row<'a, Message> {
self.control(crate::widget::toggler(is_checked).on_toggle(message))
self.control(
crate::widget::toggler(is_checked)
.width(Length::Shrink)
.on_toggle(message),
)
}
}

View file

@ -55,7 +55,7 @@ impl<'a, Message> Toggler<'a, Message> {
is_toggled,
on_toggle: None,
label: None,
width: Length::Fill,
width: Length::Shrink,
size: Self::DEFAULT_SIZE,
text_size: None,
text_line_height: text::LineHeight::default(),