gui: bump iced 0.10
This commit is contained in:
parent
6b225777b2
commit
64a626d7e8
1473
gui/Cargo.lock
generated
1473
gui/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -21,9 +21,8 @@ liana_ui = { path = "ui" }
|
||||
backtrace = "0.3"
|
||||
hex = "0.4.3"
|
||||
|
||||
iced = { version = "0.9", default-features= false, features = ["tokio", "glow", "svg", "qr_code", "image"] }
|
||||
iced_native = "0.10"
|
||||
iced_lazy = { version = "0.6"}
|
||||
iced = { version = "0.10", default-features = false, features = ["tokio", "svg", "qr_code", "image", "lazy", "wgpu"] }
|
||||
iced_runtime = "0.1.1"
|
||||
|
||||
tokio = {version = "1.21.0", features = ["signal"]}
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
@ -48,9 +47,6 @@ bitcoin_hashes = "0.12"
|
||||
reqwest = { version = "0.11", default-features=false, features = ["rustls-tls"] }
|
||||
rust-ini = "0.19.0"
|
||||
|
||||
[patch.crates-io]
|
||||
iced_futures = { git = "https://github.com/edouardparis/iced", branch = "fix-futures-recipe"}
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
zip = { version = "0.6", default-features=false, features = ["bzip2", "deflate"] }
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ let
|
||||
pkgs = import <nixpkgs> {};
|
||||
in
|
||||
pkgs.mkShell rec {
|
||||
buildInputs = [
|
||||
buildInputs = with pkgs; [
|
||||
pkgs.expat
|
||||
pkgs.fontconfig
|
||||
pkgs.freetype
|
||||
@ -17,6 +17,8 @@ pkgs.mkShell rec {
|
||||
pkgs.libGL
|
||||
pkgs.pkgconfig
|
||||
pkgs.udev
|
||||
pkgs.wayland
|
||||
pkgs.libxkbcommon
|
||||
pkgs.xorg.libX11
|
||||
pkgs.xorg.libXcursor
|
||||
pkgs.xorg.libXi
|
||||
|
||||
@ -439,7 +439,9 @@ pub fn signatures<'a>(
|
||||
},
|
||||
)),
|
||||
)
|
||||
.horizontal_scroll(scrollable::Properties::new().width(2).scroller_width(2)),
|
||||
.direction(scrollable::Direction::Horizontal(
|
||||
scrollable::Properties::new().width(2).scroller_width(2),
|
||||
)),
|
||||
)
|
||||
.padding(15)
|
||||
} else {
|
||||
@ -594,7 +596,9 @@ pub fn path_view<'a>(
|
||||
)
|
||||
.push(row_signed),
|
||||
)
|
||||
.horizontal_scroll(scrollable::Properties::new().width(2).scroller_width(2))
|
||||
.direction(scrollable::Direction::Horizontal(
|
||||
scrollable::Properties::new().width(2).scroller_width(2),
|
||||
))
|
||||
.into()
|
||||
}
|
||||
|
||||
|
||||
@ -3,11 +3,10 @@ use std::collections::{HashMap, HashSet};
|
||||
use iced::{
|
||||
widget::{
|
||||
qr_code::{self, QRCode},
|
||||
scrollable,
|
||||
scrollable, Space,
|
||||
},
|
||||
Alignment, Length,
|
||||
};
|
||||
use iced_native::widget::Space;
|
||||
|
||||
use liana::miniscript::bitcoin::{
|
||||
self,
|
||||
@ -94,10 +93,11 @@ pub fn receive<'a>(
|
||||
Length::Fixed(10.0),
|
||||
)),
|
||||
)
|
||||
.horizontal_scroll(
|
||||
.direction(scrollable::Direction::Horizontal(
|
||||
scrollable::Properties::new()
|
||||
.scroller_width(5),
|
||||
),
|
||||
.width(2)
|
||||
.scroller_width(2),
|
||||
)),
|
||||
)
|
||||
.width(Length::Fill),
|
||||
)
|
||||
|
||||
@ -633,9 +633,9 @@ pub fn wallet_settings<'a>(
|
||||
.push(text(descriptor.to_owned()).small())
|
||||
.push(Space::with_height(Length::Fixed(5.0))),
|
||||
)
|
||||
.horizontal_scroll(
|
||||
.direction(scrollable::Direction::Horizontal(
|
||||
scrollable::Properties::new().width(5).scroller_width(5),
|
||||
),
|
||||
)),
|
||||
)
|
||||
.push(
|
||||
Row::new()
|
||||
|
||||
@ -1626,7 +1626,7 @@ impl From<BackupDescriptor> for Box<dyn Step> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use iced_native::command::Action;
|
||||
use iced_runtime::command::Action;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
pub struct Sandbox<S: Step> {
|
||||
|
||||
@ -319,7 +319,9 @@ pub fn define_descriptor<'a>(
|
||||
)
|
||||
.padding(5),
|
||||
)
|
||||
.horizontal_scroll(Properties::new().width(3).scroller_width(3)),
|
||||
.direction(scrollable::Direction::Horizontal(
|
||||
Properties::new().width(3).scroller_width(3),
|
||||
)),
|
||||
),
|
||||
))
|
||||
.spacing(10);
|
||||
@ -436,7 +438,9 @@ pub fn recovery_path_view(
|
||||
)
|
||||
.padding(5),
|
||||
)
|
||||
.horizontal_scroll(Properties::new().width(3).scroller_width(3)),
|
||||
.direction(scrollable::Direction::Horizontal(
|
||||
Properties::new().width(3).scroller_width(3),
|
||||
)),
|
||||
),
|
||||
),
|
||||
)
|
||||
@ -568,9 +572,9 @@ pub fn signer_xpubs(xpubs: &[String]) -> Element<Message> {
|
||||
.push(
|
||||
Container::new(
|
||||
scrollable(Container::new(text(xpub).small()).padding(10))
|
||||
.horizontal_scroll(
|
||||
.direction(scrollable::Direction::Horizontal(
|
||||
Properties::new().width(5).scroller_width(5),
|
||||
),
|
||||
)),
|
||||
)
|
||||
.width(Length::Fill),
|
||||
)
|
||||
@ -641,9 +645,9 @@ pub fn hardware_wallet_xpubs<'a>(
|
||||
.push(
|
||||
Container::new(
|
||||
scrollable(Container::new(text(xpub).small()).padding(10))
|
||||
.horizontal_scroll(
|
||||
.direction(scrollable::Direction::Horizontal(
|
||||
Properties::new().width(5).scroller_width(5),
|
||||
),
|
||||
)),
|
||||
)
|
||||
.width(Length::Fill),
|
||||
)
|
||||
@ -1401,7 +1405,9 @@ pub fn defined_descriptor_key<'a>(
|
||||
.push(text(name).bold())
|
||||
.push(Space::with_height(Length::Fixed(5.0))),
|
||||
)
|
||||
.horizontal_scroll(Properties::new().width(5).scroller_width(5)),
|
||||
.direction(scrollable::Direction::Horizontal(
|
||||
Properties::new().width(5).scroller_width(5),
|
||||
)),
|
||||
)
|
||||
.push(image::success_mark_icon().width(Length::Fixed(50.0)))
|
||||
.push(Space::with_width(Length::Fixed(1.0))),
|
||||
@ -1997,8 +2003,8 @@ fn layout<'a>(
|
||||
|
||||
mod threshsold_input {
|
||||
use iced::alignment::{self, Alignment};
|
||||
use iced::widget::{component, Component};
|
||||
use iced::Length;
|
||||
use iced_lazy::{self, Component};
|
||||
use liana_ui::{component::text::*, icon, theme, widget::*};
|
||||
|
||||
pub struct ThresholdInput<Message> {
|
||||
@ -2085,7 +2091,7 @@ mod threshsold_input {
|
||||
Message: 'a,
|
||||
{
|
||||
fn from(numeric_input: ThresholdInput<Message>) -> Self {
|
||||
iced_lazy::component(numeric_input)
|
||||
component(numeric_input)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use iced::{
|
||||
alignment::Horizontal,
|
||||
widget::{tooltip, Space},
|
||||
Alignment, Command, Length, Subscription,
|
||||
};
|
||||
@ -330,7 +331,7 @@ impl DeleteWalletModal {
|
||||
.push(icon::circle_check_icon().style(color::GREEN))
|
||||
.push(text("Wallet successfully deleted").style(color::GREEN))
|
||||
})
|
||||
.align_x(iced_native::alignment::Horizontal::Center)
|
||||
.align_x(Horizontal::Center)
|
||||
.width(Length::Fill),
|
||||
),
|
||||
)
|
||||
|
||||
@ -64,6 +64,7 @@ impl Logger {
|
||||
&& !metadata.target().starts_with("iced_glow")
|
||||
&& !metadata.target().starts_with("glow_glyph")
|
||||
&& !metadata.target().starts_with("naga")
|
||||
&& !metadata.target().starts_with("winit")
|
||||
&& !metadata.target().starts_with("mio")
|
||||
&& !metadata.target().starts_with("ledger_transport_hid")
|
||||
})),
|
||||
|
||||
@ -90,12 +90,19 @@ pub enum Key {
|
||||
#[derive(Debug)]
|
||||
pub enum Message {
|
||||
CtrlC,
|
||||
FontLoaded(Result<(), iced::font::Error>),
|
||||
Launch(Box<launcher::Message>),
|
||||
Install(Box<installer::Message>),
|
||||
Load(Box<loader::Message>),
|
||||
Run(Box<app::Message>),
|
||||
Event(iced_native::Event),
|
||||
KeyPressed(Key),
|
||||
Event(iced::Event),
|
||||
}
|
||||
|
||||
impl From<Result<(), iced::font::Error>> for Message {
|
||||
fn from(value: Result<(), iced::font::Error>) -> Self {
|
||||
Self::FontLoaded(value)
|
||||
}
|
||||
}
|
||||
|
||||
async fn ctrl_c() -> Result<(), ()> {
|
||||
@ -121,17 +128,12 @@ impl Application for GUI {
|
||||
|
||||
fn new((config, log_level): (Config, Option<LevelFilter>)) -> (GUI, Command<Self::Message>) {
|
||||
let logger = Logger::setup(log_level.unwrap_or(LevelFilter::INFO));
|
||||
match config {
|
||||
let mut cmds = font::loads();
|
||||
cmds.push(Command::perform(ctrl_c(), |_| Message::CtrlC));
|
||||
let state = match config {
|
||||
Config::Launcher(datadir_path) => {
|
||||
let launcher = Launcher::new(datadir_path);
|
||||
(
|
||||
Self {
|
||||
state: State::Launcher(Box::new(launcher)),
|
||||
logger,
|
||||
log_level,
|
||||
},
|
||||
Command::perform(ctrl_c(), |_| Message::CtrlC),
|
||||
)
|
||||
State::Launcher(Box::new(launcher))
|
||||
}
|
||||
Config::Install(datadir_path, network) => {
|
||||
if !datadir_path.exists() {
|
||||
@ -151,17 +153,8 @@ impl Application for GUI {
|
||||
log_level.unwrap_or(LevelFilter::INFO),
|
||||
);
|
||||
let (install, command) = Installer::new(datadir_path, network);
|
||||
(
|
||||
Self {
|
||||
state: State::Installer(Box::new(install)),
|
||||
logger,
|
||||
log_level,
|
||||
},
|
||||
Command::batch(vec![
|
||||
command.map(|msg| Message::Install(Box::new(msg))),
|
||||
Command::perform(ctrl_c(), |_| Message::CtrlC),
|
||||
]),
|
||||
)
|
||||
cmds.push(command.map(|msg| Message::Install(Box::new(msg))));
|
||||
State::Installer(Box::new(install))
|
||||
}
|
||||
Config::Run(datadir_path, cfg, network) => {
|
||||
logger.set_running_mode(
|
||||
@ -170,30 +163,24 @@ impl Application for GUI {
|
||||
log_level.unwrap_or_else(|| cfg.log_level().unwrap_or(LevelFilter::INFO)),
|
||||
);
|
||||
let (loader, command) = Loader::new(datadir_path, cfg, network, None);
|
||||
(
|
||||
Self {
|
||||
state: State::Loader(Box::new(loader)),
|
||||
logger,
|
||||
log_level,
|
||||
},
|
||||
Command::batch(vec![
|
||||
command.map(|msg| Message::Load(Box::new(msg))),
|
||||
Command::perform(ctrl_c(), |_| Message::CtrlC),
|
||||
]),
|
||||
)
|
||||
cmds.push(command.map(|msg| Message::Load(Box::new(msg))));
|
||||
State::Loader(Box::new(loader))
|
||||
}
|
||||
}
|
||||
};
|
||||
(
|
||||
Self {
|
||||
state,
|
||||
logger,
|
||||
log_level,
|
||||
},
|
||||
Command::batch(cmds),
|
||||
)
|
||||
}
|
||||
|
||||
fn update(&mut self, message: Self::Message) -> Command<Self::Message> {
|
||||
match (&mut self.state, message) {
|
||||
(_, Message::CtrlC)
|
||||
| (
|
||||
_,
|
||||
Message::Event(iced_native::Event::Window(
|
||||
iced_native::window::Event::CloseRequested,
|
||||
)),
|
||||
) => {
|
||||
| (_, Message::Event(iced::Event::Window(iced::window::Event::CloseRequested))) => {
|
||||
match &mut self.state {
|
||||
State::Loader(s) => s.stop(),
|
||||
State::Launcher(s) => s.stop(),
|
||||
@ -309,19 +296,12 @@ impl Application for GUI {
|
||||
event::Status::Ignored,
|
||||
) => Some(Message::KeyPressed(Key::Tab(modifiers.shift()))),
|
||||
(
|
||||
iced::Event::Window(iced_native::window::Event::CloseRequested),
|
||||
iced::Event::Window(iced::window::Event::CloseRequested),
|
||||
event::Status::Ignored,
|
||||
) => Some(Message::Event(event)),
|
||||
_ => None,
|
||||
}),
|
||||
])
|
||||
.with_filter(|(event, _status)| {
|
||||
matches!(
|
||||
event,
|
||||
iced::Event::Window(iced_native::window::Event::CloseRequested)
|
||||
| iced::Event::Keyboard(_)
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn view(&self) -> Element<Self::Message> {
|
||||
@ -453,12 +433,20 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
setup_panic_hook();
|
||||
|
||||
let mut settings = Settings::with_flags((config, log_level));
|
||||
settings.id = Some("liana-gui".to_string());
|
||||
settings.window.icon = Some(image::liana_app_icon());
|
||||
settings.default_text_size = text::P1_SIZE.into();
|
||||
settings.default_font = Some(font::REGULAR_BYTES);
|
||||
settings.default_font = liana_ui::font::REGULAR;
|
||||
settings.exit_on_close_request = false;
|
||||
|
||||
settings.id = Some("Liana".to_string());
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
settings.window.platform_specific = iced::window::PlatformSpecific {
|
||||
application_id: "Liana".to_string(),
|
||||
};
|
||||
}
|
||||
|
||||
if let Err(e) = GUI::run(settings) {
|
||||
return Err(format!("Failed to launch UI: {}", e).into());
|
||||
};
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use iced_native::command::Action;
|
||||
use iced_runtime::command::Action;
|
||||
|
||||
use crate::{
|
||||
app::{cache::Cache, message::Message, state::State, wallet::Wallet},
|
||||
|
||||
@ -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.31"
|
||||
chrono = "0.4"
|
||||
|
||||
@ -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 = "../.." }
|
||||
|
||||
@ -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<Result<(), iced::font::Error>> 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<Command<Self::Message>> = 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<Self::Message> {
|
||||
@ -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<Self::Message> {
|
||||
iced_native::subscription::events().map(Self::Message::Event)
|
||||
iced::subscription::events().map(Self::Message::Event)
|
||||
}
|
||||
|
||||
fn view(&self) -> Element<Message> {
|
||||
|
||||
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<Message, Renderer> for Modal<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: iced_native::Renderer,
|
||||
Renderer: advanced::Renderer,
|
||||
Message: Clone,
|
||||
{
|
||||
fn children(&self) -> Vec<Tree> {
|
||||
@ -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: &<Renderer as iced_native::Renderer>::Theme,
|
||||
theme: &<Renderer as advanced::Renderer>::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<Message, Renderer>
|
||||
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<overlay::Element<'c, Message, Renderer>> {
|
||||
self.content
|
||||
.as_widget_mut()
|
||||
.overlay(self.tree, layout.children().next().unwrap(), renderer)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Message, Renderer> From<Modal<'a, Message, Renderer>> 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 {
|
||||
|
||||
@ -2,10 +2,11 @@ use std::time::Instant;
|
||||
|
||||
use super::theme::Theme;
|
||||
|
||||
use iced::advanced::widget::{Operation, Tree};
|
||||
use iced::advanced::{layout, mouse, overlay, renderer};
|
||||
use iced::advanced::{Clipboard, Layout, Shell, Widget};
|
||||
use iced::event::{self, Event};
|
||||
use iced::{Alignment, Element, Length, Point, Rectangle, Size, Vector};
|
||||
use iced_native::widget::{Operation, Tree};
|
||||
use iced_native::{event, layout, mouse, overlay, renderer};
|
||||
use iced_native::{Clipboard, Event, Layout, Shell, Widget};
|
||||
|
||||
pub trait Toast {
|
||||
fn title(&self) -> &str;
|
||||
@ -34,7 +35,7 @@ where
|
||||
|
||||
impl<'a, Message, Renderer> Widget<Message, Renderer> for Manager<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: iced_native::Renderer,
|
||||
Renderer: iced::advanced::Renderer,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
self.content.as_widget().width()
|
||||
@ -48,13 +49,13 @@ where
|
||||
self.content.as_widget().layout(renderer, limits)
|
||||
}
|
||||
|
||||
fn tag(&self) -> iced_native::widget::tree::Tag {
|
||||
fn tag(&self) -> iced::advanced::widget::tree::Tag {
|
||||
struct Marker(Vec<Instant>);
|
||||
iced_native::widget::tree::Tag::of::<Marker>()
|
||||
iced::advanced::widget::tree::Tag::of::<Marker>()
|
||||
}
|
||||
|
||||
fn state(&self) -> iced_native::widget::tree::State {
|
||||
iced_native::widget::tree::State::new(Vec::<Option<Instant>>::new())
|
||||
fn state(&self) -> iced::advanced::widget::tree::State {
|
||||
iced::advanced::widget::tree::State::new(Vec::<Option<Instant>>::new())
|
||||
}
|
||||
|
||||
fn children(&self) -> Vec<Tree> {
|
||||
@ -95,7 +96,7 @@ where
|
||||
renderer: &Renderer,
|
||||
operation: &mut dyn Operation<Message>,
|
||||
) {
|
||||
operation.container(None, &mut |operation| {
|
||||
operation.container(None, layout.bounds(), &mut |operation| {
|
||||
self.content
|
||||
.as_widget()
|
||||
.operate(&mut state.children[0], layout, renderer, operation);
|
||||
@ -107,10 +108,11 @@ where
|
||||
state: &mut Tree,
|
||||
event: Event,
|
||||
layout: Layout<'_>,
|
||||
cursor_position: Point,
|
||||
cursor_position: iced::mouse::Cursor,
|
||||
renderer: &Renderer,
|
||||
clipboard: &mut dyn Clipboard,
|
||||
shell: &mut Shell<'_, Message>,
|
||||
viewport: &Rectangle,
|
||||
) -> event::Status {
|
||||
self.content.as_widget_mut().on_event(
|
||||
&mut state.children[0],
|
||||
@ -120,6 +122,7 @@ where
|
||||
renderer,
|
||||
clipboard,
|
||||
shell,
|
||||
viewport,
|
||||
)
|
||||
}
|
||||
|
||||
@ -127,10 +130,10 @@ where
|
||||
&self,
|
||||
state: &Tree,
|
||||
renderer: &mut Renderer,
|
||||
theme: &<Renderer as iced_native::Renderer>::Theme,
|
||||
theme: &<Renderer as iced::advanced::Renderer>::Theme,
|
||||
style: &renderer::Style,
|
||||
layout: Layout<'_>,
|
||||
cursor_position: Point,
|
||||
cursor_position: iced::mouse::Cursor,
|
||||
viewport: &Rectangle,
|
||||
) {
|
||||
self.content.as_widget().draw(
|
||||
@ -148,7 +151,7 @@ where
|
||||
&self,
|
||||
state: &Tree,
|
||||
layout: Layout<'_>,
|
||||
cursor_position: Point,
|
||||
cursor_position: iced::mouse::Cursor,
|
||||
viewport: &Rectangle,
|
||||
renderer: &Renderer,
|
||||
) -> mouse::Interaction {
|
||||
@ -201,7 +204,7 @@ struct Overlay<'a, 'b, Message, Renderer> {
|
||||
impl<'a, 'b, Message, Renderer> overlay::Overlay<Message, Renderer>
|
||||
for Overlay<'a, 'b, Message, Renderer>
|
||||
where
|
||||
Renderer: iced_native::Renderer,
|
||||
Renderer: iced::advanced::Renderer,
|
||||
{
|
||||
fn layout(&self, renderer: &Renderer, bounds: Size, position: Point) -> layout::Node {
|
||||
let limits = layout::Limits::new(Size::ZERO, bounds)
|
||||
@ -224,11 +227,12 @@ where
|
||||
&mut self,
|
||||
event: Event,
|
||||
layout: Layout<'_>,
|
||||
cursor_position: Point,
|
||||
cursor_position: iced::mouse::Cursor,
|
||||
renderer: &Renderer,
|
||||
clipboard: &mut dyn Clipboard,
|
||||
shell: &mut Shell<'_, Message>,
|
||||
) -> event::Status {
|
||||
let viewport = layout.bounds();
|
||||
self.toasts
|
||||
.iter_mut()
|
||||
.zip(self.state.iter_mut())
|
||||
@ -246,6 +250,7 @@ where
|
||||
renderer,
|
||||
clipboard,
|
||||
&mut local_shell,
|
||||
&viewport,
|
||||
);
|
||||
|
||||
if !local_shell.is_empty() {
|
||||
@ -262,10 +267,10 @@ where
|
||||
fn draw(
|
||||
&self,
|
||||
renderer: &mut Renderer,
|
||||
theme: &<Renderer as iced_native::Renderer>::Theme,
|
||||
theme: &<Renderer as iced::advanced::Renderer>::Theme,
|
||||
style: &renderer::Style,
|
||||
layout: Layout<'_>,
|
||||
cursor_position: Point,
|
||||
cursor_position: iced::mouse::Cursor,
|
||||
) {
|
||||
let viewport = layout.bounds();
|
||||
|
||||
@ -291,9 +296,9 @@ where
|
||||
&mut self,
|
||||
layout: Layout<'_>,
|
||||
renderer: &Renderer,
|
||||
operation: &mut dyn iced_native::widget::Operation<Message>,
|
||||
operation: &mut dyn iced::advanced::widget::Operation<Message>,
|
||||
) {
|
||||
operation.container(None, &mut |operation| {
|
||||
operation.container(None, layout.bounds(), &mut |operation| {
|
||||
self.toasts
|
||||
.iter()
|
||||
.zip(self.state.iter_mut())
|
||||
@ -309,7 +314,7 @@ where
|
||||
fn mouse_interaction(
|
||||
&self,
|
||||
layout: Layout<'_>,
|
||||
cursor_position: Point,
|
||||
cursor_position: iced::mouse::Cursor,
|
||||
viewport: &Rectangle,
|
||||
renderer: &Renderer,
|
||||
) -> mouse::Interaction {
|
||||
@ -330,7 +335,7 @@ where
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
fn is_over(&self, layout: Layout<'_>, cursor_position: Point) -> bool {
|
||||
fn is_over(&self, layout: Layout<'_>, _renderer: &Renderer, cursor_position: Point) -> bool {
|
||||
layout
|
||||
.children()
|
||||
.any(|layout| layout.bounds().contains(cursor_position))
|
||||
@ -339,7 +344,7 @@ where
|
||||
|
||||
impl<'a, Message, Renderer> From<Manager<'a, Message, Renderer>> for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'a + iced_native::Renderer,
|
||||
Renderer: 'a + iced::advanced::Renderer,
|
||||
Message: 'a,
|
||||
{
|
||||
fn from(manager: Manager<'a, Message, Renderer>) -> Self {
|
||||
|
||||
@ -1,18 +1,37 @@
|
||||
use iced::Font;
|
||||
|
||||
pub const BOLD: Font = Font::External {
|
||||
name: "Bold",
|
||||
bytes: include_bytes!("../static/fonts/IBMPlexSans-Bold.ttf"),
|
||||
use iced::{
|
||||
font::{Family, Stretch, Weight},
|
||||
Command, Font,
|
||||
};
|
||||
|
||||
pub const MEDIUM: Font = Font::External {
|
||||
name: "Regular",
|
||||
bytes: include_bytes!("../static/fonts/IBMPlexSans-Medium.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 {
|
||||
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<T: From<Result<(), iced::font::Error>> + 'static>() -> Vec<Command<T>> {
|
||||
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),
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
use crate::{component::text::P1_SIZE, 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())
|
||||
|
||||
@ -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(),
|
||||
@ -103,19 +103,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()
|
||||
@ -125,30 +125,30 @@ impl container::StyleSheet for Theme {
|
||||
Container::Pill(c) => c.appearance(self),
|
||||
Container::Notification(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()
|
||||
@ -158,12 +158,12 @@ impl container::StyleSheet for Theme {
|
||||
Container::Pill(c) => c.appearance(self),
|
||||
Container::Notification(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,34 +201,34 @@ impl Notification {
|
||||
match theme {
|
||||
Theme::Light => match self {
|
||||
Self::Pending => container::Appearance {
|
||||
background: color::GREEN.into(),
|
||||
background: Some(iced::Background::Color(color::GREEN)),
|
||||
text_color: color::LIGHT_BLACK.into(),
|
||||
border_width: 1.0,
|
||||
border_color: color::GREEN,
|
||||
border_radius: 25.0,
|
||||
border_radius: 25.0.into(),
|
||||
},
|
||||
Self::Error => container::Appearance {
|
||||
background: color::ORANGE.into(),
|
||||
background: Some(iced::Background::Color(color::ORANGE)),
|
||||
text_color: color::LIGHT_BLACK.into(),
|
||||
border_width: 1.0,
|
||||
border_color: color::ORANGE,
|
||||
border_radius: 25.0,
|
||||
border_radius: 25.0.into(),
|
||||
},
|
||||
},
|
||||
Theme::Dark => match self {
|
||||
Self::Pending => container::Appearance {
|
||||
background: color::GREEN.into(),
|
||||
background: Some(iced::Background::Color(color::GREEN)),
|
||||
text_color: color::LIGHT_BLACK.into(),
|
||||
border_width: 1.0,
|
||||
border_color: color::GREEN,
|
||||
border_radius: 25.0,
|
||||
border_radius: 25.0.into(),
|
||||
},
|
||||
Self::Error => container::Appearance {
|
||||
background: color::ORANGE.into(),
|
||||
background: Some(iced::Background::Color(color::ORANGE)),
|
||||
text_color: color::LIGHT_BLACK.into(),
|
||||
border_width: 1.0,
|
||||
border_color: color::ORANGE,
|
||||
border_radius: 25.0,
|
||||
border_radius: 25.0.into(),
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -250,65 +250,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::LIGHT_BLACK.into(),
|
||||
..container::Appearance::default()
|
||||
},
|
||||
@ -328,13 +328,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()
|
||||
},
|
||||
@ -355,27 +355,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(),
|
||||
@ -420,10 +420,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,
|
||||
},
|
||||
@ -454,7 +454,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 {
|
||||
@ -463,7 +463,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,
|
||||
},
|
||||
PickList::Secondary => pick_list::Appearance {
|
||||
@ -472,7 +472,7 @@ impl pick_list::StyleSheet for Theme {
|
||||
background: color::TRANSPARENT.into(),
|
||||
border_width: 1.0,
|
||||
border_color: color::GREY_3,
|
||||
border_radius: 25.0,
|
||||
border_radius: 25.0.into(),
|
||||
text_color: color::GREY_2,
|
||||
},
|
||||
}
|
||||
@ -497,7 +497,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 {
|
||||
@ -506,7 +506,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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -538,8 +538,8 @@ 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,
|
||||
@ -547,8 +547,8 @@ impl button::StyleSheet for Theme {
|
||||
Button::Secondary | Button::SecondaryDestructive | 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,
|
||||
@ -556,24 +556,24 @@ impl button::StyleSheet for Theme {
|
||||
}
|
||||
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,
|
||||
@ -582,8 +582,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,
|
||||
@ -591,8 +591,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,
|
||||
@ -609,48 +609,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::SecondaryDestructive => 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: 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::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,
|
||||
@ -674,14 +674,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,
|
||||
},
|
||||
@ -729,7 +729,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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -746,7 +746,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,
|
||||
@ -755,6 +755,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,
|
||||
@ -764,7 +765,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,
|
||||
@ -773,6 +774,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,
|
||||
@ -782,7 +784,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,
|
||||
@ -791,6 +793,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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user