File tree Expand file tree Collapse file tree 1 file changed +89
-79
lines changed Expand file tree Collapse file tree 1 file changed +89
-79
lines changed Original file line number Diff line number Diff line change @@ -22,85 +22,95 @@ class ComplexListExample extends StatelessWidget {
2222 home: Scaffold (
2323 body: ListView .builder (
2424 itemBuilder: (context, index) {
25- return Container (
26- child: ConstraintLayout (
27- children: [
28- Image .asset (
29- 'assets/test.png' ,
30- fit: BoxFit .fill,
31- ).applyConstraint (
32- width: 100 ,
33- height: wrapContent,
34- centerLeftTo: parent,
35- ),
36- Image .asset (
37- 'assets/test2.png' ,
38- fit: BoxFit .fill,
39- ).applyConstraint (
40- width: 150 ,
41- height: wrapContent,
42- centerRightTo: parent,
43- ),
44- Text (
45- 'topLeft $index ' ,
46- style: style,
47- ).applyConstraint (
48- topLeftTo: parent,
49- ),
50- Text (
51- 'topCenter $index ' ,
52- style: style,
53- ).applyConstraint (
54- topCenterTo: parent,
55- ),
56- Text (
57- 'topRight $index ' ,
58- style: style,
59- ).applyConstraint (
60- topRightTo: parent,
61- ),
62- Text (
63- 'centerLeft $index ' ,
64- style: style,
65- ).applyConstraint (
66- centerLeftTo: parent,
67- ),
68- Text (
69- 'center $index ' ,
70- style: style,
71- ).applyConstraint (
72- centerTo: parent,
73- ),
74- Text (
75- 'centerRight $index ' ,
76- style: style,
77- ).applyConstraint (
78- centerRightTo: parent,
79- ),
80- Text (
81- 'bottomLeft $index ' ,
82- style: style,
83- ).applyConstraint (
84- bottomLeftTo: parent,
85- ),
86- Text (
87- 'bottomCenter $index ' ,
88- style: style,
89- ).applyConstraint (
90- bottomCenterTo: parent,
91- ),
92- Text (
93- 'bottomRight $index ' ,
94- style: style,
95- ).applyConstraint (
96- bottomRightTo: parent,
97- )
98- ],
99- ),
100- color: colors[index % 6 ],
101- margin: const EdgeInsets .only (
102- top: 10 ,
103- ),
25+ if (index == 0 ) {
26+ return const Text (
27+ 'Very complex item view can also achieve full frame' ,
28+ style: TextStyle (
29+ color: Colors .black,
30+ fontSize: 20 ,
31+ ),
32+ textAlign: TextAlign .center,
33+ );
34+ }
35+ return ConstraintLayout (
36+ children: [
37+ Container (
38+ color: colors[index % 6 ],
39+ ).applyConstraint (
40+ width: matchParent,
41+ height: matchParent,
42+ ),
43+ Image .asset (
44+ 'assets/test.png' ,
45+ fit: BoxFit .fill,
46+ ).applyConstraint (
47+ width: 100 ,
48+ height: wrapContent,
49+ centerLeftTo: parent,
50+ ),
51+ Image .asset (
52+ 'assets/test2.png' ,
53+ fit: BoxFit .fill,
54+ ).applyConstraint (
55+ width: 150 ,
56+ height: wrapContent,
57+ centerRightTo: parent,
58+ ),
59+ Text (
60+ 'topLeft $index ' ,
61+ style: style,
62+ ).applyConstraint (
63+ topLeftTo: parent,
64+ ),
65+ Text (
66+ 'topCenter $index ' ,
67+ style: style,
68+ ).applyConstraint (
69+ topCenterTo: parent,
70+ ),
71+ Text (
72+ 'topRight $index ' ,
73+ style: style,
74+ ).applyConstraint (
75+ topRightTo: parent,
76+ ),
77+ Text (
78+ 'centerLeft $index ' ,
79+ style: style,
80+ ).applyConstraint (
81+ centerLeftTo: parent,
82+ ),
83+ Text (
84+ 'center $index ' ,
85+ style: style,
86+ ).applyConstraint (
87+ centerTo: parent,
88+ ),
89+ Text (
90+ 'centerRight $index ' ,
91+ style: style,
92+ ).applyConstraint (
93+ centerRightTo: parent,
94+ ),
95+ Text (
96+ 'bottomLeft $index ' ,
97+ style: style,
98+ ).applyConstraint (
99+ bottomLeftTo: parent,
100+ ),
101+ Text (
102+ 'bottomCenter $index ' ,
103+ style: style,
104+ ).applyConstraint (
105+ bottomCenterTo: parent,
106+ ),
107+ Text (
108+ 'bottomRight $index ' ,
109+ style: style,
110+ ).applyConstraint (
111+ bottomRightTo: parent,
112+ )
113+ ],
104114 );
105115 },
106116 itemCount: 10000 ,
You can’t perform that action at this time.
0 commit comments