summaryrefslogtreecommitdiffstats
path: root/examples/todos/src
diff options
context:
space:
mode:
Diffstat (limited to 'examples/todos/src')
-rw-r--r--examples/todos/src/main.rs25
1 files changed, 12 insertions, 13 deletions
diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs
index 4dac032c..3d79f087 100644
--- a/examples/todos/src/main.rs
+++ b/examples/todos/src/main.rs
@@ -254,27 +254,27 @@ impl Application for Todos {
.spacing(20)
.max_width(800);
- scrollable(
- container(content)
- .width(Length::Fill)
- .padding(40)
- .center_x(),
- )
- .into()
+ scrollable(container(content).padding(40).center_x()).into()
}
}
}
fn subscription(&self) -> Subscription<Message> {
- keyboard::on_key_press(|key_code, modifiers| {
- match (key_code, modifiers) {
- (keyboard::KeyCode::Tab, _) => Some(Message::TabPressed {
+ use keyboard::key;
+
+ keyboard::on_key_press(|key, modifiers| {
+ let keyboard::Key::Named(key) = key else {
+ return None;
+ };
+
+ match (key, modifiers) {
+ (key::Named::Tab, _) => Some(Message::TabPressed {
shift: modifiers.shift(),
}),
- (keyboard::KeyCode::Up, keyboard::Modifiers::SHIFT) => {
+ (key::Named::ArrowUp, keyboard::Modifiers::SHIFT) => {
Some(Message::ToggleFullscreen(window::Mode::Fullscreen))
}
- (keyboard::KeyCode::Down, keyboard::Modifiers::SHIFT) => {
+ (key::Named::ArrowDown, keyboard::Modifiers::SHIFT) => {
Some(Message::ToggleFullscreen(window::Mode::Windowed))
}
_ => None,
@@ -472,7 +472,6 @@ fn empty_message(message: &str) -> Element<'_, Message> {
.horizontal_alignment(alignment::Horizontal::Center)
.style(Color::from([0.7, 0.7, 0.7])),
)
- .width(Length::Fill)
.height(200)
.center_y()
.into()