Add previous button to installer first page

This commit is contained in:
edouardparis 2024-05-29 12:30:56 +02:00
parent 9ae33408cb
commit be343aec37
4 changed files with 14 additions and 0 deletions

View File

@ -20,6 +20,7 @@ pub enum Message {
Next,
Skip,
Previous,
BackToLauncher,
Install,
Close,
Reload,

View File

@ -73,6 +73,10 @@ impl Installer {
)
}
pub fn destination_path(&self) -> PathBuf {
self.context.data_dir.clone()
}
pub fn subscription(&self) -> Subscription<Message> {
if self.current > 0 {
self.steps

View File

@ -111,6 +111,11 @@ pub fn welcome<'a>() -> Element<'a, Message> {
.padding(20),
),
)
.push(
button::secondary(Some(icon::previous_icon()), "Change network")
.width(Length::Fixed(200.0))
.on_press(Message::BackToLauncher),
)
.push(Space::with_height(Length::Fixed(100.0)))
.spacing(50)
.align_items(Alignment::Center),

View File

@ -246,6 +246,10 @@ impl Application for GUI {
);
self.state = State::Loader(Box::new(loader));
command.map(|msg| Message::Load(Box::new(msg)))
} else if let installer::Message::BackToLauncher = *msg {
let launcher = Launcher::new(i.destination_path());
self.state = State::Launcher(Box::new(launcher));
Command::none()
} else {
i.update(*msg).map(|msg| Message::Install(Box::new(msg)))
}