refactor: icon styling and headerbar icon styling
Headerbar icons are transparent when their window is not focused, but otherwise share the same style as icons with selection. This updates the icon styles to match figma when selected.
This commit is contained in:
parent
6f6eeec0e7
commit
e47684ffdb
11 changed files with 121 additions and 115 deletions
|
|
@ -16,12 +16,14 @@ pub type Button<'a, Message> = Builder<'a, Message, Icon>;
|
|||
pub struct Icon {
|
||||
handle: Handle,
|
||||
vertical: bool,
|
||||
selected: bool,
|
||||
}
|
||||
|
||||
pub fn icon<'a, Message>(handle: impl Into<Handle>) -> Button<'a, Message> {
|
||||
Button::new(Icon {
|
||||
handle: handle.into(),
|
||||
vertical: false,
|
||||
selected: false,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -124,6 +126,11 @@ impl<'a, Message> Button<'a, Message> {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn selected(mut self, selected: bool) -> Self {
|
||||
self.variant.selected = selected;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn vertical(mut self, vertical: bool) -> Self {
|
||||
self.variant.vertical = vertical;
|
||||
self.style = Style::IconVertical;
|
||||
|
|
@ -179,6 +186,7 @@ impl<'a, Message: Clone + 'static> From<Button<'a, Message>> for Element<'a, Mes
|
|||
.padding(0)
|
||||
.id(builder.id)
|
||||
.on_press_maybe(builder.on_press)
|
||||
.selected(builder.variant.selected)
|
||||
.style(builder.style);
|
||||
|
||||
if builder.tooltip.is_empty() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue