diff options
author | 2024-02-24 19:46:44 +0100 | |
---|---|---|
committer | 2024-02-24 19:46:44 +0100 | |
commit | 7d3735f0fa88372157e7f1041be3e2513067c80b (patch) | |
tree | 6fd3f8a53ffa4fdd623cf860b2fb744a425b1194 /examples/scrollable | |
parent | ca9694f2f40a5b2121a4adc4ae6c56aa12882ab4 (diff) | |
download | iced-7d3735f0fa88372157e7f1041be3e2513067c80b.tar.gz iced-7d3735f0fa88372157e7f1041be3e2513067c80b.tar.bz2 iced-7d3735f0fa88372157e7f1041be3e2513067c80b.zip |
Assert `scrollable` content size never fills scrolling axis
Diffstat (limited to 'examples/scrollable')
-rw-r--r-- | examples/scrollable/src/main.rs | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/examples/scrollable/src/main.rs b/examples/scrollable/src/main.rs index ac18fd38..bae23775 100644 --- a/examples/scrollable/src/main.rs +++ b/examples/scrollable/src/main.rs @@ -2,7 +2,7 @@ use iced::executor; use iced::widget::scrollable::Properties; use iced::widget::{ button, column, container, horizontal_space, progress_bar, radio, row, - scrollable, slider, text, vertical_space, + scrollable, slider, text, vertical_space, Scrollable, }; use iced::{ Alignment, Application, Color, Command, Element, Length, Settings, Theme, @@ -212,7 +212,7 @@ impl Application for ScrollableDemo { let scrollable_content: Element<Message> = Element::from(match self.scrollable_direction { - Direction::Vertical => scrollable( + Direction::Vertical => Scrollable::with_direction( column![ scroll_to_end_button(), text("Beginning!"), @@ -225,19 +225,19 @@ impl Application for ScrollableDemo { .align_items(Alignment::Center) .padding([40, 0, 40, 0]) .spacing(40), + scrollable::Direction::Vertical( + Properties::new() + .width(self.scrollbar_width) + .margin(self.scrollbar_margin) + .scroller_width(self.scroller_width) + .alignment(self.alignment), + ), ) .width(Length::Fill) .height(Length::Fill) - .direction(scrollable::Direction::Vertical( - Properties::new() - .width(self.scrollbar_width) - .margin(self.scrollbar_margin) - .scroller_width(self.scroller_width) - .alignment(self.alignment), - )) .id(SCROLLABLE_ID.clone()) .on_scroll(Message::Scrolled), - Direction::Horizontal => scrollable( + Direction::Horizontal => Scrollable::with_direction( row![ scroll_to_end_button(), text("Beginning!"), @@ -251,19 +251,19 @@ impl Application for ScrollableDemo { .align_items(Alignment::Center) .padding([0, 40, 0, 40]) .spacing(40), + scrollable::Direction::Horizontal( + Properties::new() + .width(self.scrollbar_width) + .margin(self.scrollbar_margin) + .scroller_width(self.scroller_width) + .alignment(self.alignment), + ), ) .width(Length::Fill) .height(Length::Fill) - .direction(scrollable::Direction::Horizontal( - Properties::new() - .width(self.scrollbar_width) - .margin(self.scrollbar_margin) - .scroller_width(self.scroller_width) - .alignment(self.alignment), - )) .id(SCROLLABLE_ID.clone()) .on_scroll(Message::Scrolled), - Direction::Multi => scrollable( + Direction::Multi => Scrollable::with_direction( //horizontal content row![ column![ @@ -293,21 +293,21 @@ impl Application for ScrollableDemo { .align_items(Alignment::Center) .padding([0, 40, 0, 40]) .spacing(40), + { + let properties = Properties::new() + .width(self.scrollbar_width) + .margin(self.scrollbar_margin) + .scroller_width(self.scroller_width) + .alignment(self.alignment); + + scrollable::Direction::Both { + horizontal: properties, + vertical: properties, + } + }, ) .width(Length::Fill) .height(Length::Fill) - .direction({ - let properties = Properties::new() - .width(self.scrollbar_width) - .margin(self.scrollbar_margin) - .scroller_width(self.scroller_width) - .alignment(self.alignment); - - scrollable::Direction::Both { - horizontal: properties, - vertical: properties, - } - }) .id(SCROLLABLE_ID.clone()) .on_scroll(Message::Scrolled), }); |