-
Notifications
You must be signed in to change notification settings - Fork 0
/
RowAndColumnAbout.dart
105 lines (102 loc) · 3.63 KB
/
RowAndColumnAbout.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import 'package:flutter/material.dart';
import 'package:flutter_starter_notes/component/CommonTitle.dart';
class RowAndColumnAbout extends StatelessWidget {
RowAndColumnAbout({Key key, this.title});
final String title;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title),
),
body: SingleChildScrollView(
child: Column(
//测试Row对齐方式,排除Column默认居中对齐的干扰
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max, //有效,外层Colum高度为整个屏幕
children: <Widget>[
CommonTitle('Row - 主轴对齐方式:center,主轴大小:max'),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
child: Text("Item 1"),
color: Colors.blue,
),
Container(child: Text("Item 2"), color: Colors.red),
],
),
CommonTitle('Row - 主轴对齐方式:center,主轴大小:min'),
Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
child: Text("Item 1"),
color: Colors.blue,
),
Container(child: Text("Item 2"), color: Colors.red),
],
),
CommonTitle('Row - 主轴对齐方式:end,文字方向:rtl'),
Row(
mainAxisAlignment: MainAxisAlignment.end,
textDirection: TextDirection.rtl,
children: <Widget>[
Container(
child: Text("Item 1"),
color: Colors.blue,
),
Container(child: Text("Item 2"), color: Colors.red),
],
),
CommonTitle('Row - 副轴对齐方式:start,纵轴方向:up'),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
verticalDirection: VerticalDirection.up,
children: <Widget>[
Container(
child: Text(
"Item 1",
style: TextStyle(fontSize: 30.0),
),
color: Colors.blue,
),
Container(child: Text("Item 2"), color: Colors.red),
],
),
CommonTitle('Row - 副轴对齐方式:end,纵轴方向:down'),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
verticalDirection: VerticalDirection.down,
children: <Widget>[
Container(
child: Text(
"Item 1",
style: TextStyle(fontSize: 30.0),
),
color: Colors.blue,
),
Container(child: Text("Item 2"), color: Colors.red),
],
),
CommonTitle('Column - Column 嵌套 Column'),
Container(
color: Colors.red,
child: Column(
mainAxisSize: MainAxisSize.max,//无效,内层Colum高度为实际高度
children: <Widget>[
Container(
child: Text("Item 1"),
color: Colors.blue,
),
Container(child: Text("Item 2"), color: Colors.red),
],
),
)
],
),
),
);
}
}