Add support for asymmetrical padding

This commit is contained in:
Ben LeFevre 2020-11-23 17:19:21 +00:00 committed by Héctor Ramón
parent a9eb591628
commit fe0a27c56d
27 changed files with 339 additions and 195 deletions

View file

@ -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
}