-
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.22frameworkflutter/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 to packages/flutter/test/material/input_decorator_test.dart
- Run it
Expected results
The text succeeds because the default hint style for M3 should be bodyLarge with the color set to onSurfaceVariant.
These information are available in the M3 Figma Kit.
See this Figma screenshot taken while focusing on the 'Placeholder' text (which corresponds to hint).
Actual results
The test fails
Code sample
Code sample
testWidgets('hint style is compliant with M3 spec', (WidgetTester tester) async {
await tester.pumpWidget(
buildInputDecorator(
isEmpty: true,
decoration: const InputDecoration(
filled: true,
hintText: hintText,
),
),
);
// Hint is visible because decorator is empty.
expect(getHintOpacity(tester), 1.0);
final ThemeData theme = Theme.of(tester.element(findDecorator()));
final Color expectedColor = theme.colorScheme.onSurfaceVariant;
final TextStyle expectedStyle = theme.textTheme.bodyLarge!.copyWith(color: expectedColor);
expect(getHintStyle(tester), expectedStyle);
});Logs
Logs
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure was thrown running a test:
Expected: TextStyle:<TextStyle(debugLabel: ((englishLike bodyLarge 2021).merge((blackMountainView
bodyLarge).apply)).copyWith, inherit: false, color: Color(0xff49454f), family: Roboto, size: 16.0,
weight: 400, letterSpacing: 0.5, baseline: alphabetic, height: 1.5x, leadingDistribution: even,
decoration: Color(0xff1d1b20) TextDecoration.none)>
Actual: TextStyle:<TextStyle(debugLabel: ((englishLike titleMedium 2021).merge((blackMountainView
titleMedium).apply)).merge(unknown), inherit: false, color: Color(0x99000000), family: Roboto, size:
16.0, weight: 500, letterSpacing: 0.1, baseline: alphabetic, height: 1.5x, leadingDistribution:
even, decoration: Color(0xff1d1b20) TextDecoration.none)>
When the exception was thrown, this was the stack:
#4 main.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (file:///Users/bruno/Nevercode/flutter/packages/flutter/test/material/input_decorator_test.dart:2840:11)
<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:1017:5)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from package:stack_trace)
This was caught by the test expectation on the following line:
file:///Users/bruno/Nevercode/flutter/packages/flutter/test/material/input_decorator_test.dart line 2840
The test description was:
hint style is compliant with M3 spec
════════════════════════════════════════════════════════════════════════════════════════════════════Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel master, 3.22.0-36.0.pre.51, on macOS 14.2.1 23C71
darwin-arm64, locale fr-FR)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.22frameworkflutter/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)
