diff --git a/packages/flutter/lib/src/material/list_tile.dart b/packages/flutter/lib/src/material/list_tile.dart index 0ea45078be..9ae0df7d38 100644 --- a/packages/flutter/lib/src/material/list_tile.dart +++ b/packages/flutter/lib/src/material/list_tile.dart @@ -286,6 +286,7 @@ class ListTile extends StatelessWidget { this.selected = false, this.focusColor, this.hoverColor, + this.splashColor, this.focusNode, this.autofocus = false, this.tileColor, @@ -495,6 +496,9 @@ class ListTile extends StatelessWidget { /// The color for the tile's [Material] when a pointer is hovering over it. final Color? hoverColor; + /// The color of splash for the tile's [Material]. + final Color? splashColor; + /// {@macro flutter.widgets.Focus.focusNode} final FocusNode? focusNode; @@ -733,6 +737,7 @@ class ListTile extends StatelessWidget { focusNode: focusNode, focusColor: focusColor, hoverColor: hoverColor, + splashColor: splashColor, autofocus: autofocus, enableFeedback: enableFeedback ?? tileTheme.enableFeedback ?? true, child: Semantics( diff --git a/packages/flutter/test/material/list_tile_test.dart b/packages/flutter/test/material/list_tile_test.dart index 84ce6812a9..d9a0790ec3 100644 --- a/packages/flutter/test/material/list_tile_test.dart +++ b/packages/flutter/test/material/list_tile_test.dart @@ -1258,6 +1258,30 @@ void main() { ); }); + testWidgets('ListTile can be splashed and has correct splash color', (WidgetTester tester) async { + final Widget buildApp = MaterialApp( + home: Material( + child: Center( + child: SizedBox( + width: 100, + height: 100, + child: ListTile( + onTap: () {}, + splashColor: const Color(0xff88ff88), + ), + ), + ), + ), + ); + + await tester.pumpWidget(buildApp); + await tester.pumpAndSettle(); + final TestGesture gesture = await tester.startGesture(tester.getRect(find.byType(ListTile)).center); + await tester.pump(const Duration(milliseconds: 200)); + expect(find.byType(Material), paints..circle(x: 50, y: 50, color: const Color(0xff88ff88))); + await gesture.up(); + }); + testWidgets('ListTile can be triggered by keyboard shortcuts', (WidgetTester tester) async { tester.binding.focusManager.highlightStrategy = FocusHighlightStrategy.alwaysTraditional; const Key tileKey = Key('ListTile');