@@ -60,35 +60,36 @@ void main() {
6060 });
6161
6262 // Regression test for https://github.com/flutter/flutter/issues/82055
63- testWidgets ('GridTile with header and footer sizes itself to its child when unconstrained' , (
64- WidgetTester tester,
65- ) async {
66- await tester.pumpWidget (
67- MaterialApp (
68- home: Center (
69- child: SizedBox (
70- height: 100.0 ,
71- child: ListView .builder (
72- scrollDirection: Axis .horizontal,
73- itemCount: 1 ,
74- itemBuilder: (BuildContext context, int index) {
75- return GridTile (
76- header: const Text ('Header' ),
77- footer: const Text ('Footer' ),
78- child: Container (height: 100.0 , width: 80.0 , color: Colors .red),
79- );
80- },
63+ testWidgets (
64+ 'GridTile with header and footer sizes itself to its child when the width is unbounded' ,
65+ (WidgetTester tester) async {
66+ await tester.pumpWidget (
67+ MaterialApp (
68+ home: Center (
69+ child: SizedBox (
70+ height: 100.0 ,
71+ child: ListView .builder (
72+ scrollDirection: Axis .horizontal,
73+ itemCount: 1 ,
74+ itemBuilder: (BuildContext context, int index) {
75+ return GridTile (
76+ header: const Text ('Header' ),
77+ footer: const Text ('Footer' ),
78+ child: Container (height: 100.0 , width: 80.0 , color: Colors .red),
79+ );
80+ },
81+ ),
8182 ),
8283 ),
8384 ),
84- ),
85- );
85+ );
8686
87- expect (tester.takeException (), isNull);
88- expect (tester.getSize (find.byType (GridTile )), const Size (80.0 , 100.0 ));
89- expect (find.text ('Header' ), findsOneWidget);
90- expect (find.text ('Footer' ), findsOneWidget);
91- });
87+ expect (tester.takeException (), isNull);
88+ expect (tester.getSize (find.byType (GridTile )), const Size (80.0 , 100.0 ));
89+ expect (find.text ('Header' ), findsOneWidget);
90+ expect (find.text ('Footer' ), findsOneWidget);
91+ },
92+ );
9293
9394 testWidgets ('GridTile child fills the tile when the constraints are tight' , (
9495 WidgetTester tester,
@@ -176,6 +177,52 @@ void main() {
176177 },
177178 );
178179
180+ testWidgets ('GridTile with header and footer reports zero intrinsic sizes' , (
181+ WidgetTester tester,
182+ ) async {
183+ await tester.pumpWidget (
184+ const MaterialApp (
185+ home: GridTile (
186+ header: Text ('Header' ),
187+ footer: Text ('Footer' ),
188+ child: SizedBox (width: 80.0 , height: 100.0 ),
189+ ),
190+ ),
191+ );
192+
193+ final RenderBox tile = tester.renderObject <RenderBox >(find.byType (GridTile ));
194+ expect (tile.getMinIntrinsicWidth (150.0 ), 0.0 );
195+ expect (tile.getMaxIntrinsicWidth (150.0 ), 0.0 );
196+ expect (tile.getMinIntrinsicHeight (200.0 ), 0.0 );
197+ expect (tile.getMaxIntrinsicHeight (200.0 ), 0.0 );
198+ });
199+
200+ testWidgets ('GridTile dry layout does not query its child when both axes are bounded' , (
201+ WidgetTester tester,
202+ ) async {
203+ await tester.pumpWidget (
204+ MaterialApp (
205+ home: GridTile (
206+ header: const Text ('Header' ),
207+ footer: const Text ('Footer' ),
208+ child: LayoutBuilder (
209+ builder: (BuildContext context, BoxConstraints constraints) => const SizedBox (),
210+ ),
211+ ),
212+ ),
213+ );
214+
215+ final RenderBox tile = tester.renderObject <RenderBox >(find.byType (GridTile ));
216+ expect (
217+ tile.getDryLayout (const BoxConstraints (maxWidth: 200.0 , maxHeight: 150.0 )),
218+ const Size (200.0 , 150.0 ),
219+ );
220+ expect (
221+ tile.getDryLayout (const BoxConstraints .tightFor (width: 200.0 , height: 150.0 )),
222+ const Size (200.0 , 150.0 ),
223+ );
224+ });
225+
179226 testWidgets ('GridTileBar does not crash at zero area' , (WidgetTester tester) async {
180227 await tester.pumpWidget (
181228 const MaterialApp (
0 commit comments