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