Don't change the height of the Textfield's labelStyle when it focused. (#141943)
Fixes #141448
This commit is contained in:
parent
be031cb908
commit
24e7a0be8b
@ -2123,9 +2123,9 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
|
||||
|
||||
return themeData.textTheme.titleMedium!
|
||||
.merge(widget.baseStyle)
|
||||
.copyWith(height: 1)
|
||||
.merge(defaultTextStyle)
|
||||
.merge(style);
|
||||
.merge(style)
|
||||
.copyWith(height: 1);
|
||||
}
|
||||
|
||||
TextStyle _getHelperStyle(ThemeData themeData, InputDecorationTheme defaults) {
|
||||
|
@ -7022,4 +7022,29 @@ testWidgets('OutlineInputBorder with BorderRadius.zero should draw a rectangular
|
||||
reason: 'clamp is expected',
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('Ensure the height of labelStyle remains unchanged when TextField is focused.', (WidgetTester tester) async {
|
||||
final FocusNode focusNode = FocusNode();
|
||||
addTearDown(focusNode.dispose);
|
||||
final ThemeData theme = ThemeData(useMaterial3: true);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: theme,
|
||||
home: Material(
|
||||
child: TextField(
|
||||
focusNode: focusNode,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'label',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
final TextStyle beforeStyle = getLabelStyle(tester);
|
||||
// Focused.
|
||||
focusNode.requestFocus();
|
||||
await tester.pumpAndSettle();
|
||||
expect(getLabelStyle(tester).height, beforeStyle.height);
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user