diff options
author | 2020-01-09 01:51:53 +0100 | |
---|---|---|
committer | 2020-01-09 01:51:53 +0100 | |
commit | 6699329d3f91c5b9d8e8e55ad88de24bd3894955 (patch) | |
tree | c41ab304ffaf2dc2311c7d33916cd0515114ad31 /examples/pokedex.rs | |
parent | cc529a1803972604b122c19c0104e71532fff993 (diff) | |
parent | a4e833e860c41796d491ab43e84239fcca1f303d (diff) | |
download | iced-6699329d3f91c5b9d8e8e55ad88de24bd3894955.tar.gz iced-6699329d3f91c5b9d8e8e55ad88de24bd3894955.tar.bz2 iced-6699329d3f91c5b9d8e8e55ad88de24bd3894955.zip |
Merge pull request #139 from hecrj/feature/shrink-by-default
Make `Row`, `Column`, `Text`, and `Checkbox` shrink by default
Diffstat (limited to 'examples/pokedex.rs')
-rw-r--r-- | examples/pokedex.rs | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/examples/pokedex.rs b/examples/pokedex.rs index 2d595ec4..f44b6163 100644 --- a/examples/pokedex.rs +++ b/examples/pokedex.rs @@ -77,11 +77,8 @@ impl Application for Pokedex { fn view(&mut self) -> Element<Message> { let content = match self { - Pokedex::Loading => Column::new().width(Length::Shrink).push( - Text::new("Searching for Pokémon...") - .width(Length::Shrink) - .size(40), - ), + Pokedex::Loading => Column::new() + .push(Text::new("Searching for Pokémon...").size(40)), Pokedex::Loaded { pokemon, search } => Column::new() .max_width(500) .spacing(20) @@ -91,14 +88,9 @@ impl Application for Pokedex { button(search, "Keep searching!").on_press(Message::Search), ), Pokedex::Errored { try_again, .. } => Column::new() - .width(Length::Shrink) .spacing(20) .align_items(Align::End) - .push( - Text::new("Whoops! Something went wrong...") - .width(Length::Shrink) - .size(40), - ) + .push(Text::new("Whoops! Something went wrong...").size(40)) .push(button(try_again, "Try again").on_press(Message::Search)), }; @@ -134,10 +126,13 @@ impl Pokemon { Row::new() .align_items(Align::Center) .spacing(20) - .push(Text::new(&self.name).size(30)) + .push( + Text::new(&self.name) + .size(30) + .width(Length::Fill), + ) .push( Text::new(format!("#{}", self.number)) - .width(Length::Shrink) .size(20) .color([0.5, 0.5, 0.5]), ), |