@@ -129,21 +129,11 @@ dependencies:
129129import 'package:flutter_constraintlayout/flutter_constraintlayout.dart';
130130```
131131
132- # Example
132+ # Example [ Flutter Web Online Example ] ( https://constraintlayout.flutterfirst.cn )
133133
134- View [ Flutter Web Online Example ] ( https://constraintlayout.flutterfirst.cn )
134+ ![ effect.gif ] ( https://github.com/hackware1993/flutter- constraintlayout/blob/master/effect.gif?raw=true )
135135
136136``` dart
137- import 'package:flutter/material.dart';
138- import 'package:flutter_constraintlayout/flutter_constraintlayout.dart';
139-
140- class Example extends StatefulWidget {
141- const Example({Key? key}) : super(key: key);
142-
143- @override
144- State createState() => ExampleState();
145- }
146-
147137class ExampleState extends State<Example> {
148138 double x = 0;
149139 double y = 0;
@@ -350,16 +340,13 @@ class ExampleState extends State<Example> {
350340}
351341```
352342
353- ![ example.webp] ( https://github.com/hackware1993/flutter-constraintlayout/blob/master/effect.gif?raw=true )
354-
355343# Advanced usage
356344
3573451 . guideline [ Flutter Web Online Example] ( https://constraintlayout.flutterfirst.cn )
358346
359- ``` dart
360- import 'package:flutter/material.dart';
361- import 'package:flutter_constraintlayout/flutter_constraintlayout.dart';
347+ ![ guideline.webp] ( https://github.com/hackware1993/flutter-constraintlayout/blob/master/guideline.webp?raw=true )
362348
349+ ``` dart
363350class GuidelineExample extends StatelessWidget {
364351 const GuidelineExample({Key? key}) : super(key: key);
365352
@@ -411,14 +398,11 @@ class GuidelineExample extends StatelessWidget {
411398}
412399```
413400
414- ![ guideline.webp] ( https://github.com/hackware1993/flutter-constraintlayout/blob/master/guideline.webp?raw=true )
415-
4164012 . barrier [ Flutter Web Online Example] ( https://constraintlayout.flutterfirst.cn )
417402
418- ``` dart
419- import 'package:flutter/material.dart';
420- import 'package:flutter_constraintlayout/flutter_constraintlayout.dart';
403+ ![ barrier.gif] ( https://github.com/hackware1993/flutter-constraintlayout/blob/master/barrier.gif?raw=true )
421404
405+ ``` dart
422406class BarrierExample extends StatelessWidget {
423407 const BarrierExample({Key? key}) : super(key: key);
424408
@@ -479,61 +463,64 @@ class BarrierExample extends StatelessWidget {
479463}
480464```
481465
482- ![ barrier.gif] ( https://github.com/hackware1993/flutter-constraintlayout/blob/master/barrier.gif?raw=true )
483-
4844663 . badge [ Flutter Web Online Example] ( https://constraintlayout.flutterfirst.cn )
485467
486- ``` dart
487- import 'package:flutter/material.dart';
488- import 'package:flutter_constraintlayout/flutter_constraintlayout.dart';
468+ ![ badge.webp] ( https://github.com/hackware1993/flutter-constraintlayout/blob/master/badge.webp?raw=true )
489469
470+ ``` dart
490471class BadgeExample extends StatelessWidget {
491472 const BadgeExample({Key? key}) : super(key: key);
492473
493474 @override
494475 Widget build(BuildContext context) {
495476 ConstraintId anchor = ConstraintId('anchor');
496- return MaterialApp(
497- home: Scaffold(
498- body: ConstraintLayout(
499- children: [
500- Container(
501- color: Colors.yellow,
502- ).applyConstraint(
503- width: 200,
504- height: 200,
505- centerTo: parent,
506- id: anchor,
507- ),
508- Container(
509- color: Colors.green,
510- child: const Text(
511- 'Indeterminate badge size',
512- style: TextStyle(
513- color: Colors.black,
514- fontSize: 20,
515- ),
477+ return Scaffold(
478+ body: ConstraintLayout(
479+ children: [
480+ Container(
481+ color: Colors.yellow,
482+ ).applyConstraint(
483+ width: 200,
484+ height: 200,
485+ centerTo: parent,
486+ id: anchor,
487+ ),
488+ Container(
489+ color: Colors.green,
490+ child: const Text(
491+ 'Indeterminate badge size',
492+ style: TextStyle(
493+ color: Colors.black,
494+ fontSize: 20,
516495 ),
517- ).applyConstraint(
518- width: wrapContent,
519- height: wrapContent,
520- left: anchor.right,
521- bottom: anchor.top,
522- translate: const Offset(-0.5, 0.5),
523- percentageTranslate: true,
524- )
525- ],
526- ),
496+ ),
497+ ).applyConstraint(
498+ left: anchor.right,
499+ bottom: anchor.top,
500+ translate: const Offset(-0.5, 0.5),
501+ percentageTranslate: true,
502+ ),
503+ Container(
504+ color: Colors.green,
505+ ).applyConstraint(
506+ width: 100,
507+ height: 100,
508+ left: anchor.right,
509+ right: anchor.right,
510+ top: anchor.bottom,
511+ bottom: anchor.bottom,
512+ )
513+ ],
527514 ),
528515 );
529516 }
530517}
531518```
532519
533- ![ badge.webp] ( https://github.com/hackware1993/flutter-constraintlayout/blob/master/badge.webp?raw=true )
534-
5355204 . grid [ Flutter Web Online Example] ( https://constraintlayout.flutterfirst.cn )
536521
522+ ![ grid.webp] ( https://github.com/hackware1993/flutter-constraintlayout/blob/master/grid.webp?raw=true )
523+
537524``` dart
538525class GridExample extends StatelessWidget {
539526 const GridExample({Key? key}) : super(key: key);
@@ -578,10 +565,10 @@ class GridExample extends StatelessWidget {
578565}
579566```
580567
581- ![ grid.webp] ( https://github.com/hackware1993/flutter-constraintlayout/blob/master/grid.webp?raw=true )
582-
5835685 . staggered grid [ Flutter Web Online Example] ( https://constraintlayout.flutterfirst.cn )
584569
570+ ![ staggered_grid.gif] ( https://github.com/hackware1993/flutter-constraintlayout/blob/master/staggered_grid.gif?raw=true )
571+
585572``` dart
586573class StaggeredGridExample extends StatelessWidget {
587574 const StaggeredGridExample({Key? key}) : super(key: key);
@@ -685,10 +672,10 @@ class StaggeredGridExample extends StatelessWidget {
685672}
686673```
687674
688- ![ staggered_grid.gif] ( https://github.com/hackware1993/flutter-constraintlayout/blob/master/staggered_grid.gif?raw=true )
689-
6906756 . circle position [ Flutter Web Online Example] ( https://constraintlayout.flutterfirst.cn )
691676
677+ ![ circle_position.gif] ( https://github.com/hackware1993/flutter-constraintlayout/blob/master/circle_position.gif?raw=true )
678+
692679``` dart
693680class CirclePositionExampleState extends State<CirclePositionExample> {
694681 late Timer timer;
@@ -842,17 +829,12 @@ class CirclePositionExampleState extends State<CirclePositionExample> {
842829}
843830```
844831
845- ![ circle_position.gif] ( https://github.com/hackware1993/flutter-constraintlayout/blob/master/circle_position.gif?raw=true )
846-
847832# Performance optimization
848833
8498341 . When the layout is complex, if the child elements need to be repainted frequently, it is
850835 recommended to use RepaintBoundary to improve performance.
851836
852837``` dart
853- import 'package:flutter/material.dart';
854- import 'package:flutter_constraintlayout/src/constraint_layout.dart';
855-
856838class OffPaintExample extends StatelessWidget {
857839 const OffPaintExample({Key? key}) : super(key: key);
858840
@@ -881,9 +863,6 @@ class OffPaintExample extends StatelessWidget {
881863 can use OffBuildWidget to avoid the rebuilding of the child element.
882864
883865``` dart
884- import 'package:flutter/material.dart';
885- import 'package:flutter_constraintlayout/src/constraint_layout.dart';
886-
887866class OffBuildExample extends StatelessWidget {
888867 const OffBuildExample({Key? key}) : super(key: key);
889868
0 commit comments