Update enabled color for outlined text fields. (#33083)
Resets the enabled color for outline text field default borders to "On Surface 38%" instead of "On Surface 12%" to match spec. Also fixes the hover overlay to be "On Surface 12%" to match spec.
diff --git a/packages/flutter/lib/src/material/input_decorator.dart b/packages/flutter/lib/src/material/input_decorator.dart
index 7275c96..2e982d7 100644
--- a/packages/flutter/lib/src/material/input_decorator.dart
+++ b/packages/flutter/lib/src/material/input_decorator.dart
@@ -1830,11 +1830,12 @@
if (decoration.filled) {
return themeData.hintColor;
}
+ final Color enabledColor = themeData.colorScheme.onSurface.withOpacity(0.38);
if (isHovering) {
final Color hoverColor = decoration.hoverColor ?? themeData.inputDecorationTheme?.hoverColor ?? themeData.hoverColor;
- return Color.alphaBlend(hoverColor.withOpacity(0.16), themeData.colorScheme.onSurface.withOpacity(0.12));
+ return Color.alphaBlend(hoverColor.withOpacity(0.12), enabledColor);
}
- return themeData.colorScheme.onSurface.withOpacity(0.12);
+ return enabledColor;
}
Color _getFillColor(ThemeData themeData) {
diff --git a/packages/flutter/test/material/input_decorator_test.dart b/packages/flutter/test/material/input_decorator_test.dart
index 49acdbe..e46292e 100644
--- a/packages/flutter/test/material/input_decorator_test.dart
+++ b/packages/flutter/test/material/input_decorator_test.dart
@@ -2048,7 +2048,7 @@
const Color fillColor = Color(0x0A000000);
const Color hoverColor = Color(0xFF00FF00);
const Color disabledColor = Color(0x05000000);
- const Color enabledBorderColor = Color(0x1f000000);
+ const Color enabledBorderColor = Color(0x61000000);
Future<void> pumpDecorator({bool hovering, bool enabled = true, bool filled = true}) async {
return await tester.pumpWidget(
@@ -2092,7 +2092,7 @@
expect(getContainerColor(tester), equals(disabledColor));
// Test outline text field.
- const Color blendedHoverColor = Color(0x43009c00);
+ const Color blendedHoverColor = Color(0x74004400);
await pumpDecorator(hovering: false, filled: false);
await tester.pumpAndSettle();
expect(getBorderColor(tester), equals(enabledBorderColor));
@@ -2123,7 +2123,7 @@
testWidgets('InputDecorator draws and animates focusColor', (WidgetTester tester) async {
const Color focusColor = Color(0xFF0000FF);
const Color disabledColor = Color(0x05000000);
- const Color enabledBorderColor = Color(0x1f000000);
+ const Color enabledBorderColor = Color(0x61000000);
Future<void> pumpDecorator({bool focused, bool enabled = true, bool filled = true}) async {
return await tester.pumpWidget(