Commit 8ac14f86 authored by Dragoș Tiselice's avatar Dragoș Tiselice Committed by GitHub

Replaced FlexDirection with Axis. (#5896)

Fixes #4618.
parent 4259266b
...@@ -10,7 +10,7 @@ import 'package:flutter/rendering.dart'; ...@@ -10,7 +10,7 @@ import 'package:flutter/rendering.dart';
import 'src/solid_color_box.dart'; import 'src/solid_color_box.dart';
void main() { void main() {
RenderFlex table = new RenderFlex(direction: FlexDirection.vertical); RenderFlex table = new RenderFlex(direction: Axis.vertical);
void addAlignmentRow(CrossAxisAlignment crossAxisAlignment) { void addAlignmentRow(CrossAxisAlignment crossAxisAlignment) {
TextStyle style = const TextStyle(color: const Color(0xFF000000)); TextStyle style = const TextStyle(color: const Color(0xFF000000));
...@@ -50,7 +50,7 @@ void main() { ...@@ -50,7 +50,7 @@ void main() {
const TextStyle style = const TextStyle(color: const Color(0xFF000000)); const TextStyle style = const TextStyle(color: const Color(0xFF000000));
RenderParagraph paragraph = new RenderParagraph(new TextSpan(style: style, text: '$justify')); RenderParagraph paragraph = new RenderParagraph(new TextSpan(style: style, text: '$justify'));
table.add(new RenderPadding(child: paragraph, padding: new EdgeInsets.only(top: 20.0))); table.add(new RenderPadding(child: paragraph, padding: new EdgeInsets.only(top: 20.0)));
RenderFlex row = new RenderFlex(direction: FlexDirection.horizontal); RenderFlex row = new RenderFlex(direction: Axis.horizontal);
row.add(new RenderSolidColorBox(const Color(0xFFFFCCCC), desiredSize: new Size(80.0, 60.0))); 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(0xFFCCFFCC), desiredSize: new Size(64.0, 60.0)));
row.add(new RenderSolidColorBox(const Color(0xFFCCCCFF), desiredSize: new Size(160.0, 60.0))); row.add(new RenderSolidColorBox(const Color(0xFFCCCCFF), desiredSize: new Size(160.0, 60.0)));
......
...@@ -93,7 +93,7 @@ void main() { ...@@ -93,7 +93,7 @@ void main() {
RenderProxyBox proxy = new RenderProxyBox(); RenderProxyBox proxy = new RenderProxyBox();
attachWidgetTreeToRenderTree(proxy); attachWidgetTreeToRenderTree(proxy);
RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical); RenderFlex flexRoot = new RenderFlex(direction: Axis.vertical);
addFlexChildSolidColor(flexRoot, const Color(0xFFFF00FF), flex: 1); addFlexChildSolidColor(flexRoot, const Color(0xFFFF00FF), flex: 1);
flexRoot.add(proxy); flexRoot.add(proxy);
addFlexChildSolidColor(flexRoot, const Color(0xFF0000FF), flex: 1); addFlexChildSolidColor(flexRoot, const Color(0xFF0000FF), flex: 1);
......
...@@ -20,7 +20,7 @@ export 'package:flutter/rendering.dart' show ...@@ -20,7 +20,7 @@ export 'package:flutter/rendering.dart' show
CustomClipper, CustomClipper,
CustomPainter, CustomPainter,
FixedColumnCountGridDelegate, FixedColumnCountGridDelegate,
FlexDirection, Axis,
FlowDelegate, FlowDelegate,
FlowPaintingContext, FlowPaintingContext,
FractionalOffsetTween, FractionalOffsetTween,
...@@ -1823,7 +1823,7 @@ class Flex extends MultiChildRenderObjectWidget { ...@@ -1823,7 +1823,7 @@ class Flex extends MultiChildRenderObjectWidget {
/// [CrossAxisAlignment.baseline], then [textBaseline] must not be null. /// [CrossAxisAlignment.baseline], then [textBaseline] must not be null.
Flex({ Flex({
Key key, Key key,
this.direction: FlexDirection.horizontal, this.direction: Axis.horizontal,
this.mainAxisAlignment: MainAxisAlignment.start, this.mainAxisAlignment: MainAxisAlignment.start,
this.mainAxisSize: MainAxisSize.max, this.mainAxisSize: MainAxisSize.max,
this.crossAxisAlignment: CrossAxisAlignment.center, this.crossAxisAlignment: CrossAxisAlignment.center,
...@@ -1838,7 +1838,7 @@ class Flex extends MultiChildRenderObjectWidget { ...@@ -1838,7 +1838,7 @@ class Flex extends MultiChildRenderObjectWidget {
} }
/// The direction to use as the main axis. /// The direction to use as the main axis.
final FlexDirection direction; final Axis direction;
/// How the children should be placed along the main axis. /// How the children should be placed along the main axis.
final MainAxisAlignment mainAxisAlignment; final MainAxisAlignment mainAxisAlignment;
...@@ -1902,7 +1902,7 @@ class Row extends Flex { ...@@ -1902,7 +1902,7 @@ class Row extends Flex {
}) : super( }) : super(
children: children, children: children,
key: key, key: key,
direction: FlexDirection.horizontal, direction: Axis.horizontal,
mainAxisAlignment: mainAxisAlignment, mainAxisAlignment: mainAxisAlignment,
mainAxisSize: mainAxisSize, mainAxisSize: mainAxisSize,
crossAxisAlignment: crossAxisAlignment, crossAxisAlignment: crossAxisAlignment,
...@@ -1930,7 +1930,7 @@ class Column extends Flex { ...@@ -1930,7 +1930,7 @@ class Column extends Flex {
}) : super( }) : super(
children: children, children: children,
key: key, key: key,
direction: FlexDirection.vertical, direction: Axis.vertical,
mainAxisAlignment: mainAxisAlignment, mainAxisAlignment: mainAxisAlignment,
mainAxisSize: mainAxisSize, mainAxisSize: mainAxisSize,
crossAxisAlignment: crossAxisAlignment, crossAxisAlignment: crossAxisAlignment,
......
...@@ -39,7 +39,7 @@ void main() { ...@@ -39,7 +39,7 @@ void main() {
); );
RenderBox flex = new RenderFlex( RenderBox flex = new RenderFlex(
children: <RenderBox>[padding], children: <RenderBox>[padding],
direction: FlexDirection.vertical, direction: Axis.vertical,
crossAxisAlignment: CrossAxisAlignment.stretch crossAxisAlignment: CrossAxisAlignment.stretch
); );
RenderBox outer = new RenderDecoratedBox( RenderBox outer = new RenderDecoratedBox(
......
...@@ -24,7 +24,7 @@ void main() { ...@@ -24,7 +24,7 @@ void main() {
additionalConstraints: const BoxConstraints.expand() additionalConstraints: const BoxConstraints.expand()
); );
RenderFlex flex = new RenderFlex( RenderFlex flex = new RenderFlex(
direction: FlexDirection.vertical, direction: Axis.vertical,
children: <RenderBox>[ children: <RenderBox>[
new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(height: 200.0)), new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(height: 200.0)),
flexible, flexible,
...@@ -46,7 +46,7 @@ void main() { ...@@ -46,7 +46,7 @@ void main() {
additionalConstraints: const BoxConstraints.expand() additionalConstraints: const BoxConstraints.expand()
); );
RenderFlex flex = new RenderFlex( RenderFlex flex = new RenderFlex(
direction: FlexDirection.horizontal, direction: Axis.horizontal,
children: <RenderBox>[ children: <RenderBox>[
new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 200.0)), new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 200.0)),
flexible, flexible,
...@@ -65,7 +65,7 @@ void main() { ...@@ -65,7 +65,7 @@ void main() {
test('Vertical Flipped Constraints', () { test('Vertical Flipped Constraints', () {
RenderFlex flex = new RenderFlex( RenderFlex flex = new RenderFlex(
direction: FlexDirection.vertical, direction: Axis.vertical,
children: <RenderBox>[ children: <RenderBox>[
new RenderAspectRatio(aspectRatio: 1.0), new RenderAspectRatio(aspectRatio: 1.0),
] ]
...@@ -81,7 +81,7 @@ void main() { ...@@ -81,7 +81,7 @@ void main() {
test('Defaults', () { test('Defaults', () {
RenderFlex flex = new RenderFlex(); RenderFlex flex = new RenderFlex();
expect(flex.crossAxisAlignment, equals(CrossAxisAlignment.center)); expect(flex.crossAxisAlignment, equals(CrossAxisAlignment.center));
expect(flex.direction, equals(FlexDirection.horizontal)); expect(flex.direction, equals(Axis.horizontal));
}); });
test('Parent data', () { test('Parent data', () {
...@@ -129,7 +129,7 @@ void main() { ...@@ -129,7 +129,7 @@ void main() {
expect(box2.size.width, equals(100.0)); expect(box2.size.width, equals(100.0));
expect(box2.size.height, equals(100.0)); expect(box2.size.height, equals(100.0));
flex.direction = FlexDirection.vertical; flex.direction = Axis.vertical;
pumpFrame(); pumpFrame();
expect(box1.size.width, equals(100.0)); expect(box1.size.width, equals(100.0));
expect(box1.size.height, equals(0.0)); expect(box1.size.height, equals(0.0));
...@@ -157,7 +157,7 @@ void main() { ...@@ -157,7 +157,7 @@ void main() {
expect(getOffset(box3).dx, equals(350.0)); expect(getOffset(box3).dx, equals(350.0));
expect(box3.size.width, equals(100.0)); expect(box3.size.width, equals(100.0));
flex.direction = FlexDirection.vertical; flex.direction = Axis.vertical;
pumpFrame(); pumpFrame();
expect(getOffset(box1).dy, equals(25.0)); expect(getOffset(box1).dy, equals(25.0));
expect(box1.size.height, equals(100.0)); expect(box1.size.height, equals(100.0));
......
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