text
stringlengths 0
197
|
---|
'won\'t fit the line.', |
style: big, |
), |
), |
Container(color: green, child: const Text('Goodbye!', style: big)), |
], |
) |
<code_end> |
Since Row won’t impose any constraints onto its children, |
it’s quite possible that the children might be too big to fit |
the available width of the Row. In this case, just like an |
UnconstrainedBox, the Row displays the “overflow warning”. |
<topic_end> |
<topic_start> |
Example 25 |
<code_start> |
Row( |
children: [ |
Expanded( |
child: Center( |
child: Container( |
color: red, |
child: const Text( |
'This is a very long text that won\'t fit the line.', |
style: big, |
), |
), |
), |
), |
Container(color: green, child: const Text('Goodbye!', style: big)), |
], |
) |
<code_end> |
When a Row’s child is wrapped in an Expanded widget, |
the Row won’t let this child define its own width anymore. |
Instead, it defines the Expanded width according to the |
other children, and only then the Expanded widget forces |
the original child to have the Expanded’s width. |
In other words, once you use Expanded, |
the original child’s width becomes irrelevant, and is ignored. |
<topic_end> |
<topic_start> |
Example 26 |
<code_start> |
Row( |
children: [ |
Expanded( |
child: Container( |
color: red, |
child: const Text( |
'This is a very long text that won\'t fit the line.', |
style: big, |
), |
), |
), |
Expanded( |
child: Container( |
color: green, |
child: const Text( |
'Goodbye!', |
style: big, |
), |
), |
), |
], |
) |
<code_end> |
If all of Row’s children are wrapped in Expanded widgets, |
each Expanded has a size proportional to its flex parameter, |
and only then each Expanded widget forces its child to have |
the Expanded’s width. |
In other words, Expanded ignores the preferred width of |
its children. |
<topic_end> |
<topic_start> |
Example 27 |
<code_start> |
Row( |
children: [ |
Flexible( |
child: Container( |
color: red, |
child: const Text( |
'This is a very long text that won\'t fit the line.', |
style: big, |
), |
), |
), |
Flexible( |
child: Container( |
color: green, |
child: const Text( |
'Goodbye!', |
style: big, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.