diff options
author | 2020-01-09 01:51:53 +0100 | |
---|---|---|
committer | 2020-01-09 01:51:53 +0100 | |
commit | 6699329d3f91c5b9d8e8e55ad88de24bd3894955 (patch) | |
tree | c41ab304ffaf2dc2311c7d33916cd0515114ad31 /examples/todos.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/todos.rs')
-rw-r--r-- | examples/todos.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/examples/todos.rs b/examples/todos.rs index 42e88f65..f5f2f459 100644 --- a/examples/todos.rs +++ b/examples/todos.rs @@ -146,6 +146,7 @@ impl Application for Todos { .. }) => { let title = Text::new("todos") + .width(Length::Fill) .size(100) .color([0.5, 0.5, 0.5]) .horizontal_alignment(HorizontalAlignment::Center); @@ -284,7 +285,8 @@ impl Task { self.completed, &self.description, TaskMessage::Completed, - ); + ) + .width(Length::Fill); Row::new() .spacing(20) @@ -323,11 +325,7 @@ impl Task { Row::new() .spacing(10) .push(delete_icon().color(Color::WHITE)) - .push( - Text::new("Delete") - .width(Length::Shrink) - .color(Color::WHITE), - ), + .push(Text::new("Delete").color(Color::WHITE)), ) .on_press(TaskMessage::Delete) .padding(10) @@ -358,7 +356,7 @@ impl Controls { let tasks_left = tasks.iter().filter(|task| !task.completed).count(); let filter_button = |state, label, filter, current_filter| { - let label = Text::new(label).size(16).width(Length::Shrink); + let label = Text::new(label).size(16); let button = if filter == current_filter { Button::new(state, label.color(Color::WHITE)) .background(Color::from_rgb(0.2, 0.2, 0.7)) @@ -381,11 +379,11 @@ impl Controls { tasks_left, if tasks_left == 1 { "task" } else { "tasks" } )) + .width(Length::Fill) .size(16), ) .push( Row::new() - .width(Length::Shrink) .spacing(10) .push(filter_button( all_button, |