Unverified Commit e0a83e62 authored by Mohammed  CHAHBOUN's avatar Mohammed CHAHBOUN Committed by GitHub

Add splashColor property for ListTile widget (#100652)

parent a490a6a1
...@@ -286,6 +286,7 @@ class ListTile extends StatelessWidget { ...@@ -286,6 +286,7 @@ class ListTile extends StatelessWidget {
this.selected = false, this.selected = false,
this.focusColor, this.focusColor,
this.hoverColor, this.hoverColor,
this.splashColor,
this.focusNode, this.focusNode,
this.autofocus = false, this.autofocus = false,
this.tileColor, this.tileColor,
...@@ -495,6 +496,9 @@ class ListTile extends StatelessWidget { ...@@ -495,6 +496,9 @@ class ListTile extends StatelessWidget {
/// The color for the tile's [Material] when a pointer is hovering over it. /// The color for the tile's [Material] when a pointer is hovering over it.
final Color? hoverColor; final Color? hoverColor;
/// The color of splash for the tile's [Material].
final Color? splashColor;
/// {@macro flutter.widgets.Focus.focusNode} /// {@macro flutter.widgets.Focus.focusNode}
final FocusNode? focusNode; final FocusNode? focusNode;
...@@ -733,6 +737,7 @@ class ListTile extends StatelessWidget { ...@@ -733,6 +737,7 @@ class ListTile extends StatelessWidget {
focusNode: focusNode, focusNode: focusNode,
focusColor: focusColor, focusColor: focusColor,
hoverColor: hoverColor, hoverColor: hoverColor,
splashColor: splashColor,
autofocus: autofocus, autofocus: autofocus,
enableFeedback: enableFeedback ?? tileTheme.enableFeedback ?? true, enableFeedback: enableFeedback ?? tileTheme.enableFeedback ?? true,
child: Semantics( child: Semantics(
......
...@@ -1258,6 +1258,30 @@ void main() { ...@@ -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 { testWidgets('ListTile can be triggered by keyboard shortcuts', (WidgetTester tester) async {
tester.binding.focusManager.highlightStrategy = FocusHighlightStrategy.alwaysTraditional; tester.binding.focusManager.highlightStrategy = FocusHighlightStrategy.alwaysTraditional;
const Key tileKey = Key('ListTile'); const Key tileKey = Key('ListTile');
......
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