@@ -1651,7 +1651,7 @@ void main() {
16511651 expect (lastTableRowBoxDecoration ().color, disabledColor);
16521652 });
16531653
1654- testWidgetsWithLeakTracking ('DataRow renders custom colors when pressed' , (WidgetTester tester) async {
1654+ testWidgetsWithLeakTracking ('Material2 - DataRow renders custom colors when pressed' , (WidgetTester tester) async {
16551655 const Color pressedColor = Color (0xff4caf50 );
16561656 Widget buildTable () {
16571657 return DataTable (
@@ -1691,6 +1691,53 @@ void main() {
16911691 await gesture.up ();
16921692 });
16931693
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+
16941741 testWidgetsWithLeakTracking ('DataTable can render inside an AlertDialog' , (WidgetTester tester) async {
16951742 await tester.pumpWidget (
16961743 MaterialApp (
0 commit comments