Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a9c77ed

Browse files
authored
Revert "Fix ExpansionTile shows children background when expanded (#107834)"
This reverts commit e368e58.
1 parent fd0da75 commit a9c77ed

File tree

2 files changed

+5
-55
lines changed

2 files changed

+5
-55
lines changed

packages/flutter/lib/src/material/expansion_tile.dart

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import 'expansion_tile_theme.dart';
1010
import 'icons.dart';
1111
import 'list_tile.dart';
1212
import 'list_tile_theme.dart';
13-
import 'material.dart';
1413
import 'theme.dart';
1514

1615
const Duration _kExpand = Duration(milliseconds: 200);
@@ -433,13 +432,11 @@ class _ExpansionTileState extends State<ExpansionTile> with SingleTickerProvider
433432
offstage: closed,
434433
child: TickerMode(
435434
enabled: !closed,
436-
child: Material(
437-
child: Padding(
438-
padding: widget.childrenPadding ?? expansionTileTheme.childrenPadding ?? EdgeInsets.zero,
439-
child: Column(
440-
crossAxisAlignment: widget.expandedCrossAxisAlignment ?? CrossAxisAlignment.center,
441-
children: widget.children,
442-
),
435+
child: Padding(
436+
padding: widget.childrenPadding ?? expansionTileTheme.childrenPadding ?? EdgeInsets.zero,
437+
child: Column(
438+
crossAxisAlignment: widget.expandedCrossAxisAlignment ?? CrossAxisAlignment.center,
439+
children: widget.children,
443440
),
444441
),
445442
),

packages/flutter/test/material/expansion_tile_test.dart

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import 'package:flutter/material.dart';
66
import 'package:flutter_test/flutter_test.dart';
77

8-
import '../rendering/mock_canvas.dart';
9-
108
class TestIcon extends StatefulWidget {
119
const TestIcon({super.key});
1210

@@ -483,51 +481,6 @@ void main() {
483481
expect(columnRect.bottom, paddingRect.bottom - 4);
484482
});
485483

486-
testWidgets('ExpansionTile adds a Material widget above its children when expanded', (WidgetTester tester) async {
487-
// Regression test for https://github.com/flutter/flutter/issues/107030
488-
const Color childColor = Color(0xff4caf50);
489-
490-
await tester.pumpWidget(
491-
const MaterialApp(
492-
home: Material(
493-
child: Center(
494-
child: ExpansionTile(
495-
title: Text('title'),
496-
childrenPadding: EdgeInsets.fromLTRB(10, 8, 12, 4),
497-
children: <Widget>[
498-
ListTile(tileColor: childColor),
499-
],
500-
),
501-
),
502-
),
503-
),
504-
);
505-
506-
final Finder rootMaterialFinder = find.ancestor(
507-
of: find.byType(ExpansionTile),
508-
matching: find.byType(Material),
509-
);
510-
511-
final Finder expansionTileMaterialFinder = find.descendant(
512-
of: find.byType(ExpansionTile),
513-
matching: find.byType(Material),
514-
);
515-
516-
// ExpansionTile should not add a Material widget when it is not expanded
517-
expect(expansionTileMaterialFinder, findsNothing);
518-
519-
// Expand
520-
await tester.tap(find.text('title'));
521-
await tester.pumpAndSettle();
522-
523-
// ExpansionTile adds a Material widget when it is expanded
524-
expect(expansionTileMaterialFinder, findsOneWidget);
525-
526-
// Child color is painted on the inner Material widget
527-
expect(rootMaterialFinder, isNot(paints..path()..path(color: childColor)));
528-
expect(expansionTileMaterialFinder, paints..path(color: childColor));
529-
});
530-
531484
testWidgets('ExpansionTile.collapsedBackgroundColor', (WidgetTester tester) async {
532485
const Key expansionTileKey = Key('expansionTileKey');
533486
const Color backgroundColor = Colors.red;

0 commit comments

Comments
 (0)