Skip to content

Commit

Permalink
add class function to currently fixed widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
genusistimelord committed May 21, 2024
1 parent 3fb57b2 commit 63247c8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/widgets/badge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ where
self
}

/// Sets the class of the input of the [`Badge`].
#[must_use]
pub fn class(mut self, class: impl Into<Theme::Class<'a>>) -> Self {
self.class = class.into();
self
}

/// Sets the width of the [`Badge`].
#[must_use]
pub fn width(mut self, width: impl Into<Length>) -> Self {
Expand Down
7 changes: 7 additions & 0 deletions src/widgets/card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ where
self
}

/// Sets the class of the input of the [`Card`].
#[must_use]
pub fn class(mut self, class: impl Into<Theme::Class<'a>>) -> Self {
self.class = class.into();
self
}

/// Sets the width of the [`Card`].
#[must_use]
pub fn width(mut self, width: impl Into<Length>) -> Self {
Expand Down
23 changes: 23 additions & 0 deletions src/widgets/number_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,29 @@ where
Bound::Unbounded => T::max_value(),
}
}

/// Sets the style of the input of the [`NumberInput`].
#[must_use]
pub fn input_style(
mut self,
style: impl Fn(&Theme, text_input::Status) -> text_input::Style + 'a,
) -> Self
where
<Theme as text_input::Catalog>::Class<'a>: From<text_input::StyleFn<'a, Theme>>,
{
self.content = self.content.style(style);
self
}

/// Sets the class of the input of the [`NumberInput`].
#[must_use]
pub fn class(
mut self,
class: impl Into<<Theme as style::number_input::Catalog>::Class<'a>>,
) -> Self {
self.class = class.into();
self
}
}

impl<'a, T, Message, Theme, Renderer> Widget<Message, Theme, Renderer>
Expand Down

0 comments on commit 63247c8

Please sign in to comment.