Skip to content

Commit 8ce0645

Browse files
author
fbchen
committed
enhance size set
1 parent 7db06cc commit 8ce0645

13 files changed

+72
-58
lines changed

example/badge.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ class BadgeExample extends StatelessWidget {
1919
Container(
2020
color: Colors.yellow,
2121
).applyConstraint(
22-
width: 200,
23-
height: 200,
22+
size: 200,
2423
centerTo: parent,
2524
id: anchor,
2625
),
@@ -42,8 +41,7 @@ class BadgeExample extends StatelessWidget {
4241
Container(
4342
color: Colors.green,
4443
).applyConstraint(
45-
width: 100,
46-
height: 100,
44+
size: 100,
4745
left: anchor.right,
4846
right: anchor.right,
4947
top: anchor.bottom,

example/barrier.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ class BarrierExample extends StatelessWidget {
2222
color: const Color(0xFF005BBB),
2323
).applyConstraint(
2424
id: leftChild,
25-
width: 200,
26-
height: 200,
25+
size: 200,
2726
topLeftTo: parent,
2827
),
2928
Container(

example/circle_position.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ class CirclePositionExampleState extends State<CirclePositionExample> {
7171
});
7272
},
7373
).applyConstraint(
74-
width: 20,
75-
height: 20,
74+
size: 20,
7675
centerTo: parent,
7776
zIndex: 100,
7877
translate: Offset(centerTranslateX, centerTranslateY),

example/code.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ class CodeViewState extends State<CodeViewWidget> {
5151
),
5252
),
5353
).applyConstraint(
54-
width: matchParent,
55-
height: matchParent,
54+
size: matchParent,
5655
)
5756
],
5857
),

example/complex_list.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ class ComplexListExample extends StatelessWidget {
4343
Container(
4444
color: colors[index % 6],
4545
).applyConstraint(
46-
width: matchParent,
47-
height: matchParent,
46+
size: matchParent,
4847
),
4948
Image.asset(
5049
'assets/test.webp',

example/grid.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ class GridExample extends StatelessWidget {
3030
top: parent.top,
3131
itemCount: 50,
3232
columnCount: 8,
33-
itemWidth: 100,
34-
itemHeight: 100,
33+
itemSize: 100,
3534
itemBuilder: (index, _, __) {
3635
return Container(
3736
color: colors[index % colors.length],

example/offbuild.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ class OffBuildExample extends StatelessWidget {
1414
Container(
1515
color: Colors.orangeAccent,
1616
).offBuild(id: 'id').applyConstraint(
17-
width: 200,
18-
height: 200,
17+
size: 200,
1918
topRightTo: parent,
2019
)
2120
],

example/offpaint.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ class OffPaintExample extends StatelessWidget {
1313
Container(
1414
color: Colors.orangeAccent,
1515
).offPaint().applyConstraint(
16-
width: 200,
17-
height: 200,
16+
size: 200,
1817
topRightTo: parent,
1918
)
2019
],

example/relative_id.dart

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@ class RelativeIdExample extends StatelessWidget {
1818
Container(
1919
color: Colors.yellow,
2020
).applyConstraint(
21-
width: 200,
22-
height: 200,
21+
size: 200,
2322
centerTo: parent,
2423
),
2524
Container(
2625
color: Colors.redAccent,
2726
).applyConstraint(
28-
width: 100,
29-
height: 100,
27+
size: 100,
3028
left: rId(0).right,
3129
right: rId(0).right,
3230
top: rId(0).top,
@@ -35,15 +33,13 @@ class RelativeIdExample extends StatelessWidget {
3533
Container(
3634
color: Colors.green,
3735
).applyConstraint(
38-
width: 50,
39-
height: 50,
36+
size: 50,
4037
centerBottomRightTo: sId(-1),
4138
),
4239
Container(
4340
color: Colors.blue,
4441
).applyConstraint(
45-
width: 50,
46-
height: 50,
42+
size: 50,
4743
centerBottomRightTo: sId(-3),
4844
)
4945
],

example/self_wrap_content.dart

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@ class SelfWrapContentExample extends StatelessWidget {
1515
),
1616
body: Center(
1717
child: ConstraintLayout(
18-
width: wrapContent,
19-
height: wrapContent,
18+
size: wrapContent,
2019
children: [
2120
Container(
2221
color: Colors.blue,
2322
).applyConstraint(
24-
width: matchParent,
25-
height: matchParent,
23+
size: matchParent,
2624
),
2725
Container(
2826
color: Colors.yellow,
@@ -38,8 +36,7 @@ class SelfWrapContentExample extends StatelessWidget {
3836
Container(
3937
color: Colors.orange,
4038
).applyConstraint(
41-
width: 50,
42-
height: 50,
39+
size: 50,
4340
topRightTo: parent,
4441
),
4542
const Text(
@@ -54,8 +51,7 @@ class SelfWrapContentExample extends StatelessWidget {
5451
Container(
5552
color: Colors.cyan,
5653
).applyConstraint(
57-
width: 50,
58-
height: 50,
54+
size: 50,
5955
centerVerticalTo: parent,
6056
left: rId(1).right,
6157
right: rId(2).left,

example/summary.dart

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ class SummaryExampleState extends State<SummaryExample> {
4141
childConstraints: [
4242
Constraint(
4343
id: box0,
44-
width: 200,
45-
height: 200,
44+
size: 200,
4645
bottomLeftTo: parent,
4746
zIndex: 20,
4847
)
@@ -75,8 +74,7 @@ class SummaryExampleState extends State<SummaryExample> {
7574
).applyConstraint(
7675
// Constraints set with widgets easy way
7776
id: box2,
78-
width: matchConstraint,
79-
height: matchConstraint,
77+
size: matchConstraint,
8078
centerHorizontalTo: box3,
8179
top: box3.bottom,
8280
bottom: parent.bottom,
@@ -98,8 +96,7 @@ class SummaryExampleState extends State<SummaryExample> {
9896
child: const Text('box4'),
9997
).applyConstraint(
10098
id: box4,
101-
width: 50,
102-
height: 50,
99+
size: 50,
103100
bottomRightTo: parent,
104101
),
105102
GestureDetector(
@@ -129,8 +126,7 @@ class SummaryExampleState extends State<SummaryExample> {
129126
child: const Text('box6'),
130127
).applyConstraint(
131128
id: box6,
132-
width: 120,
133-
height: 120,
129+
size: 120,
134130
centerVerticalTo: box2,
135131
verticalBias: 0.8,
136132
left: box3.right,
@@ -142,8 +138,7 @@ class SummaryExampleState extends State<SummaryExample> {
142138
child: const Text('box7'),
143139
).applyConstraint(
144140
id: box7,
145-
width: matchConstraint,
146-
height: matchConstraint,
141+
size: matchConstraint,
147142
left: parent.left,
148143
right: box3.left,
149144
centerVerticalTo: parent,
@@ -175,8 +170,7 @@ class SummaryExampleState extends State<SummaryExample> {
175170
child: const Text(
176171
'percentage layout\nwidth: 50% of parent\nheight: 30% of parent'),
177172
).applyConstraint(
178-
width: matchConstraint,
179-
height: matchConstraint,
173+
size: matchConstraint,
180174
widthPercent: 0.5,
181175
heightPercent: 0.3,
182176
horizontalBias: 0,

example/wrapper_constraints.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ class WrapperConstraintsExampleState extends State<WrapperConstraintsExample> {
3838
Container(
3939
color: Colors.yellow,
4040
).applyConstraint(
41-
width: 500,
42-
height: 500,
41+
size: 500,
4342
centerLeftTo: parent,
4443
margin: const EdgeInsets.only(
4544
left: 200,
@@ -48,8 +47,7 @@ class WrapperConstraintsExampleState extends State<WrapperConstraintsExample> {
4847
Container(
4948
color: Colors.yellow,
5049
).applyConstraint(
51-
width: 500,
52-
height: 500,
50+
size: 500,
5351
centerRightTo: parent,
5452
margin: const EdgeInsets.only(
5553
right: 200,

0 commit comments

Comments
 (0)