Skip to content

Commit

Permalink
release v1.3.0-stable
Browse files Browse the repository at this point in the history
  • Loading branch information
hackware1993 committed May 13, 2022
1 parent aa985ff commit 74dbcec
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 36 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v1.3.0-stable

enhance base constraints.

# v1.2.0-stable

add arbitrary position support.
Expand Down
36 changes: 23 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,27 @@ two-way constraints, such as chains(not yet supported, please use with Flex).
# Feature

1. build flexible layouts with constraints
1. leftToLeft
2. leftToRight
3. rightToLeft
4. rightToRight
5. topToTop
6. topToBottom
7. bottomToTop
8. bottomToBottom
9. baselineToTop
10. baselineToBottom
11. baselineToBaseline
1. left
1. toLeft
2. toCenter(with bias, the default value is 0.5)
3. toRight
2. right
1. toLeft
2. toCenter(with bias, the default value is 0.5)
3. toRight
3. top
1. toTop
2. toCenter(with bias, the default value is 0.5)
3. toBottom
4. bottom
1. toTop
2. toCenter(with bias, the default value is 0.5)
3. toBottom
5. baseline
1. toTop
2. toCenter(with bias, the default value is 0.5)
3. toBaseline
4. toBottom
2. margin and goneMargin(when the visibility of the dependent element is gone or the actual size of
one side is 0, the goneMargin will take effect, otherwise the margin will take effect, even if
its own visibility is gone)
Expand Down Expand Up @@ -173,12 +183,12 @@ dependencies:
flutter_constraintlayout:
git:
url: 'https://github.com/hackware1993/Flutter-ConstraintLayout.git'
ref: 'v1.2.0-stable'
ref: 'v1.3.0-stable'
```
```yaml
dependencies:
flutter_constraintlayout: ^1.2.0-stable
flutter_constraintlayout: ^1.3.0-stable
```
```dart
Expand Down
36 changes: 23 additions & 13 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,27 @@ build 耗时有时甚至超过渲染耗时。
# Feature

1. 基本约束
1. leftToLeft
2. leftToRight
3. rightToLeft
4. rightToRight
5. topToTop
6. topToBottom
7. bottomToTop
8. bottomToBottom
9. baselineToTop
10. baselineToBottom
11. baselineToBaseline
1. left
1. toLeft
2. toCenter(with bias, the default value is 0.5)
3. toRight
2. right
1. toLeft
2. toCenter(with bias, the default value is 0.5)
3. toRight
3. top
1. toTop
2. toCenter(with bias, the default value is 0.5)
3. toBottom
4. bottom
1. toTop
2. toCenter(with bias, the default value is 0.5)
3. toBottom
5. baseline
1. toTop
2. toCenter(with bias, the default value is 0.5)
3. toBaseline
4. toBottom
2. margin and goneMargin(当依赖的元素的可见性为 gone 或者其某一边的实际大小为 0 时,goneMargin 就会生效,否则 margin 会生效,即便其自身的可见性为
gone)
3. clickPadding(
Expand Down Expand Up @@ -147,12 +157,12 @@ dependencies:
flutter_constraintlayout:
git:
url: 'https://github.com/hackware1993/Flutter-ConstraintLayout.git'
ref: 'v1.2.0-stable'
ref: 'v1.3.0-stable'
```
```yaml
dependencies:
flutter_constraintlayout: ^1.2.0-stable
flutter_constraintlayout: ^1.3.0-stable
```
```dart
Expand Down
15 changes: 6 additions & 9 deletions example/circle_position.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,8 @@ class CirclePositionExampleState extends State<CirclePositionExample> {
).applyConstraint(
width: 5,
height: 80,
centerTo: rId(0),
translate: const Offset(0, 0.5),
percentageTranslate: true,
top: rId(0).center,
centerHorizontalTo: rId(0),
),
Transform.rotate(
angle: pi + pi * (minute * 6 / 180),
Expand All @@ -128,9 +127,8 @@ class CirclePositionExampleState extends State<CirclePositionExample> {
).applyConstraint(
width: 5,
height: 120,
centerTo: rId(0),
translate: const Offset(0, 0.5),
percentageTranslate: true,
top: rId(0).center,
centerHorizontalTo: rId(0),
),
Transform.rotate(
angle: pi + pi * (second * 6 / 180),
Expand All @@ -141,9 +139,8 @@ class CirclePositionExampleState extends State<CirclePositionExample> {
).applyConstraint(
width: 5,
height: 180,
centerTo: rId(0),
translate: const Offset(0, 0.5),
percentageTranslate: true,
top: rId(0).center,
centerHorizontalTo: rId(0),
),
Text(
'${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')}:${second.toString().padLeft(2, '0')}',
Expand Down
7 changes: 7 additions & 0 deletions lib/src/constraint_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4580,6 +4580,13 @@ class ConstrainedNode {
map['pinnedConstraint'] = pinnedConstraint!.toJson();
}
}
if (anchors != null) {
List<Map<String, dynamic>> anchorsJson = [];
for (final element in anchors!) {
anchorsJson.add(element.toJson());
}
map['anchors'] = anchorsJson;
}
}
map['depth'] = getDepth(null, null, null);
return map;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_constraintlayout
description: A super powerful Stack, build flexible layouts with constraints. Similar to ConstraintLayout for Android and AutoLayout for iOS.
version: 1.2.0-stable
version: 1.3.0-stable
anthor: hackware
homepage: https://github.com/hackware1993/Flutter-ConstraintLayout

Expand Down

0 comments on commit 74dbcec

Please sign in to comment.