@@ -1651,7 +1651,7 @@ void main() {
1651
1651
expect (lastTableRowBoxDecoration ().color, disabledColor);
1652
1652
});
1653
1653
1654
- testWidgetsWithLeakTracking ('DataRow renders custom colors when pressed' , (WidgetTester tester) async {
1654
+ testWidgetsWithLeakTracking ('Material2 - DataRow renders custom colors when pressed' , (WidgetTester tester) async {
1655
1655
const Color pressedColor = Color (0xff4caf50 );
1656
1656
Widget buildTable () {
1657
1657
return DataTable (
@@ -1691,6 +1691,53 @@ void main() {
1691
1691
await gesture.up ();
1692
1692
});
1693
1693
1694
+ testWidgetsWithLeakTracking ('Material3 - DataRow renders custom colors when pressed' , (WidgetTester tester) async {
1695
+ const Color pressedColor = Color (0xff4caf50 );
1696
+ Widget buildTable () {
1697
+ return DataTable (
1698
+ columns: const < DataColumn > [
1699
+ DataColumn (
1700
+ label: Text ('Column1' ),
1701
+ ),
1702
+ ],
1703
+ rows: < DataRow > [
1704
+ DataRow (
1705
+ color: MaterialStateProperty .resolveWith <Color >(
1706
+ (Set <MaterialState > states) {
1707
+ if (states.contains (MaterialState .pressed)) {
1708
+ return pressedColor;
1709
+ }
1710
+ return Colors .transparent;
1711
+ },
1712
+ ),
1713
+ onSelectChanged: (bool ? value) {},
1714
+ cells: const < DataCell > [
1715
+ DataCell (Text ('Content1' )),
1716
+ ],
1717
+ ),
1718
+ ],
1719
+ );
1720
+ }
1721
+
1722
+ await tester.pumpWidget (MaterialApp (
1723
+ theme: ThemeData (),
1724
+ home: Material (child: buildTable ()),
1725
+ ));
1726
+
1727
+ final TestGesture gesture = await tester.startGesture (tester.getCenter (find.text ('Content1' )));
1728
+ await tester.pump (const Duration (milliseconds: 200 )); // splash is well underway
1729
+ final RenderBox box = Material .of (tester.element (find.byType (InkWell )))as RenderBox ;
1730
+ // Material 3 uses the InkSparkle which uses a shader, so we can't capture
1731
+ // the effect with paint methods.
1732
+ expect (
1733
+ box,
1734
+ paints
1735
+ ..rect ()
1736
+ ..rect (rect: const Rect .fromLTRB (0.0 , 56.0 , 800.0 , 104.0 ), color: pressedColor.withOpacity (0.0 )),
1737
+ );
1738
+ await gesture.up ();
1739
+ });
1740
+
1694
1741
testWidgetsWithLeakTracking ('DataTable can render inside an AlertDialog' , (WidgetTester tester) async {
1695
1742
await tester.pumpWidget (
1696
1743
MaterialApp (
0 commit comments