From 1db823b4c528441627dd075d989fca2fa0a44346 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 8 Mar 2024 00:36:37 +0100 Subject: Make `PickList` padding consistent with `Button` --- widget/src/button.rs | 18 +++++++++--------- widget/src/pick_list.rs | 5 +---- 2 files changed, 10 insertions(+), 13 deletions(-) (limited to 'widget') diff --git a/widget/src/button.rs b/widget/src/button.rs index a23a7156..243eaf04 100644 --- a/widget/src/button.rs +++ b/widget/src/button.rs @@ -63,14 +63,6 @@ impl<'a, Message, Theme, Renderer> Button<'a, Message, Theme, Renderer> where Renderer: crate::core::Renderer, { - /// The default [`Padding`] of a [`Button`]. - pub const DEFAULT_PADDING: Padding = Padding { - top: 5.0, - bottom: 5.0, - right: 10.0, - left: 10.0, - }; - /// Creates a new [`Button`] with the given content. pub fn new( content: impl Into>, @@ -86,7 +78,7 @@ where on_press: None, width: size.width.fluid(), height: size.height.fluid(), - padding: Self::DEFAULT_PADDING, + padding: DEFAULT_PADDING, clip: false, style: Theme::default_style(), } @@ -391,6 +383,14 @@ where } } +/// The default [`Padding`] of a [`Button`]. +pub(crate) const DEFAULT_PADDING: Padding = Padding { + top: 5.0, + bottom: 5.0, + right: 10.0, + left: 10.0, +}; + /// The possible status of a [`Button`]. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Status { diff --git a/widget/src/pick_list.rs b/widget/src/pick_list.rs index cfeabbb7..d98909fa 100644 --- a/widget/src/pick_list.rs +++ b/widget/src/pick_list.rs @@ -58,9 +58,6 @@ where Message: Clone, Renderer: text::Renderer, { - /// The default padding of a [`PickList`]. - pub const DEFAULT_PADDING: Padding = Padding::new(5.0); - /// Creates a new [`PickList`] with the given list of options, the current /// selected value, and the message to produce when an option is selected. pub fn new( @@ -79,7 +76,7 @@ where placeholder: None, selected, width: Length::Shrink, - padding: Self::DEFAULT_PADDING, + padding: crate::button::DEFAULT_PADDING, text_size: None, text_line_height: text::LineHeight::default(), text_shaping: text::Shaping::Basic, -- cgit