Skip to content

Commit b7972ab

Browse files
author
fbchen
committed
update example
1 parent 2811942 commit b7972ab

File tree

1 file changed

+45
-18
lines changed

1 file changed

+45
-18
lines changed

example/wrapper_constraints.dart

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import 'custom_app_bar.dart';
66
class WrapperConstraintsExample extends StatelessWidget {
77
const WrapperConstraintsExample({Key? key}) : super(key: key);
88

9-
Widget item(String text) {
9+
Widget item(String text, [Color color = Colors.redAccent]) {
1010
return Container(
1111
width: 100,
1212
height: 100,
13-
color: Colors.redAccent,
13+
color: color,
1414
alignment: Alignment.center,
1515
child: FittedBox(
1616
child: Text(text),
@@ -47,6 +47,30 @@ class WrapperConstraintsExample extends StatelessWidget {
4747
right: 200,
4848
),
4949
),
50+
item('outTopLeftTo').applyConstraint(
51+
outTopLeftTo: rId(1),
52+
),
53+
item('outTopCenterTo').applyConstraint(
54+
outTopCenterTo: rId(1),
55+
),
56+
item('outTopRightTo').applyConstraint(
57+
outTopRightTo: rId(1),
58+
),
59+
item('outCenterLeftTo').applyConstraint(
60+
outCenterLeftTo: rId(1),
61+
),
62+
item('outCenterRightTo').applyConstraint(
63+
outCenterRightTo: rId(1),
64+
),
65+
item('outBottomLeftTo').applyConstraint(
66+
outBottomLeftTo: rId(1),
67+
),
68+
item('outBottomCenterTo').applyConstraint(
69+
outBottomCenterTo: rId(1),
70+
),
71+
item('outBottomRightTo').applyConstraint(
72+
outBottomRightTo: rId(1),
73+
),
5074
item('centerTopLeftTo').applyConstraint(
5175
centerTopLeftTo: rId(0),
5276
),
@@ -71,29 +95,32 @@ class WrapperConstraintsExample extends StatelessWidget {
7195
item('centerBottomRightTo').applyConstraint(
7296
centerBottomRightTo: rId(0),
7397
),
74-
item('outTopLeftTo').applyConstraint(
75-
outTopLeftTo: rId(1),
98+
item('topLeftTo', Colors.green).applyConstraint(
99+
topLeftTo: rId(1),
76100
),
77-
item('outTopCenterTo').applyConstraint(
78-
outTopCenterTo: rId(1),
101+
item('topCenterTo', Colors.green).applyConstraint(
102+
topCenterTo: rId(1),
79103
),
80-
item('outTopRightTo').applyConstraint(
81-
outTopRightTo: rId(1),
104+
item('topRightTo', Colors.green).applyConstraint(
105+
topRightTo: rId(1),
82106
),
83-
item('outCenterLeftTo').applyConstraint(
84-
outCenterLeftTo: rId(1),
107+
item('centerLeftTo', Colors.green).applyConstraint(
108+
centerLeftTo: rId(1),
85109
),
86-
item('outCenterRightTo').applyConstraint(
87-
outCenterRightTo: rId(1),
110+
item('centerTo', Colors.green).applyConstraint(
111+
centerTo: rId(1),
88112
),
89-
item('outBottomLeftTo').applyConstraint(
90-
outBottomLeftTo: rId(1),
113+
item('centerRightTo', Colors.green).applyConstraint(
114+
centerRightTo: rId(1),
91115
),
92-
item('outBottomCenterTo').applyConstraint(
93-
outBottomCenterTo: rId(1),
116+
item('bottomLeftTo', Colors.green).applyConstraint(
117+
bottomLeftTo: rId(1),
94118
),
95-
item('outBottomRightTo').applyConstraint(
96-
outBottomRightTo: rId(1),
119+
item('bottomCenterTo', Colors.green).applyConstraint(
120+
bottomCenterTo: rId(1),
121+
),
122+
item('bottomRightTo', Colors.green).applyConstraint(
123+
bottomRightTo: rId(1),
97124
),
98125
],
99126
),

0 commit comments

Comments
 (0)