From 2ff0e48142c302cb93130164d083589bb2ac4979 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 30 Dec 2019 20:54:04 +0100 Subject: Make `Row`, `Column`, and `Checkbox` shrink by default --- native/src/widget/checkbox.rs | 2 +- native/src/widget/column.rs | 2 +- native/src/widget/radio.rs | 1 + native/src/widget/row.rs | 2 +- native/src/widget/svg.rs | 2 +- native/src/widget/text.rs | 2 +- native/src/widget/text_input.rs | 4 ++-- 7 files changed, 8 insertions(+), 7 deletions(-) (limited to 'native/src') diff --git a/native/src/widget/checkbox.rs b/native/src/widget/checkbox.rs index 0dcac712..06a484c7 100644 --- a/native/src/widget/checkbox.rs +++ b/native/src/widget/checkbox.rs @@ -54,7 +54,7 @@ impl Checkbox { on_toggle: Box::new(f), label: String::from(label), label_color: None, - width: Length::Fill, + width: Length::Shrink, } } diff --git a/native/src/widget/column.rs b/native/src/widget/column.rs index 4b5d631c..0901bff4 100644 --- a/native/src/widget/column.rs +++ b/native/src/widget/column.rs @@ -33,7 +33,7 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> { Column { spacing: 0, padding: 0, - width: Length::Fill, + width: Length::Shrink, height: Length::Shrink, max_width: u32::MAX, max_height: u32::MAX, diff --git a/native/src/widget/radio.rs b/native/src/widget/radio.rs index a9995b86..876f4f48 100644 --- a/native/src/widget/radio.rs +++ b/native/src/widget/radio.rs @@ -95,6 +95,7 @@ where let size = self::Renderer::default_size(renderer); Row::<(), Renderer>::new() + .width(Length::Fill) .spacing(15) .align_items(Align::Center) .push( diff --git a/native/src/widget/row.rs b/native/src/widget/row.rs index 3de65deb..7d951968 100644 --- a/native/src/widget/row.rs +++ b/native/src/widget/row.rs @@ -33,7 +33,7 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> { Row { spacing: 0, padding: 0, - width: Length::Fill, + width: Length::Shrink, height: Length::Shrink, max_width: u32::MAX, max_height: u32::MAX, diff --git a/native/src/widget/svg.rs b/native/src/widget/svg.rs index 9580f195..25587ffa 100644 --- a/native/src/widget/svg.rs +++ b/native/src/widget/svg.rs @@ -30,7 +30,7 @@ impl Svg { Svg { handle: handle.into(), width: Length::Fill, - height: Length::Fill, + height: Length::Shrink, } } diff --git a/native/src/widget/text.rs b/native/src/widget/text.rs index cf9c9565..caa81db0 100644 --- a/native/src/widget/text.rs +++ b/native/src/widget/text.rs @@ -41,7 +41,7 @@ impl Text { size: None, color: None, font: Font::Default, - width: Length::Fill, + width: Length::Shrink, height: Length::Shrink, horizontal_alignment: HorizontalAlignment::Left, vertical_alignment: VerticalAlignment::Top, diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index 1d1c32a2..d3c45fba 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -64,11 +64,11 @@ impl<'a, Message> TextInput<'a, Message> { placeholder: &str, value: &str, on_change: F, - ) -> Self + ) -> TextInput<'a, Message> where F: 'static + Fn(String) -> Message, { - Self { + TextInput { state, placeholder: String::from(placeholder), value: Value::new(value), -- cgit