update(example): add button to cards and update cosmic-time
This commit is contained in:
parent
785861a630
commit
e24465ba37
3 changed files with 14 additions and 3 deletions
|
|
@ -7,5 +7,5 @@ publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libcosmic = { path = "../..", default-features = false, features = ["wayland", "tokio", "a11y"] }
|
libcosmic = { path = "../..", default-features = false, features = ["wayland", "tokio", "a11y"] }
|
||||||
cosmic-time = { git = "https://github.com/pop-os/cosmic-time", rev="178637c", default-features = false, features = ["libcosmic", "once_cell"] }
|
cosmic-time = { git = "https://github.com/pop-os/cosmic-time", rev="c39e737", default-features = false, features = ["libcosmic", "once_cell"] }
|
||||||
# cosmic-time = { path = "../../../cosmic-time", default-features = false, features = ["libcosmic", "once_cell"] }
|
# cosmic-time = { path = "../../../cosmic-time", default-features = false, features = ["libcosmic", "once_cell"] }
|
||||||
|
|
|
||||||
|
|
@ -13,4 +13,4 @@ once_cell = "1.18"
|
||||||
slotmap = "1.0.6"
|
slotmap = "1.0.6"
|
||||||
env_logger = "0.10"
|
env_logger = "0.10"
|
||||||
log = "0.4.17"
|
log = "0.4.17"
|
||||||
cosmic-time = { git = "https://github.com/pop-os/cosmic-time", rev="178637c", default-features = false, features = ["libcosmic", "once_cell"] }
|
cosmic-time = { git = "https://github.com/pop-os/cosmic-time", rev="c39e737", default-features = false, features = ["libcosmic", "once_cell"] }
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ pub enum Message {
|
||||||
TogglerToggled(bool),
|
TogglerToggled(bool),
|
||||||
ViewSwitcher(segmented_button::Entity),
|
ViewSwitcher(segmented_button::Entity),
|
||||||
InputChanged(String),
|
InputChanged(String),
|
||||||
|
DeleteCard(usize),
|
||||||
ClearAll,
|
ClearAll,
|
||||||
CardsToggled(bool),
|
CardsToggled(bool),
|
||||||
}
|
}
|
||||||
|
|
@ -196,6 +197,9 @@ impl State {
|
||||||
self.cards_value = v;
|
self.cards_value = v;
|
||||||
self.update_cards();
|
self.update_cards();
|
||||||
}
|
}
|
||||||
|
Message::DeleteCard(i) => {
|
||||||
|
self.cards.remove(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
|
|
@ -466,7 +470,14 @@ impl State {
|
||||||
&timeline,
|
&timeline,
|
||||||
self.cards
|
self.cards
|
||||||
.iter()
|
.iter()
|
||||||
.map(|c| column![text("test"), text(c).size(24).width(Length::Fill)].into())
|
.enumerate()
|
||||||
|
.map(|(i, c)| column![
|
||||||
|
button(cosmic::theme::Button::Text)
|
||||||
|
.text("Delete me")
|
||||||
|
.on_press(Message::DeleteCard(i)),
|
||||||
|
text(c).size(24).width(Length::Fill)
|
||||||
|
]
|
||||||
|
.into())
|
||||||
.collect(),
|
.collect(),
|
||||||
Message::ClearAll,
|
Message::ClearAll,
|
||||||
|_, e| Message::CardsToggled(e),
|
|_, e| Message::CardsToggled(e),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue