From 954f49d4d73d040ef9367800a662031cd92d9e09 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 22 Feb 2025 00:34:55 +0100 Subject: Add `weakest` and `strongest` to `Background` palette ... and tweak background shade generation logic. --- examples/styling/src/main.rs | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'examples') diff --git a/examples/styling/src/main.rs b/examples/styling/src/main.rs index 594be4a7..fce2b162 100644 --- a/examples/styling/src/main.rs +++ b/examples/styling/src/main.rs @@ -1,8 +1,8 @@ use iced::keyboard; use iced::widget::{ - button, center, checkbox, column, horizontal_rule, pick_list, progress_bar, - row, scrollable, slider, text, text_input, toggler, vertical_rule, - vertical_space, + button, center, checkbox, column, container, horizontal_rule, pick_list, + progress_bar, row, scrollable, slider, text, text_input, toggler, + vertical_rule, vertical_space, }; use iced::{Center, Element, Fill, Subscription, Theme}; @@ -90,9 +90,9 @@ impl Styling { let danger = styled_button("Danger").style(button::danger); let slider = - slider(0.0..=100.0, self.slider_value, Message::SliderChanged); + || slider(0.0..=100.0, self.slider_value, Message::SliderChanged); - let progress_bar = progress_bar(0.0..=100.0, self.slider_value); + let progress_bar = || progress_bar(0.0..=100.0, self.slider_value); let scrollable = scrollable(column![ "Scroll me!", @@ -110,6 +110,20 @@ impl Styling { .on_toggle(Message::TogglerToggled) .spacing(10); + let card = { + container( + column![ + text("Card Example").size(24), + slider(), + progress_bar(), + ] + .spacing(20), + ) + .width(Fill) + .padding(20) + .style(container::bordered_box) + }; + let content = column![ choose_theme, horizontal_rule(38), @@ -117,8 +131,8 @@ impl Styling { row![primary, success, warning, danger] .spacing(10) .align_y(Center), - slider, - progress_bar, + slider(), + progress_bar(), row![ scrollable, vertical_rule(38), @@ -127,6 +141,7 @@ impl Styling { .spacing(10) .height(100) .align_y(Center), + card ] .spacing(20) .padding(20) -- cgit From 9b79aa567a185c835e09c26230245e12176ce4e7 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 22 Feb 2025 01:03:04 +0100 Subject: Recreate `todos` snapshot test --- examples/todos/snapshots/creates_a_new_task.sha256 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/todos/snapshots/creates_a_new_task.sha256 b/examples/todos/snapshots/creates_a_new_task.sha256 index 193132c5..a92f8726 100644 --- a/examples/todos/snapshots/creates_a_new_task.sha256 +++ b/examples/todos/snapshots/creates_a_new_task.sha256 @@ -1 +1 @@ -3160686067cb7c738802009cdf2f3c5f5a5bd8c89ada70517388b7adbe64c313 \ No newline at end of file +ae2cef8da43ffa33fc298204d44968544db05387a07d8030ea88683f8adfe37c \ No newline at end of file -- cgit From 873311558f1b96f7a40ee73ddb270c396607b9bb Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 22 Feb 2025 02:25:01 +0100 Subject: Darken background of `Dark` theme --- examples/todos/snapshots/creates_a_new_task.sha256 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/todos/snapshots/creates_a_new_task.sha256 b/examples/todos/snapshots/creates_a_new_task.sha256 index a92f8726..cba60539 100644 --- a/examples/todos/snapshots/creates_a_new_task.sha256 +++ b/examples/todos/snapshots/creates_a_new_task.sha256 @@ -1 +1 @@ -ae2cef8da43ffa33fc298204d44968544db05387a07d8030ea88683f8adfe37c \ No newline at end of file +0ef7325a79ce31c83759529ed478c8b4848c40c2867193624ef9673b9e21ff53 \ No newline at end of file -- cgit