summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-02-22 00:34:55 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-02-22 00:34:55 +0100
commit954f49d4d73d040ef9367800a662031cd92d9e09 (patch)
treed7a9429e73f79884dfaa3f2e56d8b9b3496be34b /examples
parentf1ed99cb47997e1d194a41e7cdf2846f8eb5f8fa (diff)
downloadiced-954f49d4d73d040ef9367800a662031cd92d9e09.tar.gz
iced-954f49d4d73d040ef9367800a662031cd92d9e09.tar.bz2
iced-954f49d4d73d040ef9367800a662031cd92d9e09.zip
Add `weakest` and `strongest` to `Background` palette
... and tweak background shade generation logic.
Diffstat (limited to 'examples')
-rw-r--r--examples/styling/src/main.rs29
1 files changed, 22 insertions, 7 deletions
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)