diff options
author | 2019-12-30 20:54:04 +0100 | |
---|---|---|
committer | 2019-12-30 21:00:27 +0100 | |
commit | 2ff0e48142c302cb93130164d083589bb2ac4979 (patch) | |
tree | 0abdf5892d999c0e98b42849c74cab8a619fbb5e /examples/pokedex.rs | |
parent | 74d01a69577065ce4152fc80b297e8816ab3deff (diff) | |
download | iced-2ff0e48142c302cb93130164d083589bb2ac4979.tar.gz iced-2ff0e48142c302cb93130164d083589bb2ac4979.tar.bz2 iced-2ff0e48142c302cb93130164d083589bb2ac4979.zip |
Make `Row`, `Column`, 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]), ), |