feat: Border radius support for buttons

This commit is contained in:
Michael Aaron Murphy 2022-12-23 16:09:17 +01:00
parent a39a2518d0
commit d732f64fb8
No known key found for this signature in database
GPG key ID: B2732D4240C9212C
3 changed files with 6 additions and 4 deletions

View file

@ -10,6 +10,7 @@ use std::hash::Hasher;
pub use self::palette::Palette;
use cosmic_theme::Component;
use iced_core::BorderRadius;
use iced_style::application;
use iced_style::button;
use iced_style::checkbox;
@ -175,8 +176,8 @@ impl button::StyleSheet for Theme {
button::Appearance {
border_radius: match style {
Button::Link => 0.0,
_ => 24.0,
Button::Link => BorderRadius::from(0.0),
_ => BorderRadius::from(24.0),
},
background: match style {
Button::Link | Button::Text => None,

View file

@ -6,6 +6,7 @@ use crate::widget::{icon, scrollable};
use crate::{theme, Renderer, Theme};
use derive_setters::Setters;
use iced::{Background, Length};
use iced_core::BorderRadius;
use iced_lazy::Component;
use iced_native::widget::{button, column, container, text};
use iced_native::{row, Alignment, Element};
@ -230,7 +231,7 @@ pub fn section_button_style(theme: &Theme) -> Appearance {
Appearance {
shadow_offset: iced::Vector::default(),
background: Some(Background::Color(primary.base.into())),
border_radius: 5.0,
border_radius: BorderRadius::from(5.0),
border_width: 0.0,
border_color: iced::Color::default(),
text_color: iced::Color::default(),