Skip to content

Commit b612157

Browse files
committed
fix a rotate bug
1 parent 6c163a5 commit b612157

File tree

6 files changed

+24
-53
lines changed

6 files changed

+24
-53
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
# v1.4.2-stable
2+
3+
fix a rotate bug.
4+
15
# v1.4.1-stable
26

3-
1. add pinned & circle translate support.
7+
add pinned & circle translate support.
48

59
# v1.4.0-stable
610

README.md

Lines changed: 6 additions & 16 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.1-stable'
188+
ref: 'v1.4.2-stable'
189189
```
190190
191191
```yaml
192192
dependencies:
193-
flutter_constraintlayout: ^1.4.1-stable
193+
flutter_constraintlayout: ^1.4.2-stable
194194
```
195195
196196
```dart
@@ -1072,12 +1072,9 @@ class TranslateExampleState extends State<TranslateExample> {
10721072
centerTo: parent,
10731073
),
10741074
Container(
1075-
decoration: const BoxDecoration(
1076-
color: Colors.red,
1077-
),
1075+
color: Colors.red,
10781076
child: const Text('pinned translate'),
10791077
).applyConstraint(
1080-
size: wrapContent,
10811078
centerTo: anchor,
10821079
translate: PinnedTranslate(
10831080
PinnedInfo(
@@ -1089,9 +1086,7 @@ class TranslateExampleState extends State<TranslateExample> {
10891086
),
10901087
),
10911088
Container(
1092-
decoration: const BoxDecoration(
1093-
color: Colors.blue,
1094-
),
1089+
color: Colors.blue,
10951090
child: const Text('circle translate'),
10961091
).applyConstraint(
10971092
size: wrapContent,
@@ -1102,12 +1097,9 @@ class TranslateExampleState extends State<TranslateExample> {
11021097
),
11031098
),
11041099
Container(
1105-
decoration: const BoxDecoration(
1106-
color: Colors.cyan,
1107-
),
1100+
color: Colors.cyan,
11081101
child: const Text('pinned & circle translate'),
11091102
).applyConstraint(
1110-
size: wrapContent,
11111103
centerTo: anchor,
11121104
translate: PinnedTranslate(
11131105
PinnedInfo(
@@ -1123,9 +1115,7 @@ class TranslateExampleState extends State<TranslateExample> {
11231115
),
11241116
),
11251117
Container(
1126-
decoration: const BoxDecoration(
1127-
color: Colors.orange,
1128-
),
1118+
color: Colors.orange,
11291119
child: const Text('normal translate'),
11301120
).applyConstraint(
11311121
size: wrapContent,

README_CN.md

Lines changed: 6 additions & 16 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.1-stable'
162+
ref: 'v1.4.2-stable'
163163
```
164164
165165
```yaml
166166
dependencies:
167-
flutter_constraintlayout: ^1.4.1-stable
167+
flutter_constraintlayout: ^1.4.2-stable
168168
```
169169
170170
```dart
@@ -1046,12 +1046,9 @@ class TranslateExampleState extends State<TranslateExample> {
10461046
centerTo: parent,
10471047
),
10481048
Container(
1049-
decoration: const BoxDecoration(
1050-
color: Colors.red,
1051-
),
1049+
color: Colors.red,
10521050
child: const Text('pinned translate'),
10531051
).applyConstraint(
1054-
size: wrapContent,
10551052
centerTo: anchor,
10561053
translate: PinnedTranslate(
10571054
PinnedInfo(
@@ -1063,9 +1060,7 @@ class TranslateExampleState extends State<TranslateExample> {
10631060
),
10641061
),
10651062
Container(
1066-
decoration: const BoxDecoration(
1067-
color: Colors.blue,
1068-
),
1063+
color: Colors.blue,
10691064
child: const Text('circle translate'),
10701065
).applyConstraint(
10711066
size: wrapContent,
@@ -1076,12 +1071,9 @@ class TranslateExampleState extends State<TranslateExample> {
10761071
),
10771072
),
10781073
Container(
1079-
decoration: const BoxDecoration(
1080-
color: Colors.cyan,
1081-
),
1074+
color: Colors.cyan,
10821075
child: const Text('pinned & circle translate'),
10831076
).applyConstraint(
1084-
size: wrapContent,
10851077
centerTo: anchor,
10861078
translate: PinnedTranslate(
10871079
PinnedInfo(
@@ -1097,9 +1089,7 @@ class TranslateExampleState extends State<TranslateExample> {
10971089
),
10981090
),
10991091
Container(
1100-
decoration: const BoxDecoration(
1101-
color: Colors.orange,
1102-
),
1092+
color: Colors.orange,
11031093
child: const Text('normal translate'),
11041094
).applyConstraint(
11051095
size: wrapContent,

example/translate.dart

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,9 @@ class TranslateExampleState extends State<TranslateExample> {
5151
centerTo: parent,
5252
),
5353
Container(
54-
decoration: const BoxDecoration(
55-
color: Colors.red,
56-
),
54+
color: Colors.red,
5755
child: const Text('pinned translate'),
5856
).applyConstraint(
59-
size: wrapContent,
6057
centerTo: anchor,
6158
translate: PinnedTranslate(
6259
PinnedInfo(
@@ -68,9 +65,7 @@ class TranslateExampleState extends State<TranslateExample> {
6865
),
6966
),
7067
Container(
71-
decoration: const BoxDecoration(
72-
color: Colors.blue,
73-
),
68+
color: Colors.blue,
7469
child: const Text('circle translate'),
7570
).applyConstraint(
7671
size: wrapContent,
@@ -81,12 +76,9 @@ class TranslateExampleState extends State<TranslateExample> {
8176
),
8277
),
8378
Container(
84-
decoration: const BoxDecoration(
85-
color: Colors.cyan,
86-
),
79+
color: Colors.cyan,
8780
child: const Text('pinned & circle translate'),
8881
).applyConstraint(
89-
size: wrapContent,
9082
centerTo: anchor,
9183
translate: PinnedTranslate(
9284
PinnedInfo(
@@ -102,9 +94,7 @@ class TranslateExampleState extends State<TranslateExample> {
10294
),
10395
),
10496
Container(
105-
decoration: const BoxDecoration(
106-
color: Colors.orange,
107-
),
97+
color: Colors.orange,
10898
child: const Text('normal translate'),
10999
).applyConstraint(
110100
size: wrapContent,

lib/src/core.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3271,11 +3271,8 @@ class _ConstraintRenderBox extends RenderBox
32713271
context.canvas.translate(
32723272
element.offset.dx + offset.dx + paintShift.dx + anchorOffset.dx,
32733273
element.offset.dy + offset.dy + paintShift.dy + anchorOffset.dy);
3274-
context.canvas.rotate(pi + pi * (pinnedInfo.angle / 180));
3275-
context.paintChild(
3276-
element.renderBox!,
3277-
Offset(-element.getMeasuredWidth() + anchorOffset.dx,
3278-
-element.getMeasuredHeight() + anchorOffset.dy));
3274+
context.canvas.rotate(pinnedInfo.angle * pi / 180);
3275+
context.paintChild(element.renderBox!, -anchorOffset);
32793276
context.canvas.restore();
32803277
} else {
32813278
context.paintChild(

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

0 commit comments

Comments
 (0)