Skip to content

Commit ae86014

Browse files
committed
add pinned & circle translate support.
1 parent 1afe82e commit ae86014

File tree

7 files changed

+37
-6
lines changed

7 files changed

+37
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v1.4.1-stable
2+
3+
1. add pinned & circle translate support.
4+
15
# v1.4.0-stable
26

37
1. code refactoring, extracting non-core functions.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,12 @@ dependencies:
185185
flutter_constraintlayout:
186186
git:
187187
url: 'https://github.com/hackware1993/Flutter-ConstraintLayout.git'
188-
ref: 'v1.4.0-stable'
188+
ref: 'v1.4.1-stable'
189189
```
190190
191191
```yaml
192192
dependencies:
193-
flutter_constraintlayout: ^1.4.0-stable
193+
flutter_constraintlayout: ^1.4.1-stable
194194
```
195195
196196
```dart

README_CN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,12 @@ dependencies:
159159
flutter_constraintlayout:
160160
git:
161161
url: 'https://github.com/hackware1993/Flutter-ConstraintLayout.git'
162-
ref: 'v1.4.0-stable'
162+
ref: 'v1.4.1-stable'
163163
```
164164
165165
```yaml
166166
dependencies:
167-
flutter_constraintlayout: ^1.4.0-stable
167+
flutter_constraintlayout: ^1.4.1-stable
168168
```
169169
170170
```dart

example/translate.dart

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,31 @@ class TranslateExampleState extends State<TranslateExample> {
7676
size: wrapContent,
7777
centerTo: anchor,
7878
translate: circleTranslate(
79-
radius: 150,
79+
radius: 100,
8080
angle: angle,
8181
),
8282
),
83+
Container(
84+
decoration: const BoxDecoration(
85+
color: Colors.cyan,
86+
),
87+
child: const Text('pinned & circle translate'),
88+
).applyConstraint(
89+
size: wrapContent,
90+
centerTo: anchor,
91+
translate: PinnedTranslate(
92+
PinnedInfo(
93+
null,
94+
Anchor(0.5, AnchorType.percent, 0.5, AnchorType.percent),
95+
null,
96+
angle: angle,
97+
),
98+
) +
99+
circleTranslate(
100+
radius: 150,
101+
angle: angle,
102+
),
103+
),
83104
Container(
84105
decoration: const BoxDecoration(
85106
color: Colors.orange,

lib/src/core.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,8 @@ class PinnedTranslate extends Offset {
498498

499499
PinnedTranslate(this._pinnedInfo) : super(0, 0);
500500

501+
PinnedTranslate._shift(this._pinnedInfo, double x, double y) : super(x, y);
502+
501503
@override
502504
bool operator ==(Object other) =>
503505
identical(this, other) ||
@@ -506,6 +508,10 @@ class PinnedTranslate extends Offset {
506508
runtimeType == other.runtimeType &&
507509
_pinnedInfo == other._pinnedInfo;
508510

511+
@override
512+
PinnedTranslate operator +(Offset other) =>
513+
PinnedTranslate._shift(_pinnedInfo, other.dx, other.dy);
514+
509515
@override
510516
int get hashCode => super.hashCode ^ _pinnedInfo.hashCode;
511517
}

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.4.0-stable
3+
version: 1.4.1-stable
44
anthor: hackware
55
homepage: https://github.com/hackware1993/Flutter-ConstraintLayout
66

translate.gif

83.4 KB
Loading

0 commit comments

Comments
 (0)