Make PickList padding consistent with Button

This commit is contained in:
Héctor Ramón Jiménez 2024-03-08 00:36:37 +01:00
parent c99e599647
commit 1db823b4c5
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 10 additions and 13 deletions

View file

@ -63,14 +63,6 @@ impl<'a, Message, Theme, Renderer> Button<'a, Message, Theme, Renderer>
where where
Renderer: crate::core::Renderer, 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. /// Creates a new [`Button`] with the given content.
pub fn new( pub fn new(
content: impl Into<Element<'a, Message, Theme, Renderer>>, content: impl Into<Element<'a, Message, Theme, Renderer>>,
@ -86,7 +78,7 @@ where
on_press: None, on_press: None,
width: size.width.fluid(), width: size.width.fluid(),
height: size.height.fluid(), height: size.height.fluid(),
padding: Self::DEFAULT_PADDING, padding: DEFAULT_PADDING,
clip: false, clip: false,
style: Theme::default_style(), 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`]. /// The possible status of a [`Button`].
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Status { pub enum Status {

View file

@ -58,9 +58,6 @@ where
Message: Clone, Message: Clone,
Renderer: text::Renderer, 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 /// Creates a new [`PickList`] with the given list of options, the current
/// selected value, and the message to produce when an option is selected. /// selected value, and the message to produce when an option is selected.
pub fn new( pub fn new(
@ -79,7 +76,7 @@ where
placeholder: None, placeholder: None,
selected, selected,
width: Length::Shrink, width: Length::Shrink,
padding: Self::DEFAULT_PADDING, padding: crate::button::DEFAULT_PADDING,
text_size: None, text_size: None,
text_line_height: text::LineHeight::default(), text_line_height: text::LineHeight::default(),
text_shaping: text::Shaping::Basic, text_shaping: text::Shaping::Basic,