[rename fixit] Flex alignments

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

Fixes #231
This commit is contained in:
Adam Barth
2016-03-12 18:28:42 -08:00
parent 5e1af2f37e
commit d5b2e2a01c
51 changed files with 176 additions and 176 deletions

View File

@@ -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)),

View File

@@ -201,7 +201,7 @@ class _GestureDemoState extends State<GestureDemo> {
]
),
],
alignItems: FlexAlignItems.start
crossAxisAlignment: CrossAxisAlignment.start
)
)
)

View File

@@ -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
);
}

View File

@@ -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);

View File

@@ -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
)
)
);

View File

@@ -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(

View File

@@ -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),

View File

@@ -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())

View File

@@ -40,7 +40,7 @@ class _DatePickerDemoState extends State<DatePickerDemo> {
child: new Text('SELECT DATE')
),
],
justifyContent: FlexJustifyContent.center
mainAxisAlignment: MainAxisAlignment.center
)
);
}

View File

@@ -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,

View File

@@ -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'),

View File

@@ -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
)
);

View File

@@ -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(

View File

@@ -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,

View File

@@ -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,

View File

@@ -49,7 +49,7 @@ class PageSelectorDemo extends StatelessWidget {
tooltip: 'Forward'
)
],
justifyContent: FlexJustifyContent.spaceBetween
mainAxisAlignment: MainAxisAlignment.spaceBetween
)
),
new Flexible(

View File

@@ -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
);
}

View File

@@ -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)

View File

@@ -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
)
)
)

View File

@@ -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(

View File

@@ -36,7 +36,7 @@ class _TimePickerDemoState extends State<TimePickerDemo> {
child: new Text('SELECT TIME')
),
],
justifyContent: FlexJustifyContent.center
mainAxisAlignment: MainAxisAlignment.center
)
);
}

View File

@@ -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
)
);
}

View File

@@ -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(

View File

@@ -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,

View File

@@ -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: () {

View File

@@ -102,7 +102,7 @@ class StockRow extends StatelessWidget {
)
),
],
alignItems: FlexAlignItems.baseline,
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: DefaultTextStyle.of(context).textBaseline
)
),

View File

@@ -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
)
);
}