improv(radio): reduce radio button size

This commit is contained in:
Vukašin Vojinović 2024-08-30 13:42:24 +02:00 committed by GitHub
parent 04c05ae6a1
commit 0a1922d4b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -104,10 +104,10 @@ where
Renderer: iced_core::Renderer,
{
/// The default size of a [`Radio`] button.
pub const DEFAULT_SIZE: f32 = 28.0;
pub const DEFAULT_SIZE: f32 = 16.0;
/// The default spacing of a [`Radio`] button.
pub const DEFAULT_SPACING: f32 = 15.0;
pub const DEFAULT_SPACING: f32 = 8.0;
/// Creates a new [`Radio`] button.
///
@ -129,7 +129,7 @@ where
label: label.into(),
width: Length::Shrink,
size: Self::DEFAULT_SIZE,
spacing: Self::DEFAULT_SPACING, //15
spacing: Self::DEFAULT_SPACING,
style: Default::default(),
}
}
@ -312,7 +312,7 @@ where
let bounds = layout.bounds();
let size = bounds.width;
let dot_size = size / 2.0;
let dot_size = 6.0;
renderer.fill_quad(
renderer::Quad {
@ -331,10 +331,10 @@ where
renderer.fill_quad(
renderer::Quad {
bounds: Rectangle {
x: bounds.x + dot_size / 2.0,
y: bounds.y + dot_size / 2.0,
width: bounds.width - dot_size,
height: bounds.height - dot_size,
x: bounds.x + (size - dot_size) / 2.0,
y: bounds.y + (size - dot_size) / 2.0,
width: dot_size,
height: dot_size,
},
border: Border::with_radius(dot_size / 2.0),
..renderer::Quad::default()