-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Closed
Copy link
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.22Found to occur in 3.22Found to occur in 3.22found in release: 3.23Found to occur in 3.23Found to occur in 3.23frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-text-inputOwned by Text Input teamOwned by Text Input team
Description
Steps to reproduce
- Copy the given test inside packages/flutter/test/material/input_decorator_test.dart
- Run it.
Expected results
The test succeeds as the expected color from M3 spec is onErrorContainer, see https://m3.material.io/components/text-fields/specs#e4964192-72ad-414f-85b4-4b4357abb83c
Actual results
The test failed be cause the actual color is colorScheme.error.
Code sample
Code sample
const IconData suffixIcon = Icons.cancel_outlined;
Finder findSuffixIcon() {
return find.byIcon(suffixIcon);
}
Rect getSuffixIconRect(WidgetTester tester) {
return tester.getRect(findSuffixIcon());
}
Finder findSuffixIconInnerRichText() {
return find.descendant(of: findSuffixIcon(), matching: find.byType(RichText));
}
TextStyle getSuffixIconStyle(WidgetTester tester) {
return tester.widget<RichText>(findSuffixIconInnerRichText()).text.style!;
}
testWidgets('suffixIcon has correct color when in error state and hovered', (WidgetTester tester) async {
await tester.pumpWidget(
buildInputDecorator(
isHovering: true,
decoration: const InputDecoration(
border: OutlineInputBorder(),
labelText: labelText,
errorText: errorText,
suffixIcon: Icon(suffixIcon),
),
),
);
final ThemeData theme = Theme.of(tester.element(findSuffixIcon()));
final Color expectedColor = theme.colorScheme.onErrorContainer;
expect(getSuffixIconStyle(tester).color, expectedColor);
});
Screenshots or Video
No response
Logs
Logs
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure was thrown running a test:
Expected: Color:<Color(0xff410e0b)>
Actual: Color:<Color(0xffb3261e)>
When the exception was thrown, this was the stack:
#4 main.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (file:///home/bruno/Nevercode/flutter/packages/flutter/test/material/input_decorator_test.dart:6266:3)
<asynchronous suspension>
#5 testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:183:15)
<asynchronous suspension>
#6 TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:1025:5)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from package:stack_trace)
This was caught by the test expectation on the following line:
file:///home/bruno/Nevercode/flutter/packages/flutter/test/material/input_decorator_test.dart line 6266
The test description was:
suffixIcon has correct color when in error state and hovered
════════════════════════════════════════════════════════════════════════════════════════════════════Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel [user-branch], 3.22.0-18.0.pre.572, on Ubuntu 24.04 LTS
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.22Found to occur in 3.22Found to occur in 3.22found in release: 3.23Found to occur in 3.23Found to occur in 3.23frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-text-inputOwned by Text Input teamOwned by Text Input team
Type
Projects
Status
Done (PR merged)
