Make vertical scroll properties optional

Co-Authored-By: Austin M. Reppert <austinmreppert@gmail.com>
This commit is contained in:
Austin M. Reppert 2023-05-26 20:27:17 -04:00 committed by Héctor Ramón Jiménez
parent f63a9d1a79
commit fa04f40524
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
2 changed files with 99 additions and 49 deletions

View file

@ -1,4 +1,6 @@
use iced::widget::scrollable::{Properties, Scrollbar, Scroller};
use iced::widget::scrollable::{
Properties, ScrollbarProperties, Scrollbar, Scroller,
};
use iced::widget::{
button, column, container, horizontal_space, progress_bar, radio, row,
scrollable, slider, text, vertical_space,
@ -199,12 +201,12 @@ impl Application for ScrollableDemo {
.spacing(40),
)
.height(Length::Fill)
.vertical_scroll(
.scrollbar_properties(ScrollbarProperties::Vertical(
Properties::new()
.width(self.scrollbar_width)
.margin(self.scrollbar_margin)
.scroller_width(self.scroller_width),
)
))
.id(SCROLLABLE_ID.clone())
.on_scroll(Message::Scrolled),
Direction::Horizontal => scrollable(
@ -223,12 +225,12 @@ impl Application for ScrollableDemo {
.spacing(40),
)
.height(Length::Fill)
.horizontal_scroll(
.scrollbar_properties(ScrollbarProperties::Horizontal(
Properties::new()
.width(self.scrollbar_width)
.margin(self.scrollbar_margin)
.scroller_width(self.scroller_width),
)
))
.style(theme::Scrollable::custom(ScrollbarCustomStyle))
.id(SCROLLABLE_ID.clone())
.on_scroll(Message::Scrolled),
@ -264,18 +266,16 @@ impl Application for ScrollableDemo {
.spacing(40),
)
.height(Length::Fill)
.vertical_scroll(
.scrollbar_properties(ScrollbarProperties::Both(
Properties::new()
.width(self.scrollbar_width)
.margin(self.scrollbar_margin)
.scroller_width(self.scroller_width),
)
.horizontal_scroll(
Properties::new()
.width(self.scrollbar_width)
.margin(self.scrollbar_margin)
.scroller_width(self.scroller_width),
)
))
.style(theme::Scrollable::Custom(Box::new(
ScrollbarCustomStyle,
)))