Skip to content

Commit

Permalink
examples/download_progress: add 'Start again' button on_press
Browse files Browse the repository at this point in the history
The `on_press` handler was not defined for the 'Start again' button,
so the button was inactive after a download completion.
  • Loading branch information
fengalin committed Dec 9, 2022
1 parent e2f968e commit 043b691
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions examples/download_progress/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,13 @@ impl Download {
State::Idle => button("Start the download!")
.on_press(Message::Download(self.id))
.into(),
State::Finished => {
column!["Download finished!", button("Start again")]
.spacing(10)
.align_items(Alignment::Center)
.into()
}
State::Finished => column![
"Download finished!",
button("Start again").on_press(Message::Download(self.id)),
]
.spacing(10)
.align_items(Alignment::Center)
.into(),
State::Downloading { .. } => {
text(format!("Downloading... {:.2}%", current_progress)).into()
}
Expand Down

0 comments on commit 043b691

Please sign in to comment.