Rename Flexible to Expanded and improve docs (#6978)

This patch replaces uses of Flexible with Expanded where we're using
FlexFit.tight. We still need to think of a better name for the
FlexFit.loose variant.

Also, improve the docs for Row, Column, Flex, and RenderFlex to be more
problem-oriented and to give a complete account of the layout algorithn.

Fixes #6960
Fixes #5169
This commit is contained in:
Adam Barth
2016-11-21 23:16:43 -08:00
committed by GitHub
parent a0c567f751
commit 8ca4caa440
48 changed files with 300 additions and 198 deletions

View File

@@ -213,7 +213,7 @@ class CardCollectionState extends State<CardCollection> {
onPressed: enabled ? callback : null,
child: new Row(
children: <Widget>[
new Flexible(child: new Text(label)),
new Expanded(child: new Text(label)),
new Checkbox(
value: value,
onChanged: enabled ? (_) { callback(); } : null
@@ -229,7 +229,7 @@ class CardCollectionState extends State<CardCollection> {
onPressed: enabled ? () { onChanged(itemValue); } : null,
child: new Row(
children: <Widget>[
new Flexible(child: new Text(label)),
new Expanded(child: new Text(label)),
new Radio<Map<int, Color>>(
value: itemValue,
groupValue: currentValue,
@@ -246,7 +246,7 @@ class CardCollectionState extends State<CardCollection> {
onPressed: enabled ? () { onChanged(itemValue); } : null,
child: new Row(
children: <Widget>[
new Flexible(child: new Text(label)),
new Expanded(child: new Text(label)),
new Radio<DismissDirection>(
value: itemValue,
groupValue: currentValue,
@@ -263,7 +263,7 @@ class CardCollectionState extends State<CardCollection> {
onPressed: enabled ? () { onChanged(itemValue); } : null,
child: new Row(
children: <Widget>[
new Flexible(child: new Text(label)),
new Expanded(child: new Text(label)),
new Radio<TextAlign>(
value: itemValue,
groupValue: currentValue,
@@ -374,7 +374,7 @@ class CardCollectionState extends State<CardCollection> {
child: new Row(
children: <Widget>[
leftArrowIcon,
new Flexible(
new Expanded(
child: new Text(backgroundMessage,
style: backgroundTextStyle,
textAlign: TextAlign.center

View File

@@ -242,8 +242,10 @@ class DragAndDropAppState extends State<DragAndDropApp> {
),
body: new Column(
children: <Widget>[
new Flexible(
new Expanded(
child: new Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
new ExampleDragSource(
color: Colors.yellow[300],
@@ -264,28 +266,26 @@ class DragAndDropAppState extends State<DragAndDropApp> {
child: new Text('above')
),
],
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceAround
)
),
new Flexible(
new Expanded(
child: new Row(
children: <Widget>[
new Flexible(child: new ExampleDragTarget()),
new Flexible(child: new ExampleDragTarget()),
new Flexible(child: new ExampleDragTarget()),
new Flexible(child: new ExampleDragTarget()),
new Expanded(child: new ExampleDragTarget()),
new Expanded(child: new ExampleDragTarget()),
new Expanded(child: new ExampleDragTarget()),
new Expanded(child: new ExampleDragTarget()),
]
)
),
new Flexible(
new Expanded(
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
new MovableBall(1, position, moveBall),
new MovableBall(2, position, moveBall),
new MovableBall(3, position, moveBall),
],
mainAxisAlignment: MainAxisAlignment.spaceAround
)
),
]

View File

@@ -102,7 +102,7 @@ class PageableListAppState extends State<PageableListApp> {
onPressed: toggleItemsWrap,
child: new Row(
children: <Widget>[
new Flexible(child: new Text('Scrolling wraps around')),
new Expanded(child: new Text('Scrolling wraps around')),
// TODO(abarth): Actually make this checkbox change this value.
new Checkbox(value: itemsWrap, onChanged: null)
]