diff --git a/dev/tools/gen_defaults/generated/used_tokens.csv b/dev/tools/gen_defaults/generated/used_tokens.csv index 8b674a4fc6b7..87120d20dcc6 100644 --- a/dev/tools/gen_defaults/generated/used_tokens.csv +++ b/dev/tools/gen_defaults/generated/used_tokens.csv @@ -238,6 +238,8 @@ md.comp.filled-text-field.disabled.container.color, md.comp.filled-text-field.disabled.container.opacity, md.comp.filled-text-field.disabled.label-text.color, md.comp.filled-text-field.disabled.label-text.opacity, +md.comp.filled-text-field.disabled.leading-icon.color, +md.comp.filled-text-field.disabled.leading-icon.opacity, md.comp.filled-text-field.disabled.supporting-text.color, md.comp.filled-text-field.disabled.supporting-text.opacity, md.comp.filled-text-field.disabled.trailing-icon.color, diff --git a/dev/tools/gen_defaults/lib/input_decorator_template.dart b/dev/tools/gen_defaults/lib/input_decorator_template.dart index a73472f0676d..3fb208b8fb70 100644 --- a/dev/tools/gen_defaults/lib/input_decorator_template.dart +++ b/dev/tools/gen_defaults/lib/input_decorator_template.dart @@ -97,10 +97,10 @@ class _${blockName}DefaultsM3 extends InputDecorationTheme { Color? get iconColor => ${componentColor("md.comp.filled-text-field.leading-icon")}; @override - Color? get prefixIconColor => MaterialStateColor.resolveWith((Set states) {${componentColor('md.comp.filled-text-field.error.leading-icon') == componentColor('md.comp.filled-text-field.leading-icon') ? '' : ''' + Color? get prefixIconColor => MaterialStateColor.resolveWith((Set states) { if (states.contains(MaterialState.disabled)) { return ${componentColor('md.comp.filled-text-field.disabled.leading-icon')}; - } + }${componentColor('md.comp.filled-text-field.error.leading-icon') == componentColor('md.comp.filled-text-field.leading-icon') ? '' : ''' if (states.contains(MaterialState.error)) { if (states.contains(MaterialState.hovered)) { return ${componentColor('md.comp.filled-text-field.error.hover.leading-icon')}; diff --git a/packages/flutter/lib/src/material/input_decorator.dart b/packages/flutter/lib/src/material/input_decorator.dart index 1e2642533eea..66debd86ebff 100644 --- a/packages/flutter/lib/src/material/input_decorator.dart +++ b/packages/flutter/lib/src/material/input_decorator.dart @@ -4736,6 +4736,9 @@ class _InputDecoratorDefaultsM3 extends InputDecorationTheme { @override Color? get prefixIconColor => MaterialStateColor.resolveWith((Set states) { + if (states.contains(MaterialState.disabled)) { + return _colors.onSurface.withOpacity(0.38); + } return _colors.onSurfaceVariant; }); diff --git a/packages/flutter/test/material/input_decorator_test.dart b/packages/flutter/test/material/input_decorator_test.dart index 2930e756ea57..c3fbe94d879c 100644 --- a/packages/flutter/test/material/input_decorator_test.dart +++ b/packages/flutter/test/material/input_decorator_test.dart @@ -5443,9 +5443,7 @@ void main() { ); final ThemeData theme = Theme.of(tester.element(findPrefixIcon())); - // TODO(bleroux): based on M3 spec, it should be theme.colorScheme.onSurface.withOpacity(0.38). - // See https://github.com/flutter/flutter/issues/149411. - final Color expectedColor = theme.colorScheme.onSurfaceVariant; + final Color expectedColor = theme.colorScheme.onSurface.withOpacity(0.38); expect(getPrefixIconStyle(tester).color, expectedColor); }); @@ -5921,9 +5919,7 @@ void main() { ); final ThemeData theme = Theme.of(tester.element(findPrefixIcon())); - // TODO(bleroux): based on M3 spec, it should be theme.colorScheme.onSurface.withOpacity(0.38). - // See https://github.com/flutter/flutter/issues/149411. - final Color expectedColor = theme.colorScheme.onSurfaceVariant; + final Color expectedColor = theme.colorScheme.onSurface.withOpacity(0.38); expect(getPrefixIconStyle(tester).color, expectedColor); });