summaryrefslogtreecommitdiffstats
path: root/examples/todos.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-12-30 20:54:04 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-12-30 21:00:27 +0100
commit2ff0e48142c302cb93130164d083589bb2ac4979 (patch)
tree0abdf5892d999c0e98b42849c74cab8a619fbb5e /examples/todos.rs
parent74d01a69577065ce4152fc80b297e8816ab3deff (diff)
downloadiced-2ff0e48142c302cb93130164d083589bb2ac4979.tar.gz
iced-2ff0e48142c302cb93130164d083589bb2ac4979.tar.bz2
iced-2ff0e48142c302cb93130164d083589bb2ac4979.zip
Make `Row`, `Column`, and `Checkbox` shrink by default
Diffstat (limited to 'examples/todos.rs')
-rw-r--r--examples/todos.rs14
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,