@@ -310,52 +310,52 @@ void main() {
310
310
311
311
await tester.pumpWidget (build (false , false , false ));
312
312
expect (tester.renderObjectList (find.byType (AnimatedSize )), hasLength (3 ));
313
- expect (tester.getRect (find.byType (AnimatedSize ).at (0 )), const Rect .fromLTWH (0.0 , 56 .0 , 800.0 , 0.0 ));
314
- expect (tester.getRect (find.byType (AnimatedSize ).at (1 )), const Rect .fromLTWH (0.0 , 113 .0 , 800.0 , 0.0 ));
315
- expect (tester.getRect (find.byType (AnimatedSize ).at (2 )), const Rect .fromLTWH (0.0 , 170 .0 , 800.0 , 0.0 ));
313
+ expect (tester.getRect (find.byType (AnimatedSize ).at (0 )), const Rect .fromLTWH (0.0 , 48 .0 , 800.0 , 0.0 ));
314
+ expect (tester.getRect (find.byType (AnimatedSize ).at (1 )), const Rect .fromLTWH (0.0 , 97 .0 , 800.0 , 0.0 ));
315
+ expect (tester.getRect (find.byType (AnimatedSize ).at (2 )), const Rect .fromLTWH (0.0 , 146 .0 , 800.0 , 0.0 ));
316
316
317
317
await tester.pump (const Duration (milliseconds: 200 ));
318
- expect (tester.getRect (find.byType (AnimatedSize ).at (0 )), const Rect .fromLTWH (0.0 , 56 .0 , 800.0 , 0.0 ));
319
- expect (tester.getRect (find.byType (AnimatedSize ).at (1 )), const Rect .fromLTWH (0.0 , 113 .0 , 800.0 , 0.0 ));
320
- expect (tester.getRect (find.byType (AnimatedSize ).at (2 )), const Rect .fromLTWH (0.0 , 170 .0 , 800.0 , 0.0 ));
318
+ expect (tester.getRect (find.byType (AnimatedSize ).at (0 )), const Rect .fromLTWH (0.0 , 48 .0 , 800.0 , 0.0 ));
319
+ expect (tester.getRect (find.byType (AnimatedSize ).at (1 )), const Rect .fromLTWH (0.0 , 97 .0 , 800.0 , 0.0 ));
320
+ expect (tester.getRect (find.byType (AnimatedSize ).at (2 )), const Rect .fromLTWH (0.0 , 146 .0 , 800.0 , 0.0 ));
321
321
322
322
await tester.pumpWidget (build (false , true , false ));
323
- expect (tester.getRect (find.byType (AnimatedSize ).at (0 )), const Rect .fromLTWH (0.0 , 56 .0 , 800.0 , 0.0 ));
324
- expect (tester.getRect (find.byType (AnimatedSize ).at (1 )), const Rect .fromLTWH (0.0 , 113 .0 , 800.0 , 0.0 ));
325
- expect (tester.getRect (find.byType (AnimatedSize ).at (2 )), const Rect .fromLTWH (0.0 , 170 .0 , 800.0 , 0.0 ));
323
+ expect (tester.getRect (find.byType (AnimatedSize ).at (0 )), const Rect .fromLTWH (0.0 , 48 .0 , 800.0 , 0.0 ));
324
+ expect (tester.getRect (find.byType (AnimatedSize ).at (1 )), const Rect .fromLTWH (0.0 , 97 .0 , 800.0 , 0.0 ));
325
+ expect (tester.getRect (find.byType (AnimatedSize ).at (2 )), const Rect .fromLTWH (0.0 , 146 .0 , 800.0 , 0.0 ));
326
326
327
327
await tester.pump (kSizeAnimationDuration ~ / 2 );
328
- expect (tester.getRect (find.byType (AnimatedSize ).at (0 )), const Rect .fromLTWH (0.0 , 56 .0 , 800.0 , 0.0 ));
328
+ expect (tester.getRect (find.byType (AnimatedSize ).at (0 )), const Rect .fromLTWH (0.0 , 48 .0 , 800.0 , 0.0 ));
329
329
final Rect rect1 = tester.getRect (find.byType (AnimatedSize ).at (1 ));
330
330
expect (rect1.left, 0.0 );
331
- expect (rect1.top, inExclusiveRange (113.0 , 113.0 + 16.0 + 32 .0 )); // 16.0 material gap, plus 16 .0 top and bottom margins added to the header
331
+ expect (rect1.top, inExclusiveRange (113.0 , 113.0 + 16.0 + 24 .0 )); // 16.0 material gap, plus 12 .0 top and bottom margins added to the header
332
332
expect (rect1.width, 800.0 );
333
333
expect (rect1.height, inExclusiveRange (0.0 , 100.0 ));
334
334
final Rect rect2 = tester.getRect (find.byType (AnimatedSize ).at (2 ));
335
- expect (rect2, Rect .fromLTWH (0.0 , rect1.bottom + 16.0 + 56 .0 , 800.0 , 0.0 )); // the 16.0 comes from the MaterialGap being introduced, the 56 .0 is the header height.
335
+ expect (rect2, Rect .fromLTWH (0.0 , rect1.bottom + 16.0 + 48 .0 , 800.0 , 0.0 )); // the 16.0 comes from the MaterialGap being introduced, the 48 .0 is the header height.
336
336
337
337
await tester.pumpWidget (build (false , false , false ));
338
- expect (tester.getRect (find.byType (AnimatedSize ).at (0 )), const Rect .fromLTWH (0.0 , 56 .0 , 800.0 , 0.0 ));
338
+ expect (tester.getRect (find.byType (AnimatedSize ).at (0 )), const Rect .fromLTWH (0.0 , 48 .0 , 800.0 , 0.0 ));
339
339
expect (tester.getRect (find.byType (AnimatedSize ).at (1 )), rect1);
340
340
expect (tester.getRect (find.byType (AnimatedSize ).at (2 )), rect2);
341
341
342
342
await tester.pumpWidget (build (false , false , true ));
343
- expect (tester.getRect (find.byType (AnimatedSize ).at (0 )), const Rect .fromLTWH (0.0 , 56 .0 , 800.0 , 0.0 ));
343
+ expect (tester.getRect (find.byType (AnimatedSize ).at (0 )), const Rect .fromLTWH (0.0 , 48 .0 , 800.0 , 0.0 ));
344
344
expect (tester.getRect (find.byType (AnimatedSize ).at (1 )), rect1);
345
345
expect (tester.getRect (find.byType (AnimatedSize ).at (2 )), rect2);
346
346
347
347
// a few no-op pumps to make sure there's nothing fishy going on
348
348
await tester.pump ();
349
349
await tester.pump ();
350
350
await tester.pump ();
351
- expect (tester.getRect (find.byType (AnimatedSize ).at (0 )), const Rect .fromLTWH (0.0 , 56 .0 , 800.0 , 0.0 ));
351
+ expect (tester.getRect (find.byType (AnimatedSize ).at (0 )), const Rect .fromLTWH (0.0 , 48 .0 , 800.0 , 0.0 ));
352
352
expect (tester.getRect (find.byType (AnimatedSize ).at (1 )), rect1);
353
353
expect (tester.getRect (find.byType (AnimatedSize ).at (2 )), rect2);
354
354
355
355
await tester.pumpAndSettle ();
356
- expect (tester.getRect (find.byType (AnimatedSize ).at (0 )), const Rect .fromLTWH (0.0 , 56 .0 , 800.0 , 0.0 ));
357
- expect (tester.getRect (find.byType (AnimatedSize ).at (1 )), const Rect .fromLTWH (0.0 , 56 .0 + 1.0 + 56 .0 , 800.0 , 0.0 ));
358
- expect (tester.getRect (find.byType (AnimatedSize ).at (2 )), const Rect .fromLTWH (0.0 , 56 .0 + 1.0 + 56 .0 + 16.0 + 16.0 + 48.0 + 16.0 , 800.0 , 100.0 ));
356
+ expect (tester.getRect (find.byType (AnimatedSize ).at (0 )), const Rect .fromLTWH (0.0 , 48 .0 , 800.0 , 0.0 ));
357
+ expect (tester.getRect (find.byType (AnimatedSize ).at (1 )), const Rect .fromLTWH (0.0 , 48 .0 + 1.0 + 48 .0 , 800.0 , 0.0 ));
358
+ expect (tester.getRect (find.byType (AnimatedSize ).at (2 )), const Rect .fromLTWH (0.0 , 48 .0 + 1.0 + 48 .0 + 16.0 + 16.0 + 48.0 + 16.0 , 800.0 , 100.0 ));
359
359
});
360
360
361
361
testWidgets ('Radio mode has max of one panel open at a time' , (WidgetTester tester) async {
@@ -1286,7 +1286,7 @@ void main() {
1286
1286
// No padding applied to closed header
1287
1287
RenderBox box = tester.renderObject (find.ancestor (of: find.byKey (firstPanelKey), matching: find.byType (AnimatedContainer )).first);
1288
1288
expect (box.size.height, equals (48.0 )); // _kPanelHeaderCollapsedHeight
1289
- expect (box.size.width, equals (736 .0 ));
1289
+ expect (box.size.width, equals (744 .0 ));
1290
1290
1291
1291
// Now, expand the child panel.
1292
1292
await tester.tap (find.byKey (firstPanelKey));
@@ -1298,8 +1298,57 @@ void main() {
1298
1298
1299
1299
// Padding is added to expanded header
1300
1300
box = tester.renderObject (find.ancestor (of: find.byKey (firstPanelKey), matching: find.byType (AnimatedContainer )).first);
1301
- expect (box.size.height, equals (80.0 )); // _kPanelHeaderCollapsedHeight + 32.0 (double default padding)
1302
- expect (box.size.width, equals (736.0 ));
1301
+ expect (box.size.height, equals (80.0 )); // _kPanelHeaderCollapsedHeight + 24.0 (double default padding)
1302
+ expect (box.size.width, equals (744.0 ));
1303
+ });
1304
+
1305
+ // Regression test for https://github.com/flutter/flutter/issues/5848.
1306
+ testWidgets ('The AnimatedContainer and IconButton have the same height of 48px' , (WidgetTester tester) async {
1307
+ const Key firstPanelKey = Key ('firstPanelKey' );
1308
+
1309
+ await tester.pumpWidget (
1310
+ const MaterialApp (
1311
+ home: SingleChildScrollView (
1312
+ child: SimpleExpansionPanelListTestWidget (
1313
+ firstPanelKey: firstPanelKey,
1314
+ canTapOnHeader: true ,
1315
+ ),
1316
+ ),
1317
+ ),
1318
+ );
1319
+
1320
+ // The panel is closed.
1321
+ expect (find.text ('A' ), findsOneWidget);
1322
+ expect (find.text ('B' ), findsNothing);
1323
+
1324
+ // No padding applied to closed header.
1325
+ final RenderBox boxOfContainer = tester.renderObject (find.ancestor (of: find.byKey (firstPanelKey), matching: find.byType (AnimatedContainer )).first);
1326
+ final RenderBox boxOfIconButton = tester.renderObject (find.byType (IconButton ).first);
1327
+ expect (boxOfContainer.size.height, equals (boxOfIconButton.size.height));
1328
+ expect (boxOfContainer.size.height, equals (48.0 )); // Header should have 48px height according to Material 2 Design spec.
1329
+ });
1330
+
1331
+ testWidgets ("The AnimatedContainer's height is at least kMinInteractiveDimension" , (WidgetTester tester) async {
1332
+ const Key firstPanelKey = Key ('firstPanelKey' );
1333
+
1334
+ await tester.pumpWidget (
1335
+ const MaterialApp (
1336
+ home: SingleChildScrollView (
1337
+ child: SimpleExpansionPanelListTestWidget (
1338
+ firstPanelKey: firstPanelKey,
1339
+ canTapOnHeader: true ,
1340
+ ),
1341
+ ),
1342
+ ),
1343
+ );
1344
+
1345
+ // The panel is closed
1346
+ expect (find.text ('A' ), findsOneWidget);
1347
+ expect (find.text ('B' ), findsNothing);
1348
+
1349
+ // No padding applied to closed header
1350
+ final RenderBox box = tester.renderObject (find.ancestor (of: find.byKey (firstPanelKey), matching: find.byType (AnimatedContainer )).first);
1351
+ expect (box.size.height, greaterThanOrEqualTo (kMinInteractiveDimension));
1303
1352
});
1304
1353
1305
1354
testWidgets ('Correct custom header padding' , (WidgetTester tester) async {
@@ -1324,7 +1373,7 @@ void main() {
1324
1373
// No padding applied to closed header
1325
1374
RenderBox box = tester.renderObject (find.ancestor (of: find.byKey (firstPanelKey), matching: find.byType (AnimatedContainer )).first);
1326
1375
expect (box.size.height, equals (48.0 )); // _kPanelHeaderCollapsedHeight
1327
- expect (box.size.width, equals (736 .0 ));
1376
+ expect (box.size.width, equals (744 .0 ));
1328
1377
1329
1378
// Now, expand the child panel.
1330
1379
await tester.tap (find.byKey (firstPanelKey));
@@ -1337,7 +1386,7 @@ void main() {
1337
1386
// Padding is added to expanded header
1338
1387
box = tester.renderObject (find.ancestor (of: find.byKey (firstPanelKey), matching: find.byType (AnimatedContainer )).first);
1339
1388
expect (box.size.height, equals (128.0 )); // _kPanelHeaderCollapsedHeight + 80.0 (double padding)
1340
- expect (box.size.width, equals (736 .0 ));
1389
+ expect (box.size.width, equals (744 .0 ));
1341
1390
});
1342
1391
1343
1392
testWidgets ('ExpansionPanelList respects dividerColor' , (WidgetTester tester) async {
0 commit comments