Skip to content

Commit 03f82be

Browse files
authored
Merge pull request #4 from hackware1993/milestone_pinned_position
Milestone pinned position
2 parents fa2f67d + 406c989 commit 03f82be

File tree

7 files changed

+406
-34
lines changed

7 files changed

+406
-34
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v1.1.0-alpha
2+
3+
add pinned position support.
4+
15
# v1.0.7-stable
26

37
optimize key set.

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,14 @@ two-way constraints, such as chains(not yet supported, please use with Flex).
136136
16. staggered grid、grid、list(list is a special staggered grid, grid is also a special staggered
137137
grid)
138138
17. circle position
139-
18. e-index(event dispatch order, default is z-index)
140-
19. the size of child widgets can be set to:
139+
18. pinned position
140+
19. e-index(event dispatch order, default is z-index)
141+
20. the size of child widgets can be set to:
141142
1. fixed size(>=0)
142143
2. matchParent
143144
3. wrapContent(default, minimum and maximum supported)
144145
4. matchConstraint
145-
20. the size of itself can be set to:
146+
21. the size of itself can be set to:
146147
1. fixed size(>=0)
147148
2. matchParent(default)
148149
3. wrapContent(minimum and maximum are temporarily not supported)
@@ -171,12 +172,12 @@ dependencies:
171172
flutter_constraintlayout:
172173
git:
173174
url: 'https://github.com/hackware1993/Flutter-ConstraintLayout.git'
174-
ref: 'v1.0.7-stable'
175+
ref: 'v1.1.0-alpha'
175176
```
176177
177178
```yaml
178179
dependencies:
179-
flutter_constraintlayout: ^1.0.7-stable
180+
flutter_constraintlayout: ^1.1.0-alpha
180181
```
181182
182183
```dart

README_CN.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,14 @@ build 耗时有时甚至超过渲染耗时。
110110
27. centerBottomRightTo
111111
16. 瀑布流、网格、列表(列表是一个特殊的瀑布流,网格也是一个特殊的瀑布流)
112112
17. 圆形定位
113-
18. e-index(事件分发顺序,默认是 z-index,一般用来处理点击区域)
114-
19. 子元素的大小可以被设置为:
113+
18. 图钉定位
114+
19. e-index(事件分发顺序,默认是 z-index,一般用来处理点击区域)
115+
20. 子元素的大小可以被设置为:
115116
1. 固定大小(>=0)
116117
2. matchParent
117118
3. wrapContent(默认值,支持最大、最小设置)
118119
4. matchConstraint
119-
20. 自身的大小可以被设置为:
120+
21. 自身的大小可以被设置为:
120121
1. 固定大小(>=0)
121122
2. matchParent(default)
122123
3. wrapContent(暂不支持最大、最小设置)
@@ -145,12 +146,12 @@ dependencies:
145146
flutter_constraintlayout:
146147
git:
147148
url: 'https://github.com/hackware1993/Flutter-ConstraintLayout.git'
148-
ref: 'v1.0.7-stable'
149+
ref: 'v1.1.0-alpha'
149150
```
150151
151152
```yaml
152153
dependencies:
153-
flutter_constraintlayout: ^1.0.7-stable
154+
flutter_constraintlayout: ^1.1.0-alpha
154155
```
155156
156157
```dart

example/home.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import 'guideline.dart';
1313
import 'horizontal_list.dart';
1414
import 'margin.dart';
1515
import 'percentage_layout.dart';
16+
import 'pinned_position.dart';
1617
import 'relative_id.dart';
1718
import 'self_wrap_content.dart';
1819
import 'staggered_grid.dart';
@@ -38,6 +39,7 @@ class ExampleHome extends StatelessWidget {
3839
'Vertical List': const VerticalListExample(),
3940
'Staggered Grid': const StaggeredGridExample(),
4041
'Circle Position': const CirclePositionExample(),
42+
'Pinned Position': const PinnedPositionExample(),
4143
'Self wrapContent': const SelfWrapContentExample(),
4244
'Margin': const MarginExample(),
4345
'Charts': const ChartsExample(),

example/pinned_position.dart

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter_constraintlayout/src/constraint_layout.dart';
3+
4+
import 'custom_app_bar.dart';
5+
6+
class PinnedPositionExample extends StatelessWidget {
7+
const PinnedPositionExample({Key? key}) : super(key: key);
8+
9+
@override
10+
Widget build(BuildContext context) {
11+
ConstraintId anchor = ConstraintId('anchor');
12+
return Scaffold(
13+
appBar: const CustomAppBar(
14+
title: 'Pinned Position',
15+
codePath: 'example/pinned_position.dart',
16+
),
17+
body: ConstraintLayout(
18+
children: [
19+
Container(
20+
color: Colors.yellow,
21+
).applyConstraint(
22+
id: anchor,
23+
size: 200,
24+
centerTo: parent,
25+
),
26+
Container(
27+
color: Colors.cyan,
28+
).applyConstraint(
29+
size: 40,
30+
pinnedInfo: PinnedInfo(
31+
anchor,
32+
PinnedPos(0, PinnedType.absolute, 0.5, PinnedType.percent),
33+
PinnedPos(0.5, PinnedType.percent, 0.5, PinnedType.percent),
34+
rotateDegree: 45,
35+
),
36+
)
37+
],
38+
),
39+
);
40+
}
41+
}

0 commit comments

Comments
 (0)