Implement custom helper for theme::Button

This commit is contained in:
Héctor Ramón Jiménez 2023-05-19 03:43:11 +02:00
parent 59663d2e45
commit 96aa0379d5
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
2 changed files with 15 additions and 8 deletions

View file

@ -139,6 +139,15 @@ pub enum Button {
Custom(Box<dyn button::StyleSheet<Style = Theme>>),
}
impl Button {
/// Creates a custom [`Button`] style variant.
pub fn custom(
style_sheet: impl button::StyleSheet<Style = Theme> + 'static,
) -> Self {
Self::Custom(Box::new(style_sheet))
}
}
impl button::StyleSheet for Theme {
type Style = Button;