summaryrefslogtreecommitdiffstats
path: root/web/src/widget/scrollable.rs
diff options
context:
space:
mode:
authorLibravatar Ben LeFevre <ben@lefev.dev>2020-11-23 17:19:21 +0000
committerLibravatar Héctor Ramón <hector@lich.io>2021-06-01 19:05:39 +0700
commitfe0a27c56d9d75fb521e69352259f1d737402a20 (patch)
treef7f77430b63983717036a81e734276123d139ca6 /web/src/widget/scrollable.rs
parenta9eb591628017caaf7aa9af505d1206f7a143a9a (diff)
downloadiced-fe0a27c56d9d75fb521e69352259f1d737402a20.tar.gz
iced-fe0a27c56d9d75fb521e69352259f1d737402a20.tar.bz2
iced-fe0a27c56d9d75fb521e69352259f1d737402a20.zip
Add support for asymmetrical padding
Diffstat (limited to 'web/src/widget/scrollable.rs')
-rw-r--r--web/src/widget/scrollable.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/web/src/widget/scrollable.rs b/web/src/widget/scrollable.rs
index bd9260ff..10f633de 100644
--- a/web/src/widget/scrollable.rs
+++ b/web/src/widget/scrollable.rs
@@ -1,5 +1,7 @@
//! Navigate an endless amount of content with a scrollbar.
-use crate::{bumpalo, css, Align, Bus, Column, Css, Element, Length, Widget};
+use crate::{
+ bumpalo, css, Align, Bus, Column, Css, Element, Length, Padding, Widget,
+};
pub use iced_style::scrollable::{Scrollbar, Scroller, StyleSheet};
@@ -39,9 +41,14 @@ impl<'a, Message> Scrollable<'a, Message> {
self
}
- /// Sets the padding of the [`Scrollable`].
- pub fn padding(mut self, units: u16) -> Self {
- self.content = self.content.padding(units);
+ /// Sets the [`Padding`] of the [`Scrollable`].
+ ///```ignore
+ /// Scrollable::new(/*...*/).padding(20); // 20px on all sides
+ /// Scrollable::new(/*...*/).padding([10, 20]); // top/bottom, left/right
+ /// Scrollable::new(/*...*/).padding([5, 10, 15, 20]); // top, right, bottom, left
+ /// ```
+ pub fn padding<P: Into<Padding>>(mut self, padding: P) -> Self {
+ self.content = self.content.padding(padding);
self
}