feat: put the bars together
this made sense now that I made error messages shorter, and figured out how to properly align things in a row. looks good! might even consider keeping the infobar on by default
This commit is contained in:
parent
6fa0e29eae
commit
808a8bf31d
1 changed files with 16 additions and 7 deletions
23
src/main.rs
23
src/main.rs
|
|
@ -50,9 +50,7 @@ impl State {
|
||||||
(state, Task::none())
|
(state, Task::none())
|
||||||
}
|
}
|
||||||
fn view(&self) -> Element<'_, Message, Theme, Renderer> {
|
fn view(&self) -> Element<'_, Message, Theme, Renderer> {
|
||||||
let mut main = Vec::new();
|
let main = self.image_display.as_ref().map_or_else(
|
||||||
|
|
||||||
main.push(self.image_display.as_ref().map_or_else(
|
|
||||||
|| {
|
|| {
|
||||||
widget::container(widget::text(include_str!("usage.txt")))
|
widget::container(widget::text(include_str!("usage.txt")))
|
||||||
.height(Length::Fill)
|
.height(Length::Fill)
|
||||||
|
|
@ -70,16 +68,27 @@ impl State {
|
||||||
.height(Length::Fill)
|
.height(Length::Fill)
|
||||||
.into()
|
.into()
|
||||||
},
|
},
|
||||||
));
|
);
|
||||||
|
|
||||||
|
let mut bar = Vec::new();
|
||||||
if let Some(error) = self.error.as_ref() {
|
if let Some(error) = self.error.as_ref() {
|
||||||
main.push(widget::text(error).style(widget::text::danger).into());
|
bar.push(
|
||||||
|
widget::container(widget::text(error).style(widget::text::danger))
|
||||||
|
.align_x(Alignment::Start)
|
||||||
|
.width(Length::Fill)
|
||||||
|
.into(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if self.infobar_shown && self.info.is_some() {
|
if self.infobar_shown && self.info.is_some() {
|
||||||
main.push(widget::text(self.title()).into());
|
bar.push(
|
||||||
|
widget::container(widget::text(self.title()))
|
||||||
|
.align_x(Alignment::End)
|
||||||
|
.width(Length::Fill)
|
||||||
|
.into(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::column(main).into()
|
widget::column([main, widget::row(bar).into()]).into()
|
||||||
}
|
}
|
||||||
fn update(&mut self, message: Message) -> Task<Message> {
|
fn update(&mut self, message: Message) -> Task<Message> {
|
||||||
match message {
|
match message {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue