Skip to content

Commit 790bcf0

Browse files
author
fbchen
committed
release v0.9.18-stable
1 parent bd50fad commit 790bcf0

File tree

3 files changed

+66
-3
lines changed

3 files changed

+66
-3
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v0.9.18-stable
2+
3+
support virtual helper widgets.
4+
15
# v0.9.17-stable
26

37
optimize constraints calculate performance.

README.md

+61-2
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ dependencies:
8282
flutter_constraintlayout:
8383
git:
8484
url: 'https://github.com/hackware1993/Flutter-ConstraintLayout.git'
85-
ref: 'v0.9.17-stable'
85+
ref: 'v0.9.18-stable'
8686
```
8787
8888
```yaml
8989
dependencies:
90-
flutter_constraintlayout: ^0.9.17-stable
90+
flutter_constraintlayout: ^0.9.18-stable
9191
```
9292
9393
```dart
@@ -567,6 +567,65 @@ class OffBuildExample extends StatelessWidget {
567567
wrapContent will be re-layout. And since the constraints passed to other child elements won't
568568
change, no real re-layout will be triggered.
569569

570+
4. If you use Guideline or Barrier in the children list, Element and RenderObject will inevitably be
571+
generated for them, which will be laid out but not drawn. At this point you can use
572+
GuidelineDefine or BarrierDefine to optimize it, no Element and RenderObject will be generated
573+
anymore:
574+
575+
```dart
576+
class BarrierExample extends StatelessWidget {
577+
const BarrierExample({Key? key}) : super(key: key);
578+
579+
@override
580+
Widget build(BuildContext context) {
581+
ConstraintId leftChild = ConstraintId('leftChild');
582+
ConstraintId rightChild = ConstraintId('rightChild');
583+
ConstraintId barrier = ConstraintId('barrier');
584+
return Scaffold(
585+
body: ConstraintLayout(
586+
childConstraints: [
587+
BarrierDefine(
588+
id: barrier,
589+
direction: BarrierDirection.bottom,
590+
referencedIds: [leftChild, rightChild],
591+
),
592+
],
593+
children: [
594+
Container(
595+
color: const Color(0xFF005BBB),
596+
).applyConstraint(
597+
id: leftChild,
598+
width: 200,
599+
height: 200,
600+
topLeftTo: parent,
601+
),
602+
Container(
603+
color: const Color(0xFFFFD500),
604+
).applyConstraint(
605+
id: rightChild,
606+
width: 200,
607+
height: matchConstraint,
608+
centerRightTo: parent,
609+
heightPercent: 0.5,
610+
verticalBias: 0,
611+
),
612+
const Text(
613+
'Align to barrier',
614+
style: TextStyle(
615+
fontSize: 40,
616+
color: Colors.blue,
617+
),
618+
).applyConstraint(
619+
centerHorizontalTo: parent,
620+
top: barrier.bottom,
621+
)
622+
],
623+
),
624+
);
625+
}
626+
}
627+
```
628+
570629
# Support me
571630

572631
If it helps you a lot, consider sponsoring me a cup of milk tea.

pubspec.yaml

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

0 commit comments

Comments
 (0)