From 1792d91657d88ce85fed30cf55b610f96df19c9a Mon Sep 17 00:00:00 2001 From: Andrew Mackenzie Date: Thu, 31 Aug 2023 13:02:48 +0200 Subject: [PATCH] Use iced_aw 0.70.0 (#2016) * Use iced_aw 0.70.0 Should have the fixes I need * Adapt to new modal API --- flowr/Cargo.toml | 2 +- flowr/src/bin/flowrgui/main.rs | 37 ++++++++++++++++++---------------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/flowr/Cargo.toml b/flowr/Cargo.toml index 052153e175..6d767276db 100644 --- a/flowr/Cargo.toml +++ b/flowr/Cargo.toml @@ -65,7 +65,7 @@ wasmtime = { version = "12.0.1", default-features = false, features = ["cranelif # for flowrgui iced = { version = "0.10.0", features = ["canvas", "tokio", "debug", "image"] } -iced_aw = { version = "0.6.0", git = "https://github.com/iced-rs/iced_aw.git", branch="main", default-features = false, features = ["tabs", "card", "modal",] } +iced_aw = { version = "0.7.0", default-features = false, features = ["tabs", "card", "modal",] } iced_native = "0.10.3" once_cell = "1.18.0" tokio = { version = "1", features = ["sync"] } diff --git a/flowr/src/bin/flowrgui/main.rs b/flowr/src/bin/flowrgui/main.rs index 0a6e251ab7..db9bb9f727 100644 --- a/flowr/src/bin/flowrgui/main.rs +++ b/flowr/src/bin/flowrgui/main.rs @@ -236,31 +236,34 @@ impl Application for FlowrGui { } fn view(&self) -> Element<'_, Message> { - let mut main = Column::new().spacing(10); - - main = main + let main = Column::new().spacing(10) .push(self.command_row()) .push(self.tab_set.view()) .push(self.status_row()) .padding(10); - modal(self.show_modal, main, - Card::new( + let overlay = if self.show_modal { + Some(Card::new( Text::new(self.modal_content.clone().0), Text::new(self.modal_content.clone().1), ) - .foot( - Row::new() - .spacing(10) - .padding(5) - .width(Length::Fill) - .push( - Button::new(Text::new("OK") - .horizontal_alignment(Horizontal::Center)) - .width(Length::Fill) - .on_press(Message::CloseModal)), - ) - .max_width(300.0)) + .foot( + Row::new() + .spacing(10) + .padding(5) + .width(Length::Fill) + .push( + Button::new(Text::new("OK") + .horizontal_alignment(Horizontal::Center)) + .width(Length::Fill) + .on_press(Message::CloseModal)), + ) + .max_width(300.0)) + } else { + None + }; + + modal(main, overlay) .backdrop(Message::CloseModal) .on_esc(Message::CloseModal) .into()