|
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|
|
import 'package:flutter/rendering.dart';
|
|
|
|
|
|
/// 这里靠继承来实现绝大部分功能
|
|
|
-class ReverseRow extends Flex {
|
|
|
+class ReverseRow extends _ReverseFlex {
|
|
|
ReverseRow({
|
|
|
Key? key,
|
|
|
MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start,
|
|
@@ -10,15 +10,61 @@ class ReverseRow extends Flex {
|
|
|
CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center,
|
|
|
TextDirection? textDirection,
|
|
|
VerticalDirection verticalDirection = VerticalDirection.down,
|
|
|
- TextBaseline?
|
|
|
- textBaseline, // NO DEFAULT: we don't know what the text's baseline should be
|
|
|
+ TextBaseline? textBaseline,
|
|
|
+ List<Widget> children = const <Widget>[],
|
|
|
+ }) : super(
|
|
|
+ key: key,
|
|
|
+ children: children,
|
|
|
+ direction: Axis.horizontal,
|
|
|
+ mainAxisSize: mainAxisSize,
|
|
|
+ mainAxisAlignment: mainAxisAlignment,
|
|
|
+ crossAxisAlignment: crossAxisAlignment,
|
|
|
+ textDirection: textDirection,
|
|
|
+ verticalDirection: verticalDirection,
|
|
|
+ textBaseline: textBaseline,
|
|
|
+ );
|
|
|
+}
|
|
|
+
|
|
|
+class ReverseColumn extends _ReverseFlex {
|
|
|
+ ReverseColumn({
|
|
|
+ Key? key,
|
|
|
+ MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start,
|
|
|
+ MainAxisSize mainAxisSize = MainAxisSize.max,
|
|
|
+ CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center,
|
|
|
+ TextDirection? textDirection,
|
|
|
+ VerticalDirection verticalDirection = VerticalDirection.down,
|
|
|
+ TextBaseline? textBaseline,
|
|
|
+ List<Widget> children = const <Widget>[],
|
|
|
+ }) : super(
|
|
|
+ key: key,
|
|
|
+ children: children,
|
|
|
+ direction: Axis.vertical,
|
|
|
+ mainAxisSize: mainAxisSize,
|
|
|
+ mainAxisAlignment: mainAxisAlignment,
|
|
|
+ crossAxisAlignment: crossAxisAlignment,
|
|
|
+ textDirection: textDirection,
|
|
|
+ verticalDirection: verticalDirection,
|
|
|
+ textBaseline: textBaseline,
|
|
|
+ );
|
|
|
+}
|
|
|
+
|
|
|
+class _ReverseFlex extends Flex {
|
|
|
+ _ReverseFlex({
|
|
|
+ Key? key,
|
|
|
+ required Axis direction,
|
|
|
+ MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start,
|
|
|
+ MainAxisSize mainAxisSize = MainAxisSize.max,
|
|
|
+ CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center,
|
|
|
+ TextDirection? textDirection,
|
|
|
+ VerticalDirection verticalDirection = VerticalDirection.down,
|
|
|
+ TextBaseline? textBaseline,
|
|
|
List<Widget> children = const <Widget>[],
|
|
|
}) : super(
|
|
|
children: children,
|
|
|
key: key,
|
|
|
+ direction: direction,
|
|
|
mainAxisAlignment: mainAxisAlignment,
|
|
|
mainAxisSize: mainAxisSize,
|
|
|
- direction: Axis.horizontal,
|
|
|
crossAxisAlignment: crossAxisAlignment,
|
|
|
textDirection: textDirection,
|
|
|
verticalDirection: verticalDirection,
|
|
@@ -26,8 +72,8 @@ class ReverseRow extends Flex {
|
|
|
);
|
|
|
|
|
|
@override
|
|
|
- _RenderReverseRow createRenderObject(BuildContext context) {
|
|
|
- return _RenderReverseRow(
|
|
|
+ RenderFlex createRenderObject(BuildContext context) {
|
|
|
+ return _RenderReverseFlex(
|
|
|
direction: direction,
|
|
|
mainAxisAlignment: mainAxisAlignment,
|
|
|
mainAxisSize: mainAxisSize,
|
|
@@ -54,8 +100,8 @@ class ReverseRow extends Flex {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-class _RenderReverseRow extends RenderFlex {
|
|
|
- _RenderReverseRow({
|
|
|
+class _RenderReverseFlex extends RenderFlex {
|
|
|
+ _RenderReverseFlex({
|
|
|
List<RenderBox>? children,
|
|
|
Axis direction = Axis.horizontal,
|
|
|
MainAxisSize mainAxisSize = MainAxisSize.max,
|