diff --git a/gui/ui/Cargo.toml b/gui/ui/Cargo.toml index 53c8c48e4..d039a8338 100644 --- a/gui/ui/Cargo.toml +++ b/gui/ui/Cargo.toml @@ -6,8 +6,6 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -iced = { version = "0.9", default_features = false, features = ["svg", "image", "glow"] } -iced_native = "0.10" -iced_lazy = { version = "0.6"} +iced = { version = "0.10", default_features = false, features = ["svg", "image", "lazy", "advanced"] } bitcoin = "0.30" chrono = "0.4" diff --git a/gui/ui/examples/design-system/Cargo.toml b/gui/ui/examples/design-system/Cargo.toml index 8f6232da7..0c645a43f 100644 --- a/gui/ui/examples/design-system/Cargo.toml +++ b/gui/ui/examples/design-system/Cargo.toml @@ -6,8 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -iced = "0.9" -iced_native = "0.10" +iced = "0.10" web-sys = "0.3.61" chrono = "0.4" liana_ui = { path = "../.." } diff --git a/gui/ui/examples/design-system/src/main.rs b/gui/ui/examples/design-system/src/main.rs index 696bfdb32..87f0d23c4 100644 --- a/gui/ui/examples/design-system/src/main.rs +++ b/gui/ui/examples/design-system/src/main.rs @@ -2,11 +2,12 @@ mod section; use iced::widget::{button, column, container, row, scrollable, text, Space}; use iced::{executor, Application, Command, Length, Settings, Subscription}; -use liana_ui::{component::text::*, image, theme, widget::*}; +use liana_ui::{component::text::*, font, image, theme, widget::*}; pub fn main() -> iced::Result { let mut settings = Settings::with_flags(Config {}); settings.default_text_size = P1_SIZE.into(); + settings.default_font = font::REGULAR; DesignSystem::run(settings) } @@ -21,11 +22,18 @@ struct DesignSystem { #[derive(Debug, Clone)] pub enum Message { - Event(iced_native::Event), + FontLoaded(Result<(), iced::font::Error>), + Event(iced::Event), Section(usize), Ignore, } +impl From> for Message { + fn from(res: Result<(), iced::font::Error>) -> Message { + Message::FontLoaded(res) + } +} + impl Application for DesignSystem { type Message = Message; type Theme = theme::Theme; @@ -49,6 +57,9 @@ impl Application for DesignSystem { ], current: 0, }; + #[allow(unused_mut)] + let mut cmds: Vec> = font::loads(); + #[cfg(target_arch = "wasm32")] { use iced_native::{command, window}; @@ -57,16 +68,12 @@ impl Application for DesignSystem { (window.inner_width().unwrap().as_f64().unwrap()) as u32, (window.inner_height().unwrap().as_f64().unwrap()) as u32, ); - ( - app, - Command::single(command::Action::Window(window::Action::Resize { - width, - height, - })), - ) + cmds.push(Command::single(command::Action::Window( + window::Action::Resize { width, height }, + ))); } - #[cfg(not(target_arch = "wasm32"))] - (app, Command::none()) + + (app, Command::batch(cmds)) } fn update(&mut self, message: Message) -> Command { @@ -76,10 +83,7 @@ impl Application for DesignSystem { self.current = i; } } - Message::Event(iced::Event::Window(iced_native::window::Event::Resized { - width, - height, - })) => { + Message::Event(iced::Event::Window(iced::window::Event::Resized { width, height })) => { #[cfg(target_arch = "wasm32")] { use iced_native::{command, window}; @@ -95,7 +99,7 @@ impl Application for DesignSystem { } fn subscription(&self) -> Subscription { - iced_native::subscription::events().map(Self::Message::Event) + iced::subscription::events().map(Self::Message::Event) } fn view(&self) -> Element { diff --git a/gui/ui/src/component/collapse.rs b/gui/ui/src/component/collapse.rs index 154ebcaaf..0c04aeee4 100644 --- a/gui/ui/src/component/collapse.rs +++ b/gui/ui/src/component/collapse.rs @@ -1,6 +1,5 @@ use crate::widget::*; -use iced::widget::column; -use iced_lazy::{self, Component}; +use iced::widget::{column, component, Component}; use std::marker::PhantomData; pub struct Collapse<'a, M, H, F, C> { @@ -78,6 +77,6 @@ where C: Fn() -> Element<'a, T>, { fn from(c: Collapse<'a, Message, H, F, C>) -> Self { - iced_lazy::component(c) + component(c) } } diff --git a/gui/ui/src/component/modal.rs b/gui/ui/src/component/modal.rs index 261bf8193..56592b048 100644 --- a/gui/ui/src/component/modal.rs +++ b/gui/ui/src/component/modal.rs @@ -1,10 +1,13 @@ /// modal widget from https://github.com/iced-rs/iced/blob/master/examples/modal/ -use iced_native::alignment::Alignment; -use iced_native::widget::{self, Tree}; -use iced_native::{ - event, layout, mouse, overlay, renderer, Clipboard, Color, Element, Event, Layout, Length, - Point, Rectangle, Shell, Size, Widget, -}; +use iced::advanced::layout::{self, Layout}; +use iced::advanced::overlay; +use iced::advanced::renderer; +use iced::advanced::widget::{self, Tree, Widget}; +use iced::advanced::{self, Clipboard, Shell}; +use iced::alignment::Alignment; +use iced::event; +use iced::mouse; +use iced::{Color, Element, Event, Length, Point, Rectangle, Size}; /// A widget that centers a modal element over some base element pub struct Modal<'a, Message, Renderer> { @@ -35,7 +38,7 @@ impl<'a, Message, Renderer> Modal<'a, Message, Renderer> { impl<'a, Message, Renderer> Widget for Modal<'a, Message, Renderer> where - Renderer: iced_native::Renderer, + Renderer: advanced::Renderer, Message: Clone, { fn children(&self) -> Vec { @@ -60,33 +63,35 @@ where fn on_event( &mut self, - state: &mut Tree, + state: &mut widget::Tree, event: Event, layout: Layout<'_>, - cursor_position: Point, + cursor: mouse::Cursor, renderer: &Renderer, clipboard: &mut dyn Clipboard, shell: &mut Shell<'_, Message>, + viewport: &Rectangle, ) -> event::Status { self.base.as_widget_mut().on_event( &mut state.children[0], event, layout, - cursor_position, + cursor, renderer, clipboard, shell, + viewport, ) } fn draw( &self, - state: &Tree, + state: &widget::Tree, renderer: &mut Renderer, - theme: &::Theme, + theme: &::Theme, style: &renderer::Style, layout: Layout<'_>, - cursor_position: Point, + cursor: mouse::Cursor, viewport: &Rectangle, ) { self.base.as_widget().draw( @@ -95,7 +100,7 @@ where theme, style, layout, - cursor_position, + cursor, viewport, ); } @@ -119,16 +124,16 @@ where fn mouse_interaction( &self, - state: &Tree, + state: &widget::Tree, layout: Layout<'_>, - cursor_position: Point, + cursor: mouse::Cursor, viewport: &Rectangle, renderer: &Renderer, ) -> mouse::Interaction { self.base.as_widget().mouse_interaction( &state.children[0], layout, - cursor_position, + cursor, viewport, renderer, ) @@ -157,7 +162,7 @@ struct Overlay<'a, 'b, Message, Renderer> { impl<'a, 'b, Message, Renderer> overlay::Overlay for Overlay<'a, 'b, Message, Renderer> where - Renderer: iced_native::Renderer, + Renderer: advanced::Renderer, Message: Clone, { fn layout(&self, renderer: &Renderer, _bounds: Size, position: Point) -> layout::Node { @@ -178,7 +183,7 @@ where &mut self, event: Event, layout: Layout<'_>, - cursor_position: Point, + cursor: mouse::Cursor, renderer: &Renderer, clipboard: &mut dyn Clipboard, shell: &mut Shell<'_, Message>, @@ -187,7 +192,7 @@ where if let Some(message) = self.on_blur.as_ref() { if let Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) = &event { - if !content_bounds.contains(cursor_position) { + if !cursor.is_over(content_bounds) { shell.publish(message.clone()); return event::Status::Captured; } @@ -198,10 +203,11 @@ where self.tree, event, layout.children().next().unwrap(), - cursor_position, + cursor, renderer, clipboard, shell, + &layout.bounds(), ) } @@ -211,12 +217,12 @@ where theme: &Renderer::Theme, style: &renderer::Style, layout: Layout<'_>, - cursor_position: Point, + cursor: mouse::Cursor, ) { renderer.fill_quad( renderer::Quad { bounds: layout.bounds(), - border_radius: renderer::BorderRadius::from(0.0), + border_radius: Default::default(), border_width: 0.0, border_color: Color::TRANSPARENT, }, @@ -232,7 +238,7 @@ where theme, style, layout.children().next().unwrap(), - cursor_position, + cursor, &layout.bounds(), ); } @@ -254,23 +260,33 @@ where fn mouse_interaction( &self, layout: Layout<'_>, - cursor_position: Point, + cursor: mouse::Cursor, viewport: &Rectangle, renderer: &Renderer, ) -> mouse::Interaction { self.content.as_widget().mouse_interaction( self.tree, layout.children().next().unwrap(), - cursor_position, + cursor, viewport, renderer, ) } + + fn overlay<'c>( + &'c mut self, + layout: Layout<'_>, + renderer: &Renderer, + ) -> Option> { + self.content + .as_widget_mut() + .overlay(self.tree, layout.children().next().unwrap(), renderer) + } } impl<'a, Message, Renderer> From> for Element<'a, Message, Renderer> where - Renderer: 'a + iced_native::Renderer, + Renderer: 'a + advanced::Renderer, Message: 'a + Clone, { fn from(modal: Modal<'a, Message, Renderer>) -> Self { diff --git a/gui/ui/src/font.rs b/gui/ui/src/font.rs index 2b5ea5dfd..f055ebcef 100644 --- a/gui/ui/src/font.rs +++ b/gui/ui/src/font.rs @@ -1,18 +1,37 @@ -use iced::Font; +use iced::{ + font::{Family, Stretch, Weight}, + Command, Font, +}; -pub const BOLD: Font = Font::External { - name: "Bold", - bytes: include_bytes!("../static/fonts/IBMPlexSans-Bold.ttf"), +pub const BOLD: Font = Font { + family: Family::Name("IBM Plex Sans"), + weight: Weight::Bold, + monospaced: false, + stretch: Stretch::Normal, }; -pub const MEDIUM: Font = Font::External { - name: "Regular", - bytes: include_bytes!("../static/fonts/IBMPlexSans-Medium.ttf"), +pub const MEDIUM: Font = Font { + family: Family::Name("IBM Plex Sans"), + weight: Weight::Medium, + monospaced: false, + stretch: Stretch::Normal, }; +pub const REGULAR: Font = Font::with_name("IBM Plex Sans"); + +pub const BOLD_BYTES: &[u8] = include_bytes!("../static/fonts/IBMPlexSans-Bold.ttf"); +pub const MEDIUM_BYTES: &[u8] = include_bytes!("../static/fonts/IBMPlexSans-Medium.ttf"); pub const REGULAR_BYTES: &[u8] = include_bytes!("../static/fonts/IBMPlexSans-Regular.ttf"); -pub const REGULAR: Font = Font::External { - name: "Regular", - bytes: REGULAR_BYTES, -}; +pub const ICONEX_ICONS_BYTES: &[u8] = include_bytes!("../static/icons/iconex/iconex-icons.ttf"); +pub const BOOTSTRAP_ICONS_BYTE: &[u8] = include_bytes!("../static/icons/bootstrap-icons.ttf"); + +pub fn loads> + 'static>() -> Vec> { + vec![ + iced::font::load(BOLD_BYTES).map(T::from), + iced::font::load(MEDIUM_BYTES).map(T::from), + iced::font::load(REGULAR_BYTES).map(T::from), + iced::font::load(ICONEX_ICONS_BYTES).map(T::from), + iced::font::load(BOOTSTRAP_ICONS_BYTE).map(T::from), + ] +} diff --git a/gui/ui/src/icon.rs b/gui/ui/src/icon.rs index 3af767124..3c86764b2 100644 --- a/gui/ui/src/icon.rs +++ b/gui/ui/src/icon.rs @@ -1,10 +1,7 @@ use crate::widget::*; use iced::{alignment, Font, Length}; -const BOOTSTRAP_ICONS: Font = Font::External { - name: "Bootstrap icons", - bytes: include_bytes!("../static/icons/bootstrap-icons.ttf"), -}; +const BOOTSTRAP_ICONS: Font = Font::with_name("bootstrap-icons"); fn bootstrap_icon(unicode: char) -> Text<'static> { Text::new(unicode.to_string()) @@ -118,10 +115,7 @@ pub fn previous_icon() -> Text<'static> { bootstrap_icon('\u{F284}') } -const ICONEX_ICONS: Font = Font::External { - name: "Iconex icons", - bytes: include_bytes!("../static/icons/iconex/iconex-icons.ttf"), -}; +const ICONEX_ICONS: Font = Font::with_name("Untitled1"); fn iconex_icon(unicode: char) -> Text<'static> { Text::new(unicode.to_string()) diff --git a/gui/ui/src/theme.rs b/gui/ui/src/theme.rs index 4d09261bf..d88f150e7 100644 --- a/gui/ui/src/theme.rs +++ b/gui/ui/src/theme.rs @@ -45,7 +45,7 @@ impl iced::overlay::menu::StyleSheet for Theme { text_color: color::GREY_2, background: color::GREY_6.into(), border_width: 0.0, - border_radius: 25.0, + border_radius: 25.0.into(), border_color: color::GREY_2, selected_text_color: color::LIGHT_BLACK, selected_background: color::GREEN.into(), @@ -102,19 +102,19 @@ impl container::StyleSheet for Theme { match self { Theme::Light => match style { Container::Transparent => container::Appearance { - background: iced::Color::TRANSPARENT.into(), + background: Some(iced::Color::TRANSPARENT.into()), ..container::Appearance::default() }, Container::Background => container::Appearance { - background: color::GREY_2.into(), + background: Some(color::GREY_2.into()), ..container::Appearance::default() }, Container::Foreground => container::Appearance { - background: color::GREY_2.into(), + background: Some(color::GREY_2.into()), ..container::Appearance::default() }, Container::Border => container::Appearance { - background: iced::Color::TRANSPARENT.into(), + background: Some(iced::Color::TRANSPARENT.into()), border_width: 1.0, border_color: color::LIGHT_BLACK, ..container::Appearance::default() @@ -123,30 +123,30 @@ impl container::StyleSheet for Theme { Container::Badge(c) => c.appearance(self), Container::Pill(c) => c.appearance(self), Container::Custom(c) => container::Appearance { - background: (*c).into(), + background: Some((*c).into()), ..container::Appearance::default() }, Container::QrCode => container::Appearance { - background: color::WHITE.into(), - border_radius: 25.0, + background: Some(color::WHITE.into()), + border_radius: 25.0.into(), ..container::Appearance::default() }, }, Theme::Dark => match style { Container::Transparent => container::Appearance { - background: iced::Color::TRANSPARENT.into(), + background: Some(iced::Color::TRANSPARENT.into()), ..container::Appearance::default() }, Container::Background => container::Appearance { - background: color::LIGHT_BLACK.into(), + background: Some(color::LIGHT_BLACK.into()), ..container::Appearance::default() }, Container::Foreground => container::Appearance { - background: color::BLACK.into(), + background: Some(color::BLACK.into()), ..container::Appearance::default() }, Container::Border => container::Appearance { - background: iced::Color::TRANSPARENT.into(), + background: Some(iced::Color::TRANSPARENT.into()), border_width: 1.0, border_color: color::GREY_3, ..container::Appearance::default() @@ -155,12 +155,12 @@ impl container::StyleSheet for Theme { Container::Badge(c) => c.appearance(self), Container::Pill(c) => c.appearance(self), Container::Custom(c) => container::Appearance { - background: (*c).into(), + background: Some((*c).into()), ..container::Appearance::default() }, Container::QrCode => container::Appearance { - background: color::WHITE.into(), - border_radius: 25.0, + background: Some(color::WHITE.into()), + border_radius: 25.0.into(), ..container::Appearance::default() }, }, @@ -201,65 +201,65 @@ impl Card { match theme { Theme::Light => match self { Card::Simple => container::Appearance { - background: color::GREY_2.into(), + background: Some(color::GREY_2.into()), ..container::Appearance::default() }, Card::Border => container::Appearance { - background: iced::Color::TRANSPARENT.into(), - border_radius: 10.0, + background: Some(iced::Color::TRANSPARENT.into()), + border_radius: 10.0.into(), border_color: color::GREY_2, border_width: 1.0, ..container::Appearance::default() }, Card::Invalid => container::Appearance { - background: color::GREY_2.into(), + background: Some(color::GREY_2.into()), text_color: color::BLACK.into(), border_width: 1.0, border_color: color::RED, ..container::Appearance::default() }, Card::Error => container::Appearance { - background: color::GREY_2.into(), + background: Some(color::GREY_2.into()), text_color: color::RED.into(), border_width: 1.0, border_color: color::RED, ..container::Appearance::default() }, Card::Warning => container::Appearance { - background: color::ORANGE.into(), + background: Some(color::ORANGE.into()), text_color: color::GREY_2.into(), ..container::Appearance::default() }, }, Theme::Dark => match self { Card::Simple => container::Appearance { - background: color::GREY_6.into(), - border_radius: 25.0, + background: Some(color::GREY_6.into()), + border_radius: 25.0.into(), ..container::Appearance::default() }, Card::Border => container::Appearance { - background: iced::Color::TRANSPARENT.into(), - border_radius: 25.0, + background: Some(iced::Color::TRANSPARENT.into()), + border_radius: 25.0.into(), border_color: color::GREY_5, border_width: 1.0, ..container::Appearance::default() }, Card::Invalid => container::Appearance { - background: color::LIGHT_BLACK.into(), + background: Some(color::LIGHT_BLACK.into()), text_color: color::RED.into(), border_width: 1.0, - border_radius: 25.0, + border_radius: 25.0.into(), border_color: color::RED, }, Card::Error => container::Appearance { - background: color::LIGHT_BLACK.into(), + background: Some(color::LIGHT_BLACK.into()), text_color: color::RED.into(), border_width: 1.0, border_color: color::RED, ..container::Appearance::default() }, Card::Warning => container::Appearance { - background: color::ORANGE.into(), + background: Some(color::ORANGE.into()), text_color: color::WHITE.into(), ..container::Appearance::default() }, @@ -279,13 +279,13 @@ impl Badge { fn appearance(&self, _theme: &Theme) -> iced::widget::container::Appearance { match self { Self::Standard => container::Appearance { - border_radius: 40.0, - background: color::GREY_4.into(), + border_radius: 40.0.into(), + background: Some(color::GREY_4.into()), ..container::Appearance::default() }, Self::Bitcoin => container::Appearance { - border_radius: 40.0, - background: color::ORANGE.into(), + border_radius: 40.0.into(), + background: Some(color::ORANGE.into()), text_color: iced::Color::WHITE.into(), ..container::Appearance::default() }, @@ -306,27 +306,27 @@ impl Pill { fn appearance(&self, _theme: &Theme) -> iced::widget::container::Appearance { match self { Self::Primary => container::Appearance { - background: color::GREEN.into(), - border_radius: 25.0, + background: Some(color::GREEN.into()), + border_radius: 25.0.into(), text_color: color::LIGHT_BLACK.into(), ..container::Appearance::default() }, Self::Success => container::Appearance { - background: color::GREEN.into(), - border_radius: 25.0, + background: Some(color::GREEN.into()), + border_radius: 25.0.into(), text_color: color::LIGHT_BLACK.into(), ..container::Appearance::default() }, Self::Simple => container::Appearance { - background: iced::Color::TRANSPARENT.into(), - border_radius: 25.0, + background: Some(iced::Color::TRANSPARENT.into()), + border_radius: 25.0.into(), border_width: 1.0, border_color: color::GREY_3, text_color: color::GREY_3.into(), }, Self::Warning => container::Appearance { - background: iced::Color::TRANSPARENT.into(), - border_radius: 25.0, + background: Some(iced::Color::TRANSPARENT.into()), + border_radius: 25.0.into(), border_width: 1.0, border_color: color::RED, text_color: color::RED.into(), @@ -370,10 +370,10 @@ impl scrollable::StyleSheet for Theme { background: None, border_width: 0.0, border_color: color::GREY_7, - border_radius: 10.0, + border_radius: 10.0.into(), scroller: scrollable::Scroller { color: color::GREY_7, - border_radius: 10.0, + border_radius: 10.0.into(), border_width: 0.0, border_color: iced::Color::TRANSPARENT, }, @@ -403,7 +403,7 @@ impl pick_list::StyleSheet for Theme { background: color::GREEN.into(), border_width: 1.0, border_color: color::GREY_7, - border_radius: 25.0, + border_radius: 25.0.into(), text_color: iced::Color::BLACK, }, PickList::Invalid => pick_list::Appearance { @@ -412,7 +412,7 @@ impl pick_list::StyleSheet for Theme { background: color::GREY_6.into(), border_width: 1.0, border_color: color::RED, - border_radius: 25.0, + border_radius: 25.0.into(), text_color: color::RED, }, } @@ -437,7 +437,7 @@ impl checkbox::StyleSheet for Theme { border_color: iced::Color::TRANSPARENT, icon_color: color::GREY_4, text_color: None, - border_radius: 4.0, + border_radius: 4.0.into(), } } else { checkbox::Appearance { @@ -446,7 +446,7 @@ impl checkbox::StyleSheet for Theme { border_color: iced::Color::TRANSPARENT, icon_color: color::GREEN, text_color: None, - border_radius: 4.0, + border_radius: 4.0.into(), } } } @@ -477,40 +477,40 @@ impl button::StyleSheet for Theme { Theme::Dark => match style { Button::Primary => button::Appearance { shadow_offset: iced::Vector::default(), - background: iced::Color::TRANSPARENT.into(), - border_radius: 25.0, + background: Some(iced::Color::TRANSPARENT.into()), + border_radius: 25.0.into(), border_width: 1.0, border_color: color::GREY_7, text_color: color::GREY_2, }, Button::Secondary | Button::Border => button::Appearance { shadow_offset: iced::Vector::default(), - background: iced::Color::TRANSPARENT.into(), - border_radius: 25.0, + background: Some(iced::Color::TRANSPARENT.into()), + border_radius: 25.0.into(), border_width: 1.0, border_color: color::GREY_7, text_color: color::GREY_2, }, Button::Destructive => button::Appearance { shadow_offset: iced::Vector::default(), - background: iced::Color::TRANSPARENT.into(), - border_radius: 25.0, + background: Some(iced::Color::TRANSPARENT.into()), + border_radius: 25.0.into(), border_width: 1.0, border_color: color::RED, text_color: color::RED, }, Button::Transparent => button::Appearance { shadow_offset: iced::Vector::default(), - background: iced::Color::TRANSPARENT.into(), - border_radius: 25.0, + background: Some(iced::Color::TRANSPARENT.into()), + border_radius: 25.0.into(), border_width: 0.0, border_color: iced::Color::TRANSPARENT, text_color: color::GREY_2, }, Button::TransparentBorder => button::Appearance { shadow_offset: iced::Vector::default(), - background: iced::Color::TRANSPARENT.into(), - border_radius: 25.0, + background: Some(iced::Color::TRANSPARENT.into()), + border_radius: 25.0.into(), border_width: 0.0, border_color: iced::Color::TRANSPARENT, text_color: color::WHITE, @@ -519,8 +519,8 @@ impl button::StyleSheet for Theme { if *active { button::Appearance { shadow_offset: iced::Vector::default(), - background: color::LIGHT_BLACK.into(), - border_radius: 25.0, + background: Some(color::LIGHT_BLACK.into()), + border_radius: 25.0.into(), border_width: 0.0, border_color: iced::Color::TRANSPARENT, text_color: color::WHITE, @@ -528,8 +528,8 @@ impl button::StyleSheet for Theme { } else { button::Appearance { shadow_offset: iced::Vector::default(), - background: iced::Color::TRANSPARENT.into(), - border_radius: 25.0, + background: Some(iced::Color::TRANSPARENT.into()), + border_radius: 25.0.into(), border_width: 0.0, border_color: iced::Color::TRANSPARENT, text_color: color::WHITE, @@ -546,48 +546,48 @@ impl button::StyleSheet for Theme { Theme::Dark => match style { Button::Primary => button::Appearance { shadow_offset: iced::Vector::default(), - background: color::GREEN.into(), - border_radius: 25.0, + background: Some(color::GREEN.into()), + border_radius: 25.0.into(), border_width: 0.0, border_color: iced::Color::TRANSPARENT, text_color: color::LIGHT_BLACK, }, Button::Secondary => button::Appearance { shadow_offset: iced::Vector::default(), - background: color::GREEN.into(), - border_radius: 25.0, + background: Some(color::GREEN.into()), + border_radius: 25.0.into(), border_width: 0.0, border_color: iced::Color::TRANSPARENT, text_color: color::LIGHT_BLACK, }, Button::Destructive => button::Appearance { shadow_offset: iced::Vector::default(), - background: color::RED.into(), - border_radius: 25.0, + background: Some(color::RED.into()), + border_radius: 25.0.into(), border_width: 0.0, border_color: iced::Color::TRANSPARENT, text_color: color::LIGHT_BLACK, }, Button::Transparent => button::Appearance { shadow_offset: iced::Vector::default(), - background: color::GREY_7.into(), - border_radius: 25.0, + background: Some(color::GREY_7.into()), + border_radius: 25.0.into(), border_width: 0.0, border_color: iced::Color::TRANSPARENT, text_color: color::GREY_2, }, Button::TransparentBorder | Button::Border => button::Appearance { shadow_offset: iced::Vector::default(), - background: iced::Color::TRANSPARENT.into(), - border_radius: 25.0, + background: Some(iced::Color::TRANSPARENT.into()), + border_radius: 25.0.into(), border_width: 1.0, border_color: color::GREEN, text_color: color::WHITE, }, Button::Menu(_) => button::Appearance { shadow_offset: iced::Vector::default(), - background: color::LIGHT_BLACK.into(), - border_radius: 25.0, + background: Some(color::LIGHT_BLACK.into()), + border_radius: 25.0.into(), border_width: 0.0, border_color: iced::Color::TRANSPARENT, text_color: color::WHITE, @@ -611,14 +611,14 @@ impl text_input::StyleSheet for Theme { Form::Simple => text_input::Appearance { icon_color: color::GREY_7, background: iced::Background::Color(iced::Color::TRANSPARENT), - border_radius: 25.0, + border_radius: 25.0.into(), border_width: 1.0, border_color: color::GREY_7, }, Form::Invalid => text_input::Appearance { icon_color: color::GREY_7, background: iced::Background::Color(iced::Color::TRANSPARENT), - border_radius: 25.0, + border_radius: 25.0.into(), border_width: 1.0, border_color: color::RED, }, @@ -666,7 +666,7 @@ impl progress_bar::StyleSheet for Theme { progress_bar::Appearance { background: color::GREY_6.into(), bar: color::GREEN.into(), - border_radius: 10.0, + border_radius: 10.0.into(), } } } @@ -683,7 +683,7 @@ impl slider::StyleSheet for Theme { let handle = slider::Handle { shape: slider::HandleShape::Rectangle { width: 8, - border_radius: 4.0, + border_radius: 4.0.into(), }, color: color::BLACK, border_color: color::GREEN, @@ -692,6 +692,7 @@ impl slider::StyleSheet for Theme { slider::Appearance { rail: slider::Rail { colors: (color::GREEN, iced::Color::TRANSPARENT), + border_radius: 4.0.into(), width: 2.0, }, handle, @@ -701,7 +702,7 @@ impl slider::StyleSheet for Theme { let handle = slider::Handle { shape: slider::HandleShape::Rectangle { width: 8, - border_radius: 4.0, + border_radius: 4.0.into(), }, color: color::GREEN, border_color: color::GREEN, @@ -710,6 +711,7 @@ impl slider::StyleSheet for Theme { slider::Appearance { rail: slider::Rail { colors: (color::GREEN, iced::Color::TRANSPARENT), + border_radius: 4.0.into(), width: 2.0, }, handle, @@ -719,7 +721,7 @@ impl slider::StyleSheet for Theme { let handle = slider::Handle { shape: slider::HandleShape::Rectangle { width: 8, - border_radius: 4.0, + border_radius: 4.0.into(), }, color: color::GREEN, border_color: color::GREEN, @@ -728,6 +730,7 @@ impl slider::StyleSheet for Theme { slider::Appearance { rail: slider::Rail { colors: (color::GREEN, iced::Color::TRANSPARENT), + border_radius: 4.0.into(), width: 2.0, }, handle,