Rename ScrollbarProperties to Direction in scrollable

This commit is contained in:
Héctor Ramón Jiménez 2023-06-27 22:30:54 +02:00
parent fa04f40524
commit 493571695a
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
2 changed files with 61 additions and 70 deletions

View file

@ -1,12 +1,11 @@
use iced::widget::scrollable::{
Properties, ScrollbarProperties, Scrollbar, Scroller,
};
use iced::widget::scrollable::{Properties, Scrollbar, Scroller};
use iced::widget::{
button, column, container, horizontal_space, progress_bar, radio, row,
scrollable, slider, text, vertical_space,
};
use iced::{executor, theme, Alignment, Color};
use iced::{Application, Command, Element, Length, Settings, Theme};
use once_cell::sync::Lazy;
static SCROLLABLE_ID: Lazy<scrollable::Id> = Lazy::new(scrollable::Id::unique);
@ -201,7 +200,7 @@ impl Application for ScrollableDemo {
.spacing(40),
)
.height(Length::Fill)
.scrollbar_properties(ScrollbarProperties::Vertical(
.direction(scrollable::Direction::Vertical(
Properties::new()
.width(self.scrollbar_width)
.margin(self.scrollbar_margin)
@ -225,7 +224,7 @@ impl Application for ScrollableDemo {
.spacing(40),
)
.height(Length::Fill)
.scrollbar_properties(ScrollbarProperties::Horizontal(
.direction(scrollable::Direction::Horizontal(
Properties::new()
.width(self.scrollbar_width)
.margin(self.scrollbar_margin)
@ -266,16 +265,17 @@ impl Application for ScrollableDemo {
.spacing(40),
)
.height(Length::Fill)
.scrollbar_properties(ScrollbarProperties::Both(
Properties::new()
.direction({
let properties = Properties::new()
.width(self.scrollbar_width)
.margin(self.scrollbar_margin)
.scroller_width(self.scroller_width),
Properties::new()
.width(self.scrollbar_width)
.margin(self.scrollbar_margin)
.scroller_width(self.scroller_width),
))
.scroller_width(self.scroller_width);
scrollable::Direction::Both {
horizontal: properties,
vertical: properties,
}
})
.style(theme::Scrollable::Custom(Box::new(
ScrollbarCustomStyle,
)))