Commit d5b2e2a0 authored by Adam Barth's avatar Adam Barth

[rename fixit] Flex alignments

* justifyContent -> mainAxisAlignment
* alignItems -> crossAxisAlignment
* FlexJustifyContent -> MainAxisAlignment
* FlexAlignItems -> CrossAxisAlignment

Fixes #231
parent 5e1af2f3
......@@ -325,8 +325,8 @@ class CardCollectionState extends State<CardCollection> {
children: <Widget>[
new Text(cardModel.inputValue.text)
],
alignItems: FlexAlignItems.stretch,
justifyContent: FlexJustifyContent.center
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center
)
)
)
......
......@@ -250,8 +250,8 @@ class DragAndDropAppState extends State<DragAndDropApp> {
child: new Text('above')
),
],
alignItems: FlexAlignItems.center,
justifyContent: FlexJustifyContent.spaceAround
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceAround
)
),
new Flexible(
......@@ -271,7 +271,7 @@ class DragAndDropAppState extends State<DragAndDropApp> {
new MovableBall(2, position, moveBall),
new MovableBall(3, position, moveBall),
],
justifyContent: FlexJustifyContent.spaceAround
mainAxisAlignment: MainAxisAlignment.spaceAround
)
),
]
......
......@@ -182,7 +182,7 @@ class Launcher extends StatelessWidget {
Widget build(BuildContext context) {
return new Row(
justifyContent: FlexJustifyContent.center,
mainAxisAlignment: MainAxisAlignment.center,
children: items
);
}
......
......@@ -67,7 +67,7 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
new Text('${_event.type}', style: Typography.black.body2),
new Text('${_event.keyData.keyCode}', style: Typography.black.display4)
],
justifyContent: FlexJustifyContent.center
mainAxisAlignment: MainAxisAlignment.center
);
}
return new RawKeyboardListener(
......
......@@ -12,11 +12,11 @@ import 'src/solid_color_box.dart';
void main() {
RenderFlex table = new RenderFlex(direction: FlexDirection.vertical);
void addAlignmentRow(FlexAlignItems alignItems) {
void addAlignmentRow(CrossAxisAlignment crossAxisAlignment) {
TextStyle style = const TextStyle(color: const Color(0xFF000000));
RenderParagraph paragraph = new RenderParagraph(new TextSpan(style: style, text: '$alignItems'));
RenderParagraph paragraph = new RenderParagraph(new TextSpan(style: style, text: '$crossAxisAlignment'));
table.add(new RenderPadding(child: paragraph, padding: new EdgeInsets.only(top: 20.0)));
RenderFlex row = new RenderFlex(alignItems: alignItems, textBaseline: TextBaseline.alphabetic);
RenderFlex row = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic);
style = new TextStyle(fontSize: 15.0, color: const Color(0xFF000000));
row.add(new RenderDecoratedBox(
decoration: new BoxDecoration(backgroundColor: const Color(0x7FFFCCCC)),
......@@ -27,7 +27,7 @@ void main() {
decoration: new BoxDecoration(backgroundColor: const Color(0x7FCCFFCC)),
child: new RenderParagraph(new TextSpan(style: style, text: 'foo foo foo'))
));
RenderFlex subrow = new RenderFlex(alignItems: alignItems, textBaseline: TextBaseline.alphabetic);
RenderFlex subrow = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic);
style = new TextStyle(fontSize: 25.0, color: const Color(0xFF000000));
subrow.add(new RenderDecoratedBox(
decoration: new BoxDecoration(backgroundColor: const Color(0x7FCCCCFF)),
......@@ -40,13 +40,13 @@ void main() {
rowParentData.flex = 1;
}
addAlignmentRow(FlexAlignItems.start);
addAlignmentRow(FlexAlignItems.end);
addAlignmentRow(FlexAlignItems.center);
addAlignmentRow(FlexAlignItems.stretch);
addAlignmentRow(FlexAlignItems.baseline);
addAlignmentRow(CrossAxisAlignment.start);
addAlignmentRow(CrossAxisAlignment.end);
addAlignmentRow(CrossAxisAlignment.center);
addAlignmentRow(CrossAxisAlignment.stretch);
addAlignmentRow(CrossAxisAlignment.baseline);
void addJustificationRow(FlexJustifyContent justify) {
void addJustificationRow(MainAxisAlignment justify) {
const TextStyle style = const TextStyle(color: const Color(0xFF000000));
RenderParagraph paragraph = new RenderParagraph(new TextSpan(style: style, text: '$justify'));
table.add(new RenderPadding(child: paragraph, padding: new EdgeInsets.only(top: 20.0)));
......@@ -54,17 +54,17 @@ void main() {
row.add(new RenderSolidColorBox(const Color(0xFFFFCCCC), desiredSize: new Size(80.0, 60.0)));
row.add(new RenderSolidColorBox(const Color(0xFFCCFFCC), desiredSize: new Size(64.0, 60.0)));
row.add(new RenderSolidColorBox(const Color(0xFFCCCCFF), desiredSize: new Size(160.0, 60.0)));
row.justifyContent = justify;
row.mainAxisAlignment = justify;
table.add(row);
final FlexParentData rowParentData = row.parentData;
rowParentData.flex = 1;
}
addJustificationRow(FlexJustifyContent.start);
addJustificationRow(FlexJustifyContent.end);
addJustificationRow(FlexJustifyContent.center);
addJustificationRow(FlexJustifyContent.spaceBetween);
addJustificationRow(FlexJustifyContent.spaceAround);
addJustificationRow(MainAxisAlignment.start);
addJustificationRow(MainAxisAlignment.end);
addJustificationRow(MainAxisAlignment.center);
addJustificationRow(MainAxisAlignment.spaceBetween);
addJustificationRow(MainAxisAlignment.spaceAround);
RenderDecoratedBox root = new RenderDecoratedBox(
decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)),
......
......@@ -201,7 +201,7 @@ class _GestureDemoState extends State<GestureDemo> {
]
),
],
alignItems: FlexAlignItems.start
crossAxisAlignment: CrossAxisAlignment.start
)
)
)
......
......@@ -126,7 +126,7 @@ class SectorAppState extends State<SectorApp> {
)
),
],
justifyContent: FlexJustifyContent.spaceAround
mainAxisAlignment: MainAxisAlignment.spaceAround
)
),
new Flexible(
......@@ -143,7 +143,7 @@ class SectorAppState extends State<SectorApp> {
)
),
],
justifyContent: FlexJustifyContent.spaceBetween
mainAxisAlignment: MainAxisAlignment.spaceBetween
);
}
......
......@@ -58,13 +58,13 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
),
new CircularProgressIndicator(value: value),
],
justifyContent: FlexJustifyContent.spaceAround
mainAxisAlignment: MainAxisAlignment.spaceAround
)
)
),
new Rectangle(const Color(0xFFFFFF00)),
],
justifyContent: FlexJustifyContent.spaceBetween
mainAxisAlignment: MainAxisAlignment.spaceBetween
)
)
).attachToRenderTree(element);
......
......@@ -107,8 +107,8 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
padding: new EdgeInsets.symmetric(horizontal: 8.0),
child: new Column(
children: children,
justifyContent: FlexJustifyContent.center,
alignItems: FlexAlignItems.start
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start
)
)
);
......
......@@ -179,7 +179,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
builder: (BuildContext context) {
final TextStyle textStyle = Theme.of(context).textTheme.caption.copyWith(fontSize: 16.0);
return new Column(
alignItems: FlexAlignItems.stretch,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
demo.builder(context),
new Padding(
......
......@@ -82,8 +82,8 @@ class TravelDestinationItem extends StatelessWidget {
child: new Padding(
padding: const EdgeInsets.all(16.0),
child: new Column(
justifyContent: FlexJustifyContent.start,
alignItems: FlexAlignItems.start,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
// three line description
new Text(destination.description[0], style: descriptionStyle),
......@@ -92,8 +92,8 @@ class TravelDestinationItem extends StatelessWidget {
// share, explore buttons
new Flexible(
child: new Row(
justifyContent: FlexJustifyContent.start,
alignItems: FlexAlignItems.end,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
new Padding(
padding: const EdgeInsets.only(right: 16.0),
......
......@@ -60,8 +60,8 @@ class ColorItem extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 16.0),
decoration: new BoxDecoration(backgroundColor: color),
child: new Row(
justifyContent: FlexJustifyContent.spaceBetween,
alignItems: FlexAlignItems.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
new Text('$prefix$index'),
new Text(colorString())
......
......@@ -40,7 +40,7 @@ class _DatePickerDemoState extends State<DatePickerDemo> {
child: new Text('SELECT DATE')
),
],
justifyContent: FlexJustifyContent.center
mainAxisAlignment: MainAxisAlignment.center
)
);
}
......
......@@ -34,8 +34,8 @@ class DialogDemoItem extends StatelessWidget {
child: new Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: new Row(
justifyContent: FlexJustifyContent.start,
alignItems: FlexAlignItems.center,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
new Icon(
size: 36.0,
......
......@@ -93,7 +93,7 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
return new Material(
child: new Column(
justifyContent: FlexJustifyContent.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Flexible(
child: new Container(
......@@ -108,7 +108,7 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
new Padding(
padding: new EdgeInsets.only(top: 20.0, bottom: 20.0),
child: new Row(
justifyContent: FlexJustifyContent.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
_createInfoPanelCell(Icons.accessibility, '$count', 'COUNT'),
_createInfoPanelCell(Icons.timer, _formatSeconds(time), 'TIME'),
......
......@@ -47,7 +47,7 @@ class _ContactItem extends StatelessWidget {
List<Widget> rowChildren = <Widget>[
new Column(
alignItems: FlexAlignItems.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: columnChildren
)
];
......@@ -60,7 +60,7 @@ class _ContactItem extends StatelessWidget {
return new Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: new Row(
justifyContent: FlexJustifyContent.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: rowChildren
)
);
......
......@@ -53,7 +53,7 @@ class DateTimeItem extends StatelessWidget {
});
},
child: new Row(
justifyContent: FlexJustifyContent.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
new Text(new DateFormat('EEE, MMM d yyyy').format(date)),
new Icon(icon: Icons.arrow_drop_down, color: Colors.black54),
......@@ -160,8 +160,8 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
padding: const EdgeInsets.all(16.0),
child: new ScrollableViewport(
child: new Column(
alignItems: FlexAlignItems.stretch,
justifyContent: FlexJustifyContent.collapse,
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.collapse,
children: <Widget>[
new Container(
padding: const EdgeInsets.symmetric(vertical: 8.0),
......@@ -184,8 +184,8 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
)
),
new Column(
alignItems: FlexAlignItems.stretch,
justifyContent: FlexJustifyContent.end,
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
new Text('From', style: theme.textTheme.caption),
new DateTimeItem(
......@@ -200,8 +200,8 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
]
),
new Column(
alignItems: FlexAlignItems.stretch,
justifyContent: FlexJustifyContent.end,
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
new Text('To', style: theme.textTheme.caption),
new DateTimeItem(
......
......@@ -76,13 +76,13 @@ class IconsDemoState extends State<IconsDemo> {
child: new Column(
children: <Widget>[
new Row(
justifyContent: FlexJustifyContent.spaceBetween,
alignItems: FlexAlignItems.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
new Flexible(
flex: 0,
child: new Column(
alignItems: FlexAlignItems.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
new Text('Size', style: textStyle),
buildSizeLabel(18, textStyle),
......@@ -94,7 +94,7 @@ class IconsDemoState extends State<IconsDemo> {
),
new Flexible(
child: new Column(
alignItems: FlexAlignItems.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
new Text('Enabled', style: textStyle),
buildIconButton(18.0, Icons.face, true),
......@@ -106,7 +106,7 @@ class IconsDemoState extends State<IconsDemo> {
),
new Flexible(
child: new Column(
alignItems: FlexAlignItems.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
new Text('Disabled', style: textStyle),
buildIconButton(18.0, Icons.face, false),
......@@ -123,7 +123,7 @@ class IconsDemoState extends State<IconsDemo> {
child: new IconTheme(
data: new IconThemeData(opacity: 1.0),
child: new Row(
justifyContent: FlexJustifyContent.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Icon(
icon: Icons.brightness_7,
......
......@@ -44,8 +44,8 @@ class ListDemoState extends State<ListDemo> {
border: new Border(top: new BorderSide(color: Colors.black26, width: 1.0))
),
child: new Column(
justifyContent: FlexJustifyContent.collapse,
alignItems: FlexAlignItems.stretch,
mainAxisAlignment: MainAxisAlignment.collapse,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
new ListItem(
dense: true,
......
......@@ -49,7 +49,7 @@ class PageSelectorDemo extends StatelessWidget {
tooltip: 'Forward'
)
],
justifyContent: FlexJustifyContent.spaceBetween
mainAxisAlignment: MainAxisAlignment.spaceBetween
)
),
new Flexible(
......
......@@ -77,7 +77,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> {
children: indicators
.map((Widget c) => new Container(child: c, margin: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0)))
.toList(),
justifyContent: FlexJustifyContent.center
mainAxisAlignment: MainAxisAlignment.center
);
}
......
......@@ -28,7 +28,7 @@ class _BarGraphic extends StatelessWidget {
child: new DefaultTextStyle(
style: Theme.of(context).textTheme.body1.copyWith(color: Colors.white),
child: new Row(
justifyContent: FlexJustifyContent.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
new Text(leftText),
new Text(rightText)
......@@ -92,7 +92,7 @@ class _TechniqueItem extends StatelessWidget {
child: new Padding(
padding: const EdgeInsets.all(16.0),
child: new Row(
justifyContent: FlexJustifyContent.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children :<Widget>[
new Text(titleText),
new Column(children: barGraphics)
......
......@@ -35,7 +35,7 @@ class _SliderDemoState extends State<SliderDemo> {
child: new Text(_value.round().toString().padLeft(3, '0'))
),
],
justifyContent: FlexJustifyContent.collapse
mainAxisAlignment: MainAxisAlignment.collapse
)
)
),
......@@ -51,7 +51,7 @@ class _SliderDemoState extends State<SliderDemo> {
child: new Text((_value / 100.0).toStringAsFixed(2))
),
],
justifyContent: FlexJustifyContent.collapse
mainAxisAlignment: MainAxisAlignment.collapse
)
)
)
......
......@@ -85,7 +85,7 @@ class TextFieldDemoState extends State<TextFieldDemo> {
onSubmitted: _handleInputSubmitted
),
new Row(
alignItems: FlexAlignItems.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Flexible(
child: new Input(
......
......@@ -36,7 +36,7 @@ class _TimePickerDemoState extends State<TimePickerDemo> {
child: new Text('SELECT TIME')
),
],
justifyContent: FlexJustifyContent.center
mainAxisAlignment: MainAxisAlignment.center
)
);
}
......
......@@ -42,7 +42,7 @@ class _ToggleControlsDemoState extends State<ToggleControlsDemo> {
new Checkbox(value: false), // Disabled
new Checkbox(value: true), // Disabled
],
justifyContent: FlexJustifyContent.spaceAround
mainAxisAlignment: MainAxisAlignment.spaceAround
),
new Row(
children: <int>[0, 1, 2].map((int i) {
......@@ -52,13 +52,13 @@ class _ToggleControlsDemoState extends State<ToggleControlsDemo> {
onChanged: _setRadioValue
);
}).toList(),
justifyContent: FlexJustifyContent.spaceAround
mainAxisAlignment: MainAxisAlignment.spaceAround
),
new Row(
children: <int>[0, 1].map((int i) {
return new Radio<int>(value: i, groupValue: 0); // Disabled
}).toList(),
justifyContent: FlexJustifyContent.spaceAround
mainAxisAlignment: MainAxisAlignment.spaceAround
),
new Row(
children: <Widget>[
......@@ -66,10 +66,10 @@ class _ToggleControlsDemoState extends State<ToggleControlsDemo> {
new Switch(value: false), // Disabled
new Switch(value: true), // Disabled
],
justifyContent: FlexJustifyContent.spaceAround
mainAxisAlignment: MainAxisAlignment.spaceAround
),
],
justifyContent: FlexJustifyContent.spaceAround
mainAxisAlignment: MainAxisAlignment.spaceAround
)
);
}
......
......@@ -19,7 +19,7 @@ class TooltipDemo extends StatelessWidget {
body: new Builder(
builder: (BuildContext context) {
return new Column(
alignItems: FlexAlignItems.stretch,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
new Text(_introText, style: theme.textTheme.subhead),
new Row(
......
......@@ -22,7 +22,7 @@ class TextStyleItem extends StatelessWidget {
return new Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 16.0),
child: new Row(
alignItems: FlexAlignItems.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new SizedBox(
width: 64.0,
......
......@@ -83,7 +83,7 @@ class _WeatherDemoState extends State<WeatherDemo> {
new Align(
alignment: new FractionalOffset(0.5, 0.8),
child: new Row(
justifyContent: FlexJustifyContent.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new WeatherButton(
onPressed: () {
......
......@@ -102,7 +102,7 @@ class StockRow extends StatelessWidget {
)
),
],
alignItems: FlexAlignItems.baseline,
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: DefaultTextStyle.of(context).textBaseline
)
),
......
......@@ -37,7 +37,7 @@ class StockSymbolView extends StatelessWidget {
child: new StockArrow(percentChange: stock.percentChange)
),
],
justifyContent: FlexJustifyContent.spaceBetween
mainAxisAlignment: MainAxisAlignment.spaceBetween
),
new Text('Last Sale', style: headings),
new Text('$lastSale ($changeInPrice)'),
......@@ -60,7 +60,7 @@ class StockSymbolView extends StatelessWidget {
)
),
],
justifyContent: FlexJustifyContent.collapse
mainAxisAlignment: MainAxisAlignment.collapse
)
);
}
......
......@@ -142,7 +142,7 @@ class AppBar extends StatelessWidget {
Widget appBar = toolBar;
if (tabBar != null) {
appBar = new Column(
justifyContent: FlexJustifyContent.collapse,
mainAxisAlignment: MainAxisAlignment.collapse,
children: <Widget>[toolBar, tabBar]
);
} else if (flexibleSpace != null) {
......
......@@ -87,7 +87,7 @@ class Chip extends StatelessWidget {
),
child: new Row(
children: children,
justifyContent: FlexJustifyContent.collapse
mainAxisAlignment: MainAxisAlignment.collapse
)
)
);
......
......@@ -98,7 +98,7 @@ class _DatePickerState extends State<DatePicker> {
child: picker
)
],
alignItems: FlexAlignItems.stretch
crossAxisAlignment: CrossAxisAlignment.stretch
);
}
......@@ -197,7 +197,7 @@ class DayPicker extends StatelessWidget {
new Text(new DateFormat("MMMM y").format(displayedMonth), style: monthStyle),
new Flex(
children: headers,
justifyContent: FlexJustifyContent.spaceAround
mainAxisAlignment: MainAxisAlignment.spaceAround
)
];
int year = displayedMonth.year;
......
......@@ -90,7 +90,7 @@ class Dialog extends StatelessWidget {
child: new Container(
child: new Row(
children: actions,
justifyContent: FlexJustifyContent.end
mainAxisAlignment: MainAxisAlignment.end
)
)
));
......
......@@ -304,7 +304,7 @@ class _DropDownButtonState<T> extends State<DropDownButton<T>> {
padding: const EdgeInsets.only(top: 6.0)
)
],
justifyContent: FlexJustifyContent.collapse
mainAxisAlignment: MainAxisAlignment.collapse
)
)
);
......
......@@ -53,7 +53,7 @@ class GridTileBar extends StatelessWidget {
children.add(
new Flexible(
child: new Column(
alignItems: FlexAlignItems.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new DefaultTextStyle(
style: Typography.white.subhead,
......@@ -87,7 +87,7 @@ class GridTileBar extends StatelessWidget {
child: new IconTheme(
data: new IconThemeData(color: Colors.white),
child: new Row(
alignItems: FlexAlignItems.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: children
)
)
......
......@@ -188,7 +188,7 @@ class _InputState extends State<Input> {
double iconSize = config.isDense ? 18.0 : 24.0;
double iconTop = topPadding + (textStyle.fontSize - iconSize) / 2.0;
child = new Row(
alignItems: FlexAlignItems.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
new Container(
margin: new EdgeInsets.only(right: 16.0, top: iconTop),
......
......@@ -121,8 +121,8 @@ class ListItem extends StatelessWidget {
Widget center = primaryLine;
if (isTwoLine || isThreeLine) {
center = new Column(
justifyContent: FlexJustifyContent.collapse,
alignItems: FlexAlignItems.start,
mainAxisAlignment: MainAxisAlignment.collapse,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
primaryLine,
new DefaultTextStyle(
......@@ -153,7 +153,7 @@ class ListItem extends StatelessWidget {
height: itemHeight,
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: new Row(
alignItems: FlexAlignItems.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: children
)
)
......
......@@ -132,7 +132,7 @@ class SnackBar extends StatelessWidget {
opacity: fadeAnimation,
child: new Row(
children: children,
alignItems: FlexAlignItems.center
crossAxisAlignment: CrossAxisAlignment.center
)
)
)
......
......@@ -346,8 +346,8 @@ class _Tab extends StatelessWidget {
),
_buildLabelText()
],
justifyContent: FlexJustifyContent.center,
alignItems: FlexAlignItems.center
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center
);
}
......@@ -1010,7 +1010,7 @@ class TabPageSelector<T> extends StatelessWidget {
label: 'Page ${selection.index + 1} of ${selection.values.length}',
child: new Row(
children: selection.values.map((T tab) => _buildTabIndicator(selection, tab, animation, selectedColor, previousColor)).toList(),
justifyContent: FlexJustifyContent.collapse
mainAxisAlignment: MainAxisAlignment.collapse
)
);
}
......
......@@ -135,7 +135,7 @@ class _TimePickerState extends State<TimePicker> {
)
)
],
alignItems: FlexAlignItems.stretch
crossAxisAlignment: CrossAxisAlignment.stretch
);
}
}
......@@ -223,12 +223,12 @@ class _TimePickerHeader extends StatelessWidget {
child: new Text('PM', style: pmStyle)
),
],
justifyContent: FlexJustifyContent.end
mainAxisAlignment: MainAxisAlignment.end
)
)
)
],
justifyContent: FlexJustifyContent.end
mainAxisAlignment: MainAxisAlignment.end
)
);
}
......
......@@ -29,7 +29,7 @@ enum FlexDirection {
}
/// How the children should be placed along the main axis in a flex layout
enum FlexJustifyContent {
enum MainAxisAlignment {
/// Place the children as close to the start of the main axis as possible
start,
/// Place the children as close to the end of the main axis as possible
......@@ -45,7 +45,7 @@ enum FlexJustifyContent {
}
/// How the children should be placed along the cross axis in a flex layout
enum FlexAlignItems {
enum CrossAxisAlignment {
/// Place the children as close to the start of the cross axis as possible
start,
/// Place the children as close to the end of the cross axis as possible
......@@ -70,23 +70,23 @@ typedef double _ChildSizingFunction(RenderBox child, BoxConstraints constraints)
/// children. Otherwise, the flex expands to the maximum max-axis size and the
/// remaining space along is divided among the flexible children according to
/// their flex factors. Any remaining free space (i.e., if there aren't any
/// flexible children) is allocated according to the [justifyContent] property.
/// flexible children) is allocated according to the [mainAxisAlignment] property.
///
/// In the cross axis, children determine their own size. The flex then sizes
/// its cross axis to fix the largest of its children. The children are then
/// positioned along the cross axis according to the [alignItems] property.
/// positioned along the cross axis according to the [crossAxisAlignment] property.
class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, FlexParentData>,
RenderBoxContainerDefaultsMixin<RenderBox, FlexParentData> {
RenderFlex({
List<RenderBox> children,
FlexDirection direction: FlexDirection.horizontal,
FlexJustifyContent justifyContent: FlexJustifyContent.start,
FlexAlignItems alignItems: FlexAlignItems.center,
MainAxisAlignment mainAxisAlignment: MainAxisAlignment.start,
CrossAxisAlignment crossAxisAlignment: CrossAxisAlignment.center,
TextBaseline textBaseline
}) : _direction = direction,
_justifyContent = justifyContent,
_alignItems = alignItems,
_mainAxisAlignment = mainAxisAlignment,
_crossAxisAlignment = crossAxisAlignment,
_textBaseline = textBaseline {
addAll(children);
}
......@@ -102,21 +102,21 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
}
/// How the children should be placed along the main axis
FlexJustifyContent get justifyContent => _justifyContent;
FlexJustifyContent _justifyContent;
void set justifyContent (FlexJustifyContent value) {
if (_justifyContent != value) {
_justifyContent = value;
MainAxisAlignment get mainAxisAlignment => _mainAxisAlignment;
MainAxisAlignment _mainAxisAlignment;
void set mainAxisAlignment (MainAxisAlignment value) {
if (_mainAxisAlignment != value) {
_mainAxisAlignment = value;
markNeedsLayout();
}
}
/// How the children should be placed along the cross axis
FlexAlignItems get alignItems => _alignItems;
FlexAlignItems _alignItems;
void set alignItems (FlexAlignItems value) {
if (_alignItems != value) {
_alignItems = value;
CrossAxisAlignment get crossAxisAlignment => _crossAxisAlignment;
CrossAxisAlignment _crossAxisAlignment;
void set crossAxisAlignment (CrossAxisAlignment value) {
if (_crossAxisAlignment != value) {
_crossAxisAlignment = value;
markNeedsLayout();
}
}
......@@ -336,7 +336,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
int totalChildren = 0;
assert(constraints != null);
final double mainSize = (_direction == FlexDirection.horizontal) ? constraints.constrainWidth() : constraints.constrainHeight();
final bool canFlex = mainSize < double.INFINITY && justifyContent != FlexJustifyContent.collapse;
final bool canFlex = mainSize < double.INFINITY && mainAxisAlignment != MainAxisAlignment.collapse;
double crossSize = 0.0; // This is determined as we lay out the children
double freeSpace = canFlex ? mainSize : 0.0;
RenderBox child = firstChild;
......@@ -352,7 +352,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
totalFlex += childParentData.flex;
} else {
BoxConstraints innerConstraints;
if (alignItems == FlexAlignItems.stretch) {
if (crossAxisAlignment == CrossAxisAlignment.stretch) {
switch (_direction) {
case FlexDirection.horizontal:
innerConstraints = new BoxConstraints(minHeight: constraints.maxHeight,
......@@ -386,7 +386,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
// Distribute remaining space to flexible children, and determine baseline.
double maxBaselineDistance = 0.0;
double usedSpace = 0.0;
if (totalFlex > 0 || alignItems == FlexAlignItems.baseline) {
if (totalFlex > 0 || crossAxisAlignment == CrossAxisAlignment.baseline) {
double spacePerFlex = totalFlex > 0 ? (freeSpace / totalFlex) : 0.0;
child = firstChild;
while (child != null) {
......@@ -394,7 +394,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
if (flex > 0) {
double spaceForChild = spacePerFlex * flex;
BoxConstraints innerConstraints;
if (alignItems == FlexAlignItems.stretch) {
if (crossAxisAlignment == CrossAxisAlignment.stretch) {
switch (_direction) {
case FlexDirection.horizontal:
innerConstraints = new BoxConstraints(minWidth: spaceForChild,
......@@ -427,7 +427,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
usedSpace += _getMainSize(child);
crossSize = math.max(crossSize, _getCrossSize(child));
}
if (alignItems == FlexAlignItems.baseline) {
if (crossAxisAlignment == CrossAxisAlignment.baseline) {
assert(textBaseline != null && 'To use FlexAlignItems.baseline, you must also specify which baseline to use using the "baseline" argument.' is String);
double distance = child.getDistanceToBaseline(textBaseline, onlyReal: true);
if (distance != null)
......@@ -473,25 +473,25 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
}
_overflow = 0.0;
}
switch (_justifyContent) {
case FlexJustifyContent.start:
case FlexJustifyContent.collapse:
switch (_mainAxisAlignment) {
case MainAxisAlignment.start:
case MainAxisAlignment.collapse:
leadingSpace = 0.0;
betweenSpace = 0.0;
break;
case FlexJustifyContent.end:
case MainAxisAlignment.end:
leadingSpace = remainingSpace;
betweenSpace = 0.0;
break;
case FlexJustifyContent.center:
case MainAxisAlignment.center:
leadingSpace = remainingSpace / 2.0;
betweenSpace = 0.0;
break;
case FlexJustifyContent.spaceBetween:
case MainAxisAlignment.spaceBetween:
leadingSpace = 0.0;
betweenSpace = totalChildren > 1 ? remainingSpace / (totalChildren - 1) : 0.0;
break;
case FlexJustifyContent.spaceAround:
case MainAxisAlignment.spaceAround:
betweenSpace = totalChildren > 0 ? remainingSpace / totalChildren : 0.0;
leadingSpace = betweenSpace / 2.0;
break;
......@@ -503,18 +503,18 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
while (child != null) {
final FlexParentData childParentData = child.parentData;
double childCrossPosition;
switch (_alignItems) {
case FlexAlignItems.stretch:
case FlexAlignItems.start:
switch (_crossAxisAlignment) {
case CrossAxisAlignment.stretch:
case CrossAxisAlignment.start:
childCrossPosition = 0.0;
break;
case FlexAlignItems.end:
case CrossAxisAlignment.end:
childCrossPosition = crossSize - _getCrossSize(child);
break;
case FlexAlignItems.center:
case CrossAxisAlignment.center:
childCrossPosition = crossSize / 2.0 - _getCrossSize(child) / 2.0;
break;
case FlexAlignItems.baseline:
case CrossAxisAlignment.baseline:
childCrossPosition = 0.0;
if (_direction == FlexDirection.horizontal) {
assert(textBaseline != null);
......@@ -595,8 +595,8 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
void debugFillDescription(List<String> description) {
super.debugFillDescription(description);
description.add('direction: $_direction');
description.add('justifyContent: $_justifyContent');
description.add('alignItems: $_alignItems');
description.add('mainAxisAlignment: $_mainAxisAlignment');
description.add('crossAxisAlignment: $_crossAxisAlignment');
description.add('textBaseline: $_textBaseline');
}
......
......@@ -17,9 +17,9 @@ export 'package:flutter/rendering.dart' show
CustomClipper,
CustomPainter,
FixedColumnCountGridDelegate,
FlexAlignItems,
CrossAxisAlignment,
FlexDirection,
FlexJustifyContent,
MainAxisAlignment,
FractionalOffsetTween,
GridDelegate,
GridDelegateWithInOrderChildPlacement,
......@@ -1355,27 +1355,27 @@ class Flex extends MultiChildRenderObjectWidget {
Key key,
List<Widget> children: _emptyWidgetList,
this.direction: FlexDirection.horizontal,
this.justifyContent: FlexJustifyContent.start,
this.alignItems: FlexAlignItems.center,
this.mainAxisAlignment: MainAxisAlignment.start,
this.crossAxisAlignment: CrossAxisAlignment.center,
this.textBaseline
}) : super(key: key, children: children) {
assert(direction != null);
assert(justifyContent != null);
assert(alignItems != null);
assert(mainAxisAlignment != null);
assert(crossAxisAlignment != null);
}
final FlexDirection direction;
final FlexJustifyContent justifyContent;
final FlexAlignItems alignItems;
final MainAxisAlignment mainAxisAlignment;
final CrossAxisAlignment crossAxisAlignment;
final TextBaseline textBaseline;
RenderFlex createRenderObject(BuildContext context) => new RenderFlex(direction: direction, justifyContent: justifyContent, alignItems: alignItems, textBaseline: textBaseline);
RenderFlex createRenderObject(BuildContext context) => new RenderFlex(direction: direction, mainAxisAlignment: mainAxisAlignment, crossAxisAlignment: crossAxisAlignment, textBaseline: textBaseline);
void updateRenderObject(BuildContext context, RenderFlex renderObject) {
renderObject
..direction = direction
..justifyContent = justifyContent
..alignItems = alignItems
..mainAxisAlignment = mainAxisAlignment
..crossAxisAlignment = crossAxisAlignment
..textBaseline = textBaseline;
}
}
......@@ -1388,15 +1388,15 @@ class Row extends Flex {
Row({
Key key,
List<Widget> children: _emptyWidgetList,
FlexJustifyContent justifyContent: FlexJustifyContent.start,
FlexAlignItems alignItems: FlexAlignItems.center,
MainAxisAlignment mainAxisAlignment: MainAxisAlignment.start,
CrossAxisAlignment crossAxisAlignment: CrossAxisAlignment.center,
TextBaseline textBaseline
}) : super(
children: children,
key: key,
direction: FlexDirection.horizontal,
justifyContent: justifyContent,
alignItems: alignItems,
mainAxisAlignment: mainAxisAlignment,
crossAxisAlignment: crossAxisAlignment,
textBaseline: textBaseline
);
}
......@@ -1409,15 +1409,15 @@ class Column extends Flex {
Column({
Key key,
List<Widget> children: _emptyWidgetList,
FlexJustifyContent justifyContent: FlexJustifyContent.start,
FlexAlignItems alignItems: FlexAlignItems.center,
MainAxisAlignment mainAxisAlignment: MainAxisAlignment.start,
CrossAxisAlignment crossAxisAlignment: CrossAxisAlignment.center,
TextBaseline textBaseline
}) : super(
children: children,
key: key,
direction: FlexDirection.vertical,
justifyContent: justifyContent,
alignItems: alignItems,
mainAxisAlignment: mainAxisAlignment,
crossAxisAlignment: crossAxisAlignment,
textBaseline: textBaseline
);
}
......
......@@ -40,7 +40,7 @@ void main() {
RenderBox flex = new RenderFlex(
children: <RenderBox>[padding],
direction: FlexDirection.vertical,
alignItems: FlexAlignItems.stretch
crossAxisAlignment: CrossAxisAlignment.stretch
);
RenderBox outer = new RenderDecoratedBox(
decoration: new BoxDecoration(
......
......@@ -80,7 +80,7 @@ void main() {
test('Defaults', () {
RenderFlex flex = new RenderFlex();
expect(flex.alignItems, equals(FlexAlignItems.center));
expect(flex.crossAxisAlignment, equals(CrossAxisAlignment.center));
expect(flex.direction, equals(FlexDirection.horizontal));
});
......@@ -122,7 +122,7 @@ void main() {
expect(box2.size.width, equals(100.0));
expect(box2.size.height, equals(0.0));
flex.alignItems = FlexAlignItems.stretch;
flex.crossAxisAlignment = CrossAxisAlignment.stretch;
pumpFrame();
expect(box1.size.width, equals(0.0));
expect(box1.size.height, equals(100.0));
......
......@@ -54,7 +54,7 @@ void main() {
test('Row, Column and FlexJustifyContent.collapse', () {
final Key flexKey = new Key('flexKey');
// Row without justifyContent: FlexJustifyContent.collapse
// Row without mainAxisAlignment: FlexJustifyContent.collapse
testWidgets((WidgetTester tester) {
tester.pumpWidget(new Center(
child: new Row(
......@@ -69,7 +69,7 @@ void main() {
expect(renderBox.size.width, equals(800.0));
expect(renderBox.size.height, equals(100.0));
// Row with justifyContent: FlexJustifyContent.collapse
// Row with mainAxisAlignment: FlexJustifyContent.collapse
tester.pumpWidget(new Center(
child: new Row(
children: <Widget>[
......@@ -77,7 +77,7 @@ void main() {
new Container(width: 30.0, height: 100.0)
],
key: flexKey,
justifyContent: FlexJustifyContent.collapse
mainAxisAlignment: MainAxisAlignment.collapse
)
));
renderBox = tester.findElementByKey(flexKey).renderObject;
......@@ -85,7 +85,7 @@ void main() {
expect(renderBox.size.height, equals(100.0));
});
// Column without justifyContent: FlexJustifyContent.collapse
// Column without mainAxisAlignment: FlexJustifyContent.collapse
testWidgets((WidgetTester tester) {
tester.pumpWidget(new Center(
child: new Column(
......@@ -100,7 +100,7 @@ void main() {
expect(renderBox.size.width, equals(100.0));
expect(renderBox.size.height, equals(600.0));
// Column with justifyContent: FlexJustifyContent.collapse
// Column with mainAxisAlignment: FlexJustifyContent.collapse
tester.pumpWidget(new Center(
child: new Column(
children: <Widget>[
......@@ -108,7 +108,7 @@ void main() {
new Container(width: 100.0, height: 150.0)
],
key: flexKey,
justifyContent: FlexJustifyContent.collapse
mainAxisAlignment: MainAxisAlignment.collapse
)
));
renderBox = tester.findElementByKey(flexKey).renderObject;
......@@ -133,7 +133,7 @@ void main() {
height: 100.0
)
],
justifyContent: FlexJustifyContent.collapse
mainAxisAlignment: MainAxisAlignment.collapse
)
)
));
......@@ -154,7 +154,7 @@ void main() {
height: 100.0
)
],
justifyContent: FlexJustifyContent.collapse
mainAxisAlignment: MainAxisAlignment.collapse
)
)
));
......
......@@ -18,7 +18,7 @@ void main() {
key: rotatedBoxKey,
quarterTurns: 1,
child: new Row(
justifyContent: FlexJustifyContent.collapse,
mainAxisAlignment: MainAxisAlignment.collapse,
children: <Widget>[
new GestureDetector(
onTap: () { log.add('left'); },
......
......@@ -58,7 +58,7 @@ void main() {
)
),
],
alignItems: FlexAlignItems.stretch
crossAxisAlignment: CrossAxisAlignment.stretch
)
);
expect(client.updates.length, equals(2));
......@@ -95,7 +95,7 @@ void main() {
)
),
],
alignItems: FlexAlignItems.stretch
crossAxisAlignment: CrossAxisAlignment.stretch
)
);
expect(client.updates.length, equals(2));
......@@ -160,7 +160,7 @@ void main() {
)
),
],
alignItems: FlexAlignItems.stretch
crossAxisAlignment: CrossAxisAlignment.stretch
)
);
expect(client.updates.length, equals(2));
......@@ -197,7 +197,7 @@ void main() {
)
),
],
alignItems: FlexAlignItems.stretch
crossAxisAlignment: CrossAxisAlignment.stretch
)
);
expect(client.updates.length, equals(2));
......
......@@ -35,7 +35,7 @@ void main() {
)
),
],
alignItems: FlexAlignItems.stretch
crossAxisAlignment: CrossAxisAlignment.stretch
)
);
expect(client.updates.length, equals(2));
......@@ -100,7 +100,7 @@ void main() {
)
),
],
alignItems: FlexAlignItems.stretch
crossAxisAlignment: CrossAxisAlignment.stretch
)
);
expect(client.updates.length, equals(2));
......@@ -137,7 +137,7 @@ void main() {
)
),
],
alignItems: FlexAlignItems.stretch
crossAxisAlignment: CrossAxisAlignment.stretch
)
);
expect(client.updates.length, equals(2));
......
......@@ -172,7 +172,7 @@ class _MarkdownBodyRawState extends State<MarkdownBodyRaw> {
}
return new Column(
alignItems: FlexAlignItems.stretch,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: blocks
);
}
......@@ -365,7 +365,7 @@ class _Block {
}
contents = new Column(
alignItems: FlexAlignItems.stretch,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: subWidgets
);
} else {
......@@ -391,7 +391,7 @@ class _Block {
}
contents = new Row(
alignItems: FlexAlignItems.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new SizedBox(
width: listIndents.length * markdownStyle.listIndent,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment