You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The docs don't warn against or protect against using 0.0 as a Flex parameter or mixing negative and positive flex parameters.
Using 0.0 as a Flex parameter causes the BoxConstraints passed into the flex children to be infinite.
If there are multiple flex children then their params all have to be negative or all positive.
If different children have a mix of positive and negative flex params then the sizes are incorrect.
Using 0.0:
let button = Label::new("Hello").center();let container = Container::new(button);let child = SizedBox::new(container).width(300.).height(300.).expand().center();Flex::column().with_flex_child(child,0.0)
These are the warnings for using 0.0
Mar 25 11:08:28.826 WARN layout: druid::box_constraints: Infinite minimum height constraint passed to Container:
Mar 25 11:08:28.827 WARN layout: druid::box_constraints: Infinite minimum height constraint passed to Align:
Mar 25 11:08:28.828 WARN layout: druid::core: Widget `druid::widget::align::Align<()>` has an infinite height.
Mar 25 11:08:28.829 WARN layout: druid::widget::sized_box: SizedBox is returning an infinite height.
Mar 25 11:08:28.829 WARN layout: druid::core: Widget `druid::widget::sized_box::SizedBox<()>` has an infinite height.
Mar 25 11:08:28.829 WARN layout: druid::widget::align: Align widget's child has an infinite height.
Mar 25 11:08:28.830 WARN layout: druid::core: Widget `druid::widget::align::Align<()>` has an infinite height.
Mar 25 11:08:28.830 WARN layout: druid::widget::flex: A non-Flex child has an infinite height.
Mixing negative and positive params like this will give incorrect sizes:
Agreed, I think either an assert or a warning + replacing with 1.0 would both be reasonable here. Since these params tend to be static and not computed I think an assert (or at least a debug assert) is reasonable? I would be happy for a PR for this.
The docs don't warn against or protect against using 0.0 as a Flex parameter or mixing negative and positive flex parameters.
BoxConstraints
passed into the flex children to be infinite.Using 0.0:
These are the warnings for using 0.0
Mixing negative and positive params like this will give incorrect sizes:
This is the warning output:
I think flex values should be forced to be greater than 0.0.
The text was updated successfully, but these errors were encountered: