use segmented_button from iced_aw (personal branch for latest iced)

Signed-off-by: Fabrizio Iannetti <fabrizio.iannetti@gmail.com>
This commit is contained in:
Fabrizio Iannetti 2024-04-27 09:40:47 +02:00
parent 0d528bd961
commit f670e0c83d
3 changed files with 18 additions and 9 deletions

9
Cargo.lock generated
View File

@ -464,6 +464,7 @@ dependencies = [
"directories",
"icalendar",
"iced",
"iced_aw",
"log",
"lttng-ust",
"lttng-ust-generate",
@ -1597,6 +1598,14 @@ dependencies = [
"thiserror",
]
[[package]]
name = "iced_aw"
version = "0.8.0"
dependencies = [
"cfg-if",
"iced",
]
[[package]]
name = "iced_core"
version = "0.13.0-dev"

View File

@ -10,6 +10,7 @@ tracing = ["dep:lttng-ust"]
#iced = "0.4.2"
#iced_native = "0.5.1"
iced = { path = "../iced", features = ["advanced"] }
iced_aw = { path = "../iced_aw", default-features = false, features = ["segmented_button", "tab_bar", "icons"] }
chrono = "0.4"
lttng-ust = { version = "0.1.0", optional = true }
icalendar = "0.15.4"

View File

@ -10,12 +10,13 @@ use iced::{
Length,
widget::{
button,
row,
Row,
Button,
Text,
pick_list,
Text, text,
},
};
use iced_aw::widgets::segmented_button::SegmentedButton;
//#[derive(Default)]
pub struct Controls {
@ -56,13 +57,11 @@ impl Controls {
.align_items(Alignment::Center)
.padding(5)
.spacing(10)
.push(
pick_list(
&Controls::MODES[..],
self.mode,
Message::ViewModeSelected,
).placeholder("mode")
)
.push(row![
SegmentedButton::new(text("Week"), ViewMode::Week, self.mode, Message::ViewModeSelected),
SegmentedButton::new(text("Month"), ViewMode::Month, self.mode, Message::ViewModeSelected),
SegmentedButton::new(text("Year"), ViewMode::Year, self.mode, Message::ViewModeSelected),
])
.push(
Button::new(Text::new("<"))
.on_press(self.get_msg_prev())