diff options
author | 2020-04-18 19:28:05 +0200 | |
---|---|---|
committer | 2020-07-08 10:59:57 +0200 | |
commit | ada8d7c77f9e1d4a1de762b514c9610f7e09b17f (patch) | |
tree | 7f0490a0c3833924881b95fed1218c5ef5455313 /examples | |
parent | f7a370b6b9b5d33d1d3c078d2865eacf813cd652 (diff) | |
download | iced-ada8d7c77f9e1d4a1de762b514c9610f7e09b17f.tar.gz iced-ada8d7c77f9e1d4a1de762b514c9610f7e09b17f.tar.bz2 iced-ada8d7c77f9e1d4a1de762b514c9610f7e09b17f.zip |
Implement `Widget::overlay` for `Scrollable`
Diffstat (limited to 'examples')
-rw-r--r-- | examples/combo_box/src/main.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/examples/combo_box/src/main.rs b/examples/combo_box/src/main.rs index 75a3f713..977dc196 100644 --- a/examples/combo_box/src/main.rs +++ b/examples/combo_box/src/main.rs @@ -1,6 +1,6 @@ use iced::{ - button, combo_box, Button, Column, ComboBox, Container, Element, Length, - Sandbox, Settings, Text, + button, combo_box, scrollable, Align, Button, ComboBox, Container, Element, + Length, Sandbox, Scrollable, Settings, Space, Text, }; pub fn main() { @@ -9,6 +9,7 @@ pub fn main() { #[derive(Default)] struct Example { + scroll: scrollable::State, button: button::State, combo_box: combo_box::State, selected_language: Language, @@ -51,8 +52,11 @@ impl Sandbox for Example { let button = Button::new(&mut self.button, Text::new("Press me!")) .on_press(Message::ButtonPressed); - let mut content = Column::new() + let mut content = Scrollable::new(&mut self.scroll) + .width(Length::Fill) + .align_items(Align::Center) .spacing(10) + .push(Space::with_height(Length::Units(800))) .push(Text::new("Which is your favorite language?")) .push(combo_box); @@ -60,7 +64,9 @@ impl Sandbox for Example { content = content.push(Text::new("You are wrong!")); } - content = content.push(button); + content = content + .push(button) + .push(Space::with_height(Length::Units(800))); Container::new(content) .width(Length::Fill) |