Fix Scrollable width consistency

This commit is contained in:
Héctor Ramón Jiménez 2020-03-14 23:25:19 +01:00
parent f1168187c9
commit e1438774af
2 changed files with 3 additions and 2 deletions

View File

@ -93,6 +93,7 @@ impl Sandbox for Styling {
ProgressBar::new(0.0..=100.0, self.slider_value).style(self.theme); ProgressBar::new(0.0..=100.0, self.slider_value).style(self.theme);
let scrollable = Scrollable::new(&mut self.scroll) let scrollable = Scrollable::new(&mut self.scroll)
.width(Length::Fill)
.height(Length::Units(100)) .height(Length::Units(100))
.style(self.theme) .style(self.theme)
.push(Text::new("Scroll me!")) .push(Text::new("Scroll me!"))

View File

@ -118,7 +118,7 @@ where
Renderer: 'static + self::Renderer + column::Renderer, Renderer: 'static + self::Renderer + column::Renderer,
{ {
fn width(&self) -> Length { fn width(&self) -> Length {
Length::Fill Widget::<Message, Renderer>::width(&self.content)
} }
fn height(&self) -> Length { fn height(&self) -> Length {
@ -132,7 +132,7 @@ where
) -> layout::Node { ) -> layout::Node {
let limits = limits let limits = limits
.max_height(self.max_height) .max_height(self.max_height)
.width(Length::Fill) .width(Widget::<Message, Renderer>::width(&self.content))
.height(self.height); .height(self.height);
let child_limits = layout::Limits::new( let child_limits = layout::Limits::new(