Unverified Commit 750516a1 authored by Taha Tesser's avatar Taha Tesser Committed by GitHub

Fix `ListTile` theme shape in a drawer (#106343)

parent 255b71f1
......@@ -683,7 +683,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
@override
Widget build(BuildContext context) {
assert(debugCheckHasMaterialLocalizations(context));
return ListTileTheme(
return ListTileTheme.merge(
style: ListTileStyle.drawer,
child: _buildDrawer(context),
);
......
......@@ -444,4 +444,37 @@ void main() {
expect(find.byType(Material), paints..path(color: selectedTileColor));
});
testWidgets('ListTile uses ListTileTheme shape in a drawer', (WidgetTester tester) async {
// This is a regression test for https://github.com/flutter/flutter/issues/106303
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
final ShapeBorder shapeBorder = RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0));
await tester.pumpWidget(MaterialApp(
theme: ThemeData(
listTileTheme: ListTileThemeData(shape: shapeBorder),
),
home: Scaffold(
key: scaffoldKey,
drawer: const Drawer(
child: ListTile(),
),
body: Container(),
),
));
await tester.pumpAndSettle();
scaffoldKey.currentState!.openDrawer();
// Start drawer animation.
await tester.pump();
final ShapeBorder? inkWellBorder = tester.widget<InkWell>(
find.descendant(
of: find.byType(ListTile),
matching: find.byType(InkWell),
)).customBorder;
// Test shape.
expect(inkWellBorder, shapeBorder);
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment