Add default padding to Button
This commit is contained in:
parent
8957883a88
commit
1797e15b8c
@ -138,6 +138,8 @@ impl text_input::Renderer for Null {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl button::Renderer for Null {
|
impl button::Renderer for Null {
|
||||||
|
const DEFAULT_PADDING: u16 = 0;
|
||||||
|
|
||||||
type Style = ();
|
type Style = ();
|
||||||
|
|
||||||
fn draw<Message>(
|
fn draw<Message>(
|
||||||
|
@ -61,7 +61,7 @@ where
|
|||||||
height: Length::Shrink,
|
height: Length::Shrink,
|
||||||
min_width: 0,
|
min_width: 0,
|
||||||
min_height: 0,
|
min_height: 0,
|
||||||
padding: 0,
|
padding: Renderer::DEFAULT_PADDING,
|
||||||
style: Renderer::Style::default(),
|
style: Renderer::Style::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -249,6 +249,11 @@ where
|
|||||||
/// [`Button`]: struct.Button.html
|
/// [`Button`]: struct.Button.html
|
||||||
/// [renderer]: ../../renderer/index.html
|
/// [renderer]: ../../renderer/index.html
|
||||||
pub trait Renderer: crate::Renderer + Sized {
|
pub trait Renderer: crate::Renderer + Sized {
|
||||||
|
/// The default padding of a [`Button`].
|
||||||
|
///
|
||||||
|
/// [`Button`]: struct.Button.html
|
||||||
|
const DEFAULT_PADDING: u16;
|
||||||
|
|
||||||
/// The style supported by this renderer.
|
/// The style supported by this renderer.
|
||||||
type Style: Default;
|
type Style: Default;
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@ use iced_native::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
impl iced_native::button::Renderer for Renderer {
|
impl iced_native::button::Renderer for Renderer {
|
||||||
|
const DEFAULT_PADDING: u16 = 5;
|
||||||
|
|
||||||
type Style = Box<dyn StyleSheet>;
|
type Style = Box<dyn StyleSheet>;
|
||||||
|
|
||||||
fn draw<Message>(
|
fn draw<Message>(
|
||||||
|
Loading…
Reference in New Issue
Block a user