diff --git a/src/app/mod.rs b/src/app/mod.rs index 426f92f8..45b53fc6 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -852,8 +852,7 @@ impl ApplicationExt for App { Message::Cosmic(cosmic::Message::ToggleNavBarCondensed) } else { Message::Cosmic(cosmic::Message::ToggleNavBar) - }) - .class(crate::theme::Button::HeaderBar); + }); header = header.start(toggle); } diff --git a/src/theme/style/button.rs b/src/theme/style/button.rs index 68145b4b..9f32b72b 100644 --- a/src/theme/style/button.rs +++ b/src/theme/style/button.rs @@ -14,13 +14,13 @@ use crate::{ #[derive(Default)] pub enum Button { AppletIcon, + AppletMenu, Custom { active: Box Style>, disabled: Box Style>, hovered: Box Style>, pressed: Box Style>, }, - AppletMenu, Destructive, HeaderBar, Icon, @@ -31,6 +31,7 @@ pub enum Button { MenuFolder, MenuItem, MenuRoot, + NavToggle, #[default] Standard, Suggested, @@ -73,7 +74,7 @@ pub fn appearance( } } - Button::Icon | Button::IconVertical | Button::HeaderBar => { + Button::Icon | Button::IconVertical | Button::HeaderBar | Button::NavToggle => { if matches!(style, Button::IconVertical) { corner_radii = &cosmic.corner_radii.radius_m; if selected { @@ -82,6 +83,9 @@ pub fn appearance( ))); } } + if matches!(style, Button::NavToggle) { + corner_radii = &cosmic.corner_radii.radius_s; + } let (background, text, icon) = color(&cosmic.icon_button); appearance.background = Some(Background::Color(background)); diff --git a/src/theme/style/iced.rs b/src/theme/style/iced.rs index 1b6a156d..b12d77f4 100644 --- a/src/theme/style/iced.rs +++ b/src/theme/style/iced.rs @@ -528,17 +528,7 @@ impl iced_container::Catalog for Theme { } } - Container::ContextDrawer => { - let mut appearance = Container::primary(cosmic); - - appearance.shadow = Shadow { - color: cosmic.shade.into(), - offset: Vector::new(0.0, 0.0), - blur_radius: 16.0, - }; - - appearance - } + Container::ContextDrawer => Container::primary(cosmic), Container::Background => Container::background(cosmic), @@ -546,20 +536,17 @@ impl iced_container::Catalog for Theme { Container::Secondary => Container::secondary(cosmic), - Container::Dropdown => { - let theme = self.cosmic(); - - iced_container::Style { - icon_color: None, - text_color: None, - background: Some(iced::Background::Color(theme.primary.base.into())), - border: Border { - radius: cosmic.corner_radii.radius_xs.into(), - ..Default::default() - }, - shadow: Shadow::default(), - } - } + Container::Dropdown => iced_container::Style { + icon_color: None, + text_color: None, + background: Some(iced::Background::Color(cosmic.bg_component_color().into())), + border: Border { + color: cosmic.bg_component_divider().into(), + width: 1.0, + radius: cosmic.corner_radii.radius_s.into(), + }, + shadow: Shadow::default(), + }, Container::Tooltip => iced_container::Style { icon_color: None, diff --git a/src/widget/dropdown/menu/mod.rs b/src/widget/dropdown/menu/mod.rs index 66574420..045a5ef0 100644 --- a/src/widget/dropdown/menu/mod.rs +++ b/src/widget/dropdown/menu/mod.rs @@ -156,21 +156,21 @@ impl<'a, Message: 'a> Overlay<'a, Message> { style, } = menu; - let mut container = Container::new(Scrollable::new(List { - options, - icons, - hovered_option, - selected_option, - on_selected, - on_option_hovered, - text_size, - text_line_height, - padding, - })); - - container = container - .padding(padding) - .class(crate::style::Container::Dropdown); + let mut container = Container::new(Scrollable::new( + Container::new(List { + options, + icons, + hovered_option, + selected_option, + on_selected, + on_option_hovered, + text_size, + text_line_height, + padding, + }) + .padding(padding), + )) + .class(crate::style::Container::Dropdown); state.tree.diff(&mut container as &mut dyn Widget<_, _, _>); diff --git a/src/widget/dropdown/multi/menu.rs b/src/widget/dropdown/multi/menu.rs index 5e3aa6a6..f5ee5f5b 100644 --- a/src/widget/dropdown/multi/menu.rs +++ b/src/widget/dropdown/multi/menu.rs @@ -152,20 +152,20 @@ impl<'a, Message: 'a> Overlay<'a, Message> { style, } = menu; - let mut container = Container::new(Scrollable::new(InnerList { - options, - hovered_option, - selected_option, - on_selected, - on_option_hovered, - padding, - text_size, - text_line_height, - })); - - container = container - .padding(padding) - .class(crate::style::Container::Dropdown); + let mut container = Container::new(Scrollable::new( + Container::new(InnerList { + options, + hovered_option, + selected_option, + on_selected, + on_option_hovered, + padding, + text_size, + text_line_height, + }) + .padding(padding), + )) + .class(crate::style::Container::Dropdown); state.tree.diff(&mut container as &mut dyn Widget<_, _, _>); diff --git a/src/widget/header_bar.rs b/src/widget/header_bar.rs index fd010603..1f70220f 100644 --- a/src/widget/header_bar.rs +++ b/src/widget/header_bar.rs @@ -299,7 +299,6 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> { let mut end = std::mem::take(&mut self.end); // Also packs the window controls at the very end. - end.push(widget::horizontal_space().width(Length::Fixed(12.0)).into()); end.push(self.window_controls()); let height = match self.density.unwrap_or_else(crate::config::header_size) { diff --git a/src/widget/nav_bar_toggle.rs b/src/widget/nav_bar_toggle.rs index bd14cf3f..1d807060 100644 --- a/src/widget/nav_bar_toggle.rs +++ b/src/widget/nav_bar_toggle.rs @@ -20,7 +20,7 @@ pub fn nav_bar_toggle() -> NavBarToggle { NavBarToggle { active: false, on_toggle: None, - class: crate::theme::Button::Text, + class: crate::theme::Button::NavToggle, selected: false, } }