refactor: use theme corner radii everywhere
not all values matched a default value but I picked the next closest in that case
This commit is contained in:
parent
56965ac2e5
commit
310064ca1d
14 changed files with 103 additions and 68 deletions
|
|
@ -4,6 +4,8 @@
|
|||
//! Change the apperance of a button.
|
||||
use iced_core::{Background, BorderRadius, Color, Vector};
|
||||
|
||||
use crate::theme::THEME;
|
||||
|
||||
/// The appearance of a button.
|
||||
#[must_use]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
|
|
@ -39,10 +41,11 @@ pub struct Appearance {
|
|||
impl Appearance {
|
||||
// TODO: `BorderRadius` is not `const fn` compatible.
|
||||
pub fn new() -> Self {
|
||||
let rad_0 = THEME.with(|t| t.borrow().cosmic().corner_radii.radius_0);
|
||||
Self {
|
||||
shadow_offset: Vector::new(0.0, 0.0),
|
||||
background: None,
|
||||
border_radius: BorderRadius::from(0.0),
|
||||
border_radius: BorderRadius::from(rad_0),
|
||||
border_width: 0.0,
|
||||
border_color: Color::TRANSPARENT,
|
||||
outline_width: 0.0,
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ use iced_core::{
|
|||
};
|
||||
use iced_renderer::core::widget::{operation, OperationOutputWrapper};
|
||||
|
||||
use crate::theme::THEME;
|
||||
|
||||
pub use super::style::{Appearance, StyleSheet};
|
||||
|
||||
/// Internally defines different button widget variants.
|
||||
|
|
@ -387,6 +389,8 @@ where
|
|||
{
|
||||
let selection_background = theme.selection_background();
|
||||
|
||||
let c_rad = THEME.with(|t| t.borrow().cosmic().corner_radii);
|
||||
|
||||
if self.selected {
|
||||
renderer.fill_quad(
|
||||
Quad {
|
||||
|
|
@ -396,7 +400,13 @@ where
|
|||
x: bounds.x + styling.border_width,
|
||||
y: bounds.y + (bounds.height - 20.0 - styling.border_width),
|
||||
},
|
||||
border_radius: [0.0, 8.0, 0.0, 8.0].into(),
|
||||
border_radius: [
|
||||
c_rad.radius_0[0],
|
||||
c_rad.radius_s[1],
|
||||
c_rad.radius_0[2],
|
||||
c_rad.radius_s[3],
|
||||
]
|
||||
.into(),
|
||||
border_width: 0.0,
|
||||
border_color: Color::TRANSPARENT,
|
||||
},
|
||||
|
|
@ -423,7 +433,7 @@ where
|
|||
renderer.fill_quad(
|
||||
renderer::Quad {
|
||||
bounds,
|
||||
border_radius: 20.0.into(),
|
||||
border_radius: c_rad.radius_m.into(),
|
||||
border_width: 0.0,
|
||||
border_color: Color::TRANSPARENT,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue