Draw scrollbar in Widget::draw for Scrollable
This commit is contained in:
parent
a4f4d83161
commit
54a9a232f8
11 changed files with 132 additions and 196 deletions
|
|
@ -14,7 +14,7 @@ pub struct Scrollable<'a, Message> {
|
|||
max_height: u32,
|
||||
content: Column<'a, Message>,
|
||||
#[allow(dead_code)]
|
||||
style: Box<dyn StyleSheet>,
|
||||
style_sheet: &'a dyn StyleSheet,
|
||||
}
|
||||
|
||||
impl<'a, Message> Scrollable<'a, Message> {
|
||||
|
|
@ -27,7 +27,7 @@ impl<'a, Message> Scrollable<'a, Message> {
|
|||
height: Length::Shrink,
|
||||
max_height: u32::MAX,
|
||||
content: Column::new(),
|
||||
style: Default::default(),
|
||||
style_sheet: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -78,8 +78,11 @@ impl<'a, Message> Scrollable<'a, Message> {
|
|||
}
|
||||
|
||||
/// Sets the style of the [`Scrollable`] .
|
||||
pub fn style(mut self, style: impl Into<Box<dyn StyleSheet>>) -> Self {
|
||||
self.style = style.into();
|
||||
pub fn style<'b>(mut self, style_sheet: &'b dyn StyleSheet) -> Self
|
||||
where
|
||||
'b: 'a,
|
||||
{
|
||||
self.style_sheet = style_sheet;
|
||||
self
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue