Add style to TextInput
in iced_web
This commit is contained in:
parent
8e83f3632c
commit
e953733323
@ -42,6 +42,7 @@ pub struct TextInput<'a, Message> {
|
||||
size: Option<u16>,
|
||||
on_change: Rc<Box<dyn Fn(String) -> Message>>,
|
||||
on_submit: Option<Message>,
|
||||
style: Box<dyn StyleSheet>,
|
||||
}
|
||||
|
||||
impl<'a, Message> TextInput<'a, Message> {
|
||||
@ -75,6 +76,7 @@ impl<'a, Message> TextInput<'a, Message> {
|
||||
size: None,
|
||||
on_change: Rc::new(Box::new(on_change)),
|
||||
on_submit: None,
|
||||
style: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,6 +128,14 @@ impl<'a, Message> TextInput<'a, Message> {
|
||||
self.on_submit = Some(message);
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the style of the [`TextInput`].
|
||||
///
|
||||
/// [`TextInput`]: struct.TextInput.html
|
||||
pub fn style(mut self, style: impl Into<Box<dyn StyleSheet>>) -> Self {
|
||||
self.style = style.into();
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Message> Widget<Message> for TextInput<'a, Message>
|
||||
|
Loading…
x
Reference in New Issue
Block a user