feat: add overlay option to appearance for vertical icon button
This commit is contained in:
parent
47dedfde74
commit
6f2c893cf5
4 changed files with 30 additions and 1 deletions
|
|
@ -16,6 +16,9 @@ pub struct Appearance {
|
|||
/// The [`Background`] of the button.
|
||||
pub background: Option<Background>,
|
||||
|
||||
/// The [`Background`] overlay of the button.
|
||||
pub overlay: Option<Background>,
|
||||
|
||||
/// The border radius of the button.
|
||||
pub border_radius: Radius,
|
||||
|
||||
|
|
@ -52,6 +55,7 @@ impl Appearance {
|
|||
outline_color: Color::TRANSPARENT,
|
||||
icon_color: None,
|
||||
text_color: None,
|
||||
overlay: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -813,6 +813,21 @@ pub fn draw<Renderer: iced_core::Renderer, Theme>(
|
|||
);
|
||||
}
|
||||
|
||||
// Then button overlay if any.
|
||||
if let Some(overlay) = styling.overlay {
|
||||
renderer.fill_quad(
|
||||
renderer::Quad {
|
||||
bounds,
|
||||
border: Border {
|
||||
radius: styling.border_radius,
|
||||
..Default::default()
|
||||
},
|
||||
shadow: Shadow::default(),
|
||||
},
|
||||
overlay,
|
||||
);
|
||||
}
|
||||
|
||||
// Then draw the button contents onto the background.
|
||||
draw_contents(renderer, styling);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue