File tree 2 files changed +28
-2
lines changed 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -4570,7 +4570,7 @@ class _InputDecoratorDefaultsM2 extends InputDecorationTheme {
4570
4570
4571
4571
@override
4572
4572
TextStyle ? get helperStyle => MaterialStateTextStyle .resolveWith ((Set <MaterialState > states) {
4573
- final ThemeData themeData= Theme .of (context);
4573
+ final ThemeData themeData = Theme .of (context);
4574
4574
if (states.contains (MaterialState .disabled)) {
4575
4575
return themeData.textTheme.bodySmall! .copyWith (color: Colors .transparent);
4576
4576
}
@@ -4580,7 +4580,7 @@ class _InputDecoratorDefaultsM2 extends InputDecorationTheme {
4580
4580
4581
4581
@override
4582
4582
TextStyle ? get errorStyle => MaterialStateTextStyle .resolveWith ((Set <MaterialState > states) {
4583
- final ThemeData themeData= Theme .of (context);
4583
+ final ThemeData themeData = Theme .of (context);
4584
4584
if (states.contains (MaterialState .disabled)) {
4585
4585
return themeData.textTheme.bodySmall! .copyWith (color: Colors .transparent);
4586
4586
}
@@ -4630,6 +4630,9 @@ class _InputDecoratorDefaultsM2 extends InputDecorationTheme {
4630
4630
if (states.contains (MaterialState .disabled) && ! states.contains (MaterialState .focused)) {
4631
4631
return Theme .of (context).disabledColor;
4632
4632
}
4633
+ if (states.contains (MaterialState .error)) {
4634
+ return Theme .of (context).colorScheme.error;
4635
+ }
4633
4636
if (states.contains (MaterialState .focused)) {
4634
4637
return Theme .of (context).colorScheme.primary;
4635
4638
}
Original file line number Diff line number Diff line change @@ -8885,6 +8885,29 @@ void main() {
8885
8885
expect (tester.getTopRight (find.text ('text' )).dx, lessThanOrEqualTo (tester.getTopLeft (find.byIcon (Icons .satellite)).dx));
8886
8886
});
8887
8887
8888
+ testWidgets ('Material2 - InputDecorator suffixIcon color in error state' , (WidgetTester tester) async {
8889
+ await tester.pumpWidget (
8890
+ MaterialApp (
8891
+ theme: ThemeData (useMaterial3: false ),
8892
+ home: Material (
8893
+ child: TextField (
8894
+ decoration: InputDecoration (
8895
+ suffixIcon: IconButton (
8896
+ icon: const Icon (Icons .close),
8897
+ onPressed: () {},
8898
+ ),
8899
+ errorText: 'Error state' ,
8900
+ filled: true ,
8901
+ ),
8902
+ ),
8903
+ ),
8904
+ ),
8905
+ );
8906
+
8907
+ final ThemeData theme = Theme .of (tester.element (find.byType (TextField )));
8908
+ expect (getIconStyle (tester, Icons .close)? .color, theme.colorScheme.error);
8909
+ });
8910
+
8888
8911
testWidgets ('InputDecorator prefixIconConstraints/suffixIconConstraints' , (WidgetTester tester) async {
8889
8912
await tester.pumpWidget (
8890
8913
buildInputDecoratorM2 (
You can’t perform that action at this time.
0 commit comments