Skip to content

Commit 74dbcec

Browse files
committed
release v1.3.0-stable
1 parent aa985ff commit 74dbcec

File tree

6 files changed

+64
-36
lines changed

6 files changed

+64
-36
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v1.3.0-stable
2+
3+
enhance base constraints.
4+
15
# v1.2.0-stable
26

37
add arbitrary position support.

README.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,27 @@ two-way constraints, such as chains(not yet supported, please use with Flex).
6060
# Feature
6161

6262
1. build flexible layouts with constraints
63-
1. leftToLeft
64-
2. leftToRight
65-
3. rightToLeft
66-
4. rightToRight
67-
5. topToTop
68-
6. topToBottom
69-
7. bottomToTop
70-
8. bottomToBottom
71-
9. baselineToTop
72-
10. baselineToBottom
73-
11. baselineToBaseline
63+
1. left
64+
1. toLeft
65+
2. toCenter(with bias, the default value is 0.5)
66+
3. toRight
67+
2. right
68+
1. toLeft
69+
2. toCenter(with bias, the default value is 0.5)
70+
3. toRight
71+
3. top
72+
1. toTop
73+
2. toCenter(with bias, the default value is 0.5)
74+
3. toBottom
75+
4. bottom
76+
1. toTop
77+
2. toCenter(with bias, the default value is 0.5)
78+
3. toBottom
79+
5. baseline
80+
1. toTop
81+
2. toCenter(with bias, the default value is 0.5)
82+
3. toBaseline
83+
4. toBottom
7484
2. margin and goneMargin(when the visibility of the dependent element is gone or the actual size of
7585
one side is 0, the goneMargin will take effect, otherwise the margin will take effect, even if
7686
its own visibility is gone)
@@ -173,12 +183,12 @@ dependencies:
173183
flutter_constraintlayout:
174184
git:
175185
url: 'https://github.com/hackware1993/Flutter-ConstraintLayout.git'
176-
ref: 'v1.2.0-stable'
186+
ref: 'v1.3.0-stable'
177187
```
178188
179189
```yaml
180190
dependencies:
181-
flutter_constraintlayout: ^1.2.0-stable
191+
flutter_constraintlayout: ^1.3.0-stable
182192
```
183193
184194
```dart

README_CN.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,27 @@ build 耗时有时甚至超过渲染耗时。
4343
# Feature
4444

4545
1. 基本约束
46-
1. leftToLeft
47-
2. leftToRight
48-
3. rightToLeft
49-
4. rightToRight
50-
5. topToTop
51-
6. topToBottom
52-
7. bottomToTop
53-
8. bottomToBottom
54-
9. baselineToTop
55-
10. baselineToBottom
56-
11. baselineToBaseline
46+
1. left
47+
1. toLeft
48+
2. toCenter(with bias, the default value is 0.5)
49+
3. toRight
50+
2. right
51+
1. toLeft
52+
2. toCenter(with bias, the default value is 0.5)
53+
3. toRight
54+
3. top
55+
1. toTop
56+
2. toCenter(with bias, the default value is 0.5)
57+
3. toBottom
58+
4. bottom
59+
1. toTop
60+
2. toCenter(with bias, the default value is 0.5)
61+
3. toBottom
62+
5. baseline
63+
1. toTop
64+
2. toCenter(with bias, the default value is 0.5)
65+
3. toBaseline
66+
4. toBottom
5767
2. margin and goneMargin(当依赖的元素的可见性为 gone 或者其某一边的实际大小为 0 时,goneMargin 就会生效,否则 margin 会生效,即便其自身的可见性为
5868
gone)
5969
3. clickPadding(
@@ -147,12 +157,12 @@ dependencies:
147157
flutter_constraintlayout:
148158
git:
149159
url: 'https://github.com/hackware1993/Flutter-ConstraintLayout.git'
150-
ref: 'v1.2.0-stable'
160+
ref: 'v1.3.0-stable'
151161
```
152162
153163
```yaml
154164
dependencies:
155-
flutter_constraintlayout: ^1.2.0-stable
165+
flutter_constraintlayout: ^1.3.0-stable
156166
```
157167
158168
```dart

example/circle_position.dart

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,8 @@ class CirclePositionExampleState extends State<CirclePositionExample> {
115115
).applyConstraint(
116116
width: 5,
117117
height: 80,
118-
centerTo: rId(0),
119-
translate: const Offset(0, 0.5),
120-
percentageTranslate: true,
118+
top: rId(0).center,
119+
centerHorizontalTo: rId(0),
121120
),
122121
Transform.rotate(
123122
angle: pi + pi * (minute * 6 / 180),
@@ -128,9 +127,8 @@ class CirclePositionExampleState extends State<CirclePositionExample> {
128127
).applyConstraint(
129128
width: 5,
130129
height: 120,
131-
centerTo: rId(0),
132-
translate: const Offset(0, 0.5),
133-
percentageTranslate: true,
130+
top: rId(0).center,
131+
centerHorizontalTo: rId(0),
134132
),
135133
Transform.rotate(
136134
angle: pi + pi * (second * 6 / 180),
@@ -141,9 +139,8 @@ class CirclePositionExampleState extends State<CirclePositionExample> {
141139
).applyConstraint(
142140
width: 5,
143141
height: 180,
144-
centerTo: rId(0),
145-
translate: const Offset(0, 0.5),
146-
percentageTranslate: true,
142+
top: rId(0).center,
143+
centerHorizontalTo: rId(0),
147144
),
148145
Text(
149146
'${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')}:${second.toString().padLeft(2, '0')}',

lib/src/constraint_layout.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4580,6 +4580,13 @@ class ConstrainedNode {
45804580
map['pinnedConstraint'] = pinnedConstraint!.toJson();
45814581
}
45824582
}
4583+
if (anchors != null) {
4584+
List<Map<String, dynamic>> anchorsJson = [];
4585+
for (final element in anchors!) {
4586+
anchorsJson.add(element.toJson());
4587+
}
4588+
map['anchors'] = anchorsJson;
4589+
}
45834590
}
45844591
map['depth'] = getDepth(null, null, null);
45854592
return map;

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_constraintlayout
22
description: A super powerful Stack, build flexible layouts with constraints. Similar to ConstraintLayout for Android and AutoLayout for iOS.
3-
version: 1.2.0-stable
3+
version: 1.3.0-stable
44
anthor: hackware
55
homepage: https://github.com/hackware1993/Flutter-ConstraintLayout
66

0 commit comments

Comments
 (0)