Skip to content

Commit

Permalink
update iced to 0.13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
futurepaul committed Sep 19, 2024
1 parent ded280f commit 039b413
Show file tree
Hide file tree
Showing 16 changed files with 716 additions and 489 deletions.
695 changes: 465 additions & 230 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ default = []
vendored = ["rusqlite/bundled-sqlcipher-vendored-openssl"]

[dependencies]
anyhow = "1.0.86"
anyhow = "1.0.89"
log = "0.4"
pretty_env_logger = "0.5" # todo swap to a file logger
iced = { git = "https://github.com/iced-rs/iced", rev = "b30d34f", features = ["debug", "tokio", "svg", "qr_code", "advanced"] }
iced = { version = "0.13.1", features = ["debug", "tokio", "svg", "qr_code", "advanced"] }
lyon_algorithms = "1.0"
once_cell = "1.0"
tokio = { version = "1", features = ["full"] }
Expand Down
8 changes: 4 additions & 4 deletions src/components/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ pub fn h_button(text_str: &str, icon: SvgIcon, loading: bool) -> Button<'_, Mess
let spinner: Element<'static, Message, Theme> = the_spinner();
let svg = map_icon(icon, 24., 24.);
let content = if loading {
row![spinner].align_items(iced::Alignment::Center)
row![spinner].align_y(iced::Alignment::Center)
} else {
row![svg, text(text_str).size(24.)]
.align_items(iced::Alignment::Center)
.align_y(iced::Alignment::Center)
.spacing(16)
};

Expand Down Expand Up @@ -61,9 +61,9 @@ pub fn sidebar_button(
let is_active = self_route == active_route;
let svg = map_icon(icon, 24., 24.);
let content = row!(svg, text(text_str).size(24.), horizontal_space(),)
.align_items(iced::Alignment::Center)
.align_y(iced::Alignment::Center)
.spacing(16)
.padding(16);
.padding(8);

Button::new(content)
.style(move |theme, status| {
Expand Down
2 changes: 1 addition & 1 deletion src/components/federation_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn h_federation_item(item: &FederationItem) -> Element<Message> {
} = item;

let name_row = row![map_icon(SvgIcon::People, 24., 24.), text(name).size(24)]
.align_items(Alignment::Center)
.align_y(Alignment::Center)
.spacing(16);

let balance_row = text(format_amount(*balance)).size(24);
Expand Down
7 changes: 3 additions & 4 deletions src/components/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ use iced::{
column, row, text,
text_input::{self, focus, Id},
TextInput,
},
Background, Border, Color, Command, Element, Theme,
}, Background, Border, Color, Element, Task, Theme
};

use crate::Message;

use super::{darken, lighten};

pub fn focus_input_id(id: &'static str) -> Command<Message> {
pub fn focus_input_id(id: &'static str) -> Task<Message> {
let id = Id::new(id);
focus(id)
}
Expand Down Expand Up @@ -73,7 +72,7 @@ pub fn h_input<'a>(
let suffix_text = text(suffix).size(24);
row![input, suffix_text]
.spacing(8)
.align_items(iced::Alignment::Center)
.align_y(iced::Alignment::Center)
} else {
row![input]
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/screen_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ pub fn h_screen_header(harbor: &HarborWallet, show_balance: bool) -> Element<Mes
} = item;
let people_icon = map_icon(SvgIcon::People, 24., 24.);
let current_federation = row![people_icon, text(name).size(24)]
.align_items(Alignment::Center)
.align_y(Alignment::Center)
.spacing(16)
.width(Length::Shrink)
.padding(16);

let formatted_balance = format_amount(harbor.balance_sats);

let balance = row![text(formatted_balance).size(24)]
.align_items(Alignment::Center)
.align_y(Alignment::Center)
.padding(16);

let row = row![current_federation].spacing(16);
Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn sidebar(harbor: &HarborWallet) -> Element<Message> {
.on_press(Message::Navigate(Route::Donate)),
]
.spacing(8)
.align_items(Alignment::Start),
.align_x(Alignment::Start),
)
.padding(8)
.style(|theme| -> Style {
Expand Down
2 changes: 1 addition & 1 deletion src/components/spinner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ where
) -> event::Status {
let state = tree.state.downcast_mut::<State>();

if let Event::Window(_, window::Event::RedrawRequested(now)) = event {
if let Event::Window(window::Event::RedrawRequested(now)) = event {
state.animation =
state
.animation
Expand Down
8 changes: 4 additions & 4 deletions src/components/toast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl<'a> ToastManager<'a> {
horizontal_space(),
close_button.on_press((on_close)(index))
]
.align_items(Alignment::Center),
.align_y(Alignment::Center),
text(toast.body.as_str())
])
.width(Length::Fill)
Expand Down Expand Up @@ -198,7 +198,7 @@ impl<'a> Widget<Message, Theme, Renderer> for ToastManager<'a> {
state: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn Operation<Message>,
operation: &mut dyn Operation,
) {
operation.container(None, layout.bounds(), &mut |operation| {
self.content
Expand Down Expand Up @@ -339,7 +339,7 @@ impl<'a, 'b, Message> overlay::Overlay<Message, Theme, Renderer> for Overlay<'a,
clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>,
) -> event::Status {
if let Event::Window(_, window::Event::RedrawRequested(now)) = &event {
if let Event::Window(window::Event::RedrawRequested(now)) = &event {
let mut next_redraw: Option<window::RedrawRequest> = None;

self.instants
Expand Down Expand Up @@ -427,7 +427,7 @@ impl<'a, 'b, Message> overlay::Overlay<Message, Theme, Renderer> for Overlay<'a,
&mut self,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn widget::Operation<Message>,
operation: &mut dyn widget::Operation,
) {
operation.container(None, layout.bounds(), &mut |operation| {
self.toasts
Expand Down
2 changes: 1 addition & 1 deletion src/components/transaction_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub fn h_transaction_item(item: &TransactionItem) -> Element<Message> {
let formatted_amount = text(format_amount(*amount)).size(24);

let row = row![direction_icon, kind_icon, formatted_amount,]
.align_items(iced::Alignment::Center)
.align_y(iced::Alignment::Center)
.spacing(16);

let timestamp = text(format_timestamp(timestamp)).size(18).style(subtitle);
Expand Down
Loading

0 comments on commit 039b413

Please sign in to comment.