fix: toggler width fixes & cleanup
This commit is contained in:
parent
bee2d591db
commit
904133397b
6 changed files with 12 additions and 9 deletions
|
|
@ -128,8 +128,7 @@ impl cosmic::Application for Window {
|
|||
"Example row",
|
||||
cosmic::widget::container(
|
||||
toggler(state.example_row)
|
||||
.on_toggle(Message::ToggleExampleRow)
|
||||
.width(Length::Fill),
|
||||
.on_toggle(Message::ToggleExampleRow),
|
||||
),
|
||||
))
|
||||
.add(popup_dropdown(
|
||||
|
|
|
|||
|
|
@ -234,7 +234,6 @@ impl Context {
|
|||
})
|
||||
.width(Length::Fixed(suggested.0 as f32))
|
||||
.height(Length::Fixed(suggested.1 as f32));
|
||||
dbg!(suggested);
|
||||
self.button_from_element(icon, symbolic)
|
||||
}
|
||||
|
||||
|
|
@ -251,7 +250,6 @@ impl Context {
|
|||
(applet_padding_minor_axis, applet_padding_major_axis)
|
||||
};
|
||||
|
||||
dbg!(suggested.0 + 2 * horizontal_padding);
|
||||
crate::widget::button::custom(layer_container(content).center(Length::Fill))
|
||||
.width(Length::Fixed((suggested.0 + 2 * horizontal_padding) as f32))
|
||||
.height(Length::Fixed((suggested.1 + 2 * vertical_padding) as f32))
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
(
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue