From 9ba955842913c9e1060bdb98deef9d645917b5cb Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 15 Feb 2021 23:59:31 +0100 Subject: Allow dead code explicitly in `iced_web` --- web/src/widget/scrollable.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'web/src/widget/scrollable.rs') diff --git a/web/src/widget/scrollable.rs b/web/src/widget/scrollable.rs index f9135dd6..bd9260ff 100644 --- a/web/src/widget/scrollable.rs +++ b/web/src/widget/scrollable.rs @@ -11,6 +11,7 @@ pub struct Scrollable<'a, Message> { height: Length, max_height: u32, content: Column<'a, Message>, + #[allow(dead_code)] style: Box, } -- cgit From fe0a27c56d9d75fb521e69352259f1d737402a20 Mon Sep 17 00:00:00 2001 From: Ben LeFevre Date: Mon, 23 Nov 2020 17:19:21 +0000 Subject: Add support for asymmetrical padding --- web/src/widget/scrollable.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'web/src/widget/scrollable.rs') 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>(mut self, padding: P) -> Self { + self.content = self.content.padding(padding); self } -- cgit From 8a3b71df8b619571ce0a972826cb5a3987b66b3d Mon Sep 17 00:00:00 2001 From: Héctor Ramón Date: Tue, 1 Jun 2021 19:45:47 +0700 Subject: Replace ignored doc-tests with additional documentation for `Padding` --- web/src/widget/scrollable.rs | 5 ----- 1 file changed, 5 deletions(-) (limited to 'web/src/widget/scrollable.rs') diff --git a/web/src/widget/scrollable.rs b/web/src/widget/scrollable.rs index 10f633de..ce0a10d4 100644 --- a/web/src/widget/scrollable.rs +++ b/web/src/widget/scrollable.rs @@ -42,11 +42,6 @@ impl<'a, Message> Scrollable<'a, Message> { } /// 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>(mut self, padding: P) -> Self { self.content = self.content.padding(padding); self -- cgit