Skip to content

Commit

Permalink
Merge pull request #1878 from AustinMReppert/master
Browse files Browse the repository at this point in the history
Minor Scrollable Improvements
  • Loading branch information
hecrj authored Jun 27, 2023
2 parents 2d2ed40 + 1c26440 commit 9d83718
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 76 deletions.
28 changes: 14 additions & 14 deletions examples/scrollable/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use iced::widget::{
};
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);
Expand Down Expand Up @@ -199,12 +200,12 @@ impl Application for ScrollableDemo {
.spacing(40),
)
.height(Length::Fill)
.vertical_scroll(
.direction(scrollable::Direction::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(
Expand All @@ -223,12 +224,12 @@ impl Application for ScrollableDemo {
.spacing(40),
)
.height(Length::Fill)
.horizontal_scroll(
.direction(scrollable::Direction::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),
Expand Down Expand Up @@ -264,18 +265,17 @@ impl Application for ScrollableDemo {
.spacing(40),
)
.height(Length::Fill)
.vertical_scroll(
Properties::new()
.width(self.scrollbar_width)
.margin(self.scrollbar_margin)
.scroller_width(self.scroller_width),
)
.horizontal_scroll(
Properties::new()
.direction({
let properties = 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,
)))
Expand Down
Loading

0 comments on commit 9d83718

Please sign in to comment.