@@ -71,6 +71,7 @@ void main() {
71
71
expect (themeData.brightness, null );
72
72
expect (themeData.elevation, null );
73
73
expect (themeData.pressElevation, null );
74
+ expect (themeData.iconTheme, null );
74
75
});
75
76
76
77
testWidgetsWithLeakTracking ('Default ChipThemeData debugFillProperties' , (WidgetTester tester) async {
@@ -108,14 +109,15 @@ void main() {
108
109
brightness: Brightness .dark,
109
110
elevation: 5 ,
110
111
pressElevation: 6 ,
112
+ iconTheme: IconThemeData (color: Color (0xffffff10 )),
111
113
).debugFillProperties (builder);
112
114
113
115
final List <String > description = builder.properties
114
116
.where ((DiagnosticsNode node) => ! node.isFiltered (DiagnosticLevel .info))
115
117
.map ((DiagnosticsNode node) => node.toString ())
116
118
.toList ();
117
119
118
- expect (description, < String > [
120
+ expect (description, equalsIgnoringHashCodes ( < String > [
119
121
'color: MaterialStatePropertyAll(Color(0xfffffff0))' ,
120
122
'backgroundColor: Color(0xfffffff1)' ,
121
123
'deleteIconColor: Color(0xfffffff2)' ,
@@ -136,7 +138,8 @@ void main() {
136
138
'brightness: dark' ,
137
139
'elevation: 5.0' ,
138
140
'pressElevation: 6.0' ,
139
- ]);
141
+ 'iconTheme: IconThemeData#00000(color: Color(0xffffff10))'
142
+ ]));
140
143
});
141
144
142
145
testWidgetsWithLeakTracking ('Chip uses ThemeData chip theme' , (WidgetTester tester) async {
@@ -868,6 +871,63 @@ void main() {
868
871
// Enabled & selected chip should have the provided selectedColor.
869
872
expect (getMaterialBox (tester), paints..rrect (color: chipTheme.selectedColor));
870
873
});
874
+
875
+ // This is a regression test for https://github.com/flutter/flutter/issues/119163.
876
+ testWidgetsWithLeakTracking ('RawChip respects checkmark properties from ChipTheme' , (WidgetTester tester) async {
877
+ Widget buildRawChip ({ChipThemeData ? chipTheme}) {
878
+ return MaterialApp (
879
+ theme: ThemeData .light (useMaterial3: false ).copyWith (
880
+ chipTheme: chipTheme,
881
+ ),
882
+ home: Directionality (
883
+ textDirection: TextDirection .ltr,
884
+ child: Material (
885
+ child: Center (
886
+ child: RawChip (
887
+ selected: true ,
888
+ label: const SizedBox (width: 100 , height: 100 ),
889
+ onSelected: (bool newValue) { },
890
+ ),
891
+ ),
892
+ ),
893
+ ),
894
+ );
895
+ }
896
+
897
+ // Test that the checkmark is painted.
898
+ await tester.pumpWidget (buildRawChip (
899
+ chipTheme: const ChipThemeData (
900
+ checkmarkColor: Color (0xffff0000 ),
901
+ ),
902
+ ));
903
+
904
+ RenderBox materialBox = getMaterialBox (tester);
905
+ expect (
906
+ materialBox,
907
+ paints..path (
908
+ color: const Color (0xffff0000 ),
909
+ style: PaintingStyle .stroke,
910
+ ),
911
+ );
912
+
913
+ // Test that the checkmark is not painted when ChipThemeData.showCheckmark is false.
914
+ await tester.pumpWidget (buildRawChip (
915
+ chipTheme: const ChipThemeData (
916
+ showCheckmark: false ,
917
+ checkmarkColor: Color (0xffff0000 ),
918
+ ),
919
+ ));
920
+ await tester.pumpAndSettle ();
921
+
922
+ materialBox = getMaterialBox (tester);
923
+ expect (
924
+ materialBox,
925
+ isNot (paints..path (
926
+ color: const Color (0xffff0000 ),
927
+ style: PaintingStyle .stroke,
928
+ )),
929
+ );
930
+ });
871
931
}
872
932
873
933
class _MaterialStateOutlinedBorder extends StadiumBorder implements MaterialStateOutlinedBorder {
0 commit comments