Skip to content

Commit

Permalink
fix(dropdown): styling
Browse files Browse the repository at this point in the history
  • Loading branch information
git-f0x committed Dec 25, 2024
1 parent 35552e0 commit cbbab58
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 43 deletions.
25 changes: 11 additions & 14 deletions src/theme/style/iced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,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,
Expand Down
30 changes: 15 additions & 15 deletions src/widget/dropdown/menu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<_, _, _>);

Expand Down
28 changes: 14 additions & 14 deletions src/widget/dropdown/multi/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<_, _, _>);

Expand Down

0 comments on commit cbbab58

Please sign in to comment.