Implement Widget::draw for TextInput

This commit is contained in:
Héctor Ramón Jiménez 2021-10-20 18:40:39 +07:00
parent 954d6349a8
commit e914888f57
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
16 changed files with 381 additions and 339 deletions

View file

@ -39,7 +39,7 @@ pub struct TextInput<'a, Message> {
size: Option<u16>,
on_change: Rc<Box<dyn Fn(String) -> Message>>,
on_submit: Option<Message>,
style_sheet: Box<dyn StyleSheet>,
style_sheet: &'a dyn StyleSheet,
}
impl<'a, Message> TextInput<'a, Message> {
@ -112,8 +112,8 @@ impl<'a, Message> TextInput<'a, Message> {
}
/// Sets the style of the [`TextInput`].
pub fn style(mut self, style: impl Into<Box<dyn StyleSheet>>) -> Self {
self.style_sheet = style.into();
pub fn style(mut self, style_sheet: &'a dyn StyleSheet) -> Self {
self.style_sheet = style_sheet;
self
}
}