diff options
author | 2019-10-27 01:24:08 +0200 | |
---|---|---|
committer | 2019-10-27 01:24:08 +0200 | |
commit | 09bd2c46c06eba72da40852d82a52e7353cc9e9b (patch) | |
tree | bf9f9caa19f7f4fd33a1eb99958e0da5c2ad7a23 /examples/scroll.rs | |
parent | 719c073fc67c87d6b2da1bc01b74751d3f5e59f0 (diff) | |
download | iced-09bd2c46c06eba72da40852d82a52e7353cc9e9b.tar.gz iced-09bd2c46c06eba72da40852d82a52e7353cc9e9b.tar.bz2 iced-09bd2c46c06eba72da40852d82a52e7353cc9e9b.zip |
Expose scrollable offset properly
Diffstat (limited to 'examples/scroll.rs')
-rw-r--r-- | examples/scroll.rs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/examples/scroll.rs b/examples/scroll.rs index 648b1d8f..2f250ff8 100644 --- a/examples/scroll.rs +++ b/examples/scroll.rs @@ -1,6 +1,6 @@ use iced::{ - button, scrollable, Align, Application, Button, Color, Element, Image, - Length, Scrollable, Text, + button, scrollable, Align, Application, Button, Color, Column, Element, + Image, Justify, Length, Scrollable, Text, }; pub fn main() { @@ -32,12 +32,7 @@ impl Application for Example { } fn view(&mut self) -> Element<Message> { - let content = Scrollable::new(&mut self.scroll) - .width(Length::Fill) - .max_width(Length::Units(600)) - .spacing(20) - .padding(20) - .align_self(Align::Center); + let content = Scrollable::new(&mut self.scroll).spacing(20).padding(20); //let content = (0..self.paragraph_count) // .fold(content, |column, _| column.push(lorem_ipsum())) @@ -49,8 +44,12 @@ impl Application for Example { // .align_self(Align::Center), // ); - (0..10) - .fold(content, |content, _| { + Column::new() + .height(Length::Fill) + .max_width(Length::Units(600)) + .align_self(Align::Center) + .justify_content(Justify::Center) + .push((0..3).fold(content, |content, _| { content.push( Image::new(format!( "{}/examples/resources/ferris.png", @@ -59,7 +58,7 @@ impl Application for Example { .width(Length::Units(400)) .align_self(Align::Center), ) - }) + })) .into() } } |