Fix TextField/CupertinoTextField hint style overflow not work. (#114335)
* fix text field hint style overflow not work, keep default ellipsis. * fix cupertino text field hint style overflow not work, keep default ellipsis. * add Cupertino placeholder style test.
This commit is contained in:
parent
496cf627e6
commit
497a52809d
@ -1133,7 +1133,7 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with Restoratio
|
||||
child: Text(
|
||||
widget.placeholder!,
|
||||
maxLines: widget.maxLines,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
overflow: placeholderStyle.overflow ?? TextOverflow.ellipsis,
|
||||
style: placeholderStyle,
|
||||
textAlign: widget.textAlign,
|
||||
),
|
||||
|
@ -7485,4 +7485,29 @@ void main() {
|
||||
expect(controller.text, cutValue);
|
||||
}
|
||||
});
|
||||
|
||||
testWidgets('placeholder style overflow works', (WidgetTester tester) async {
|
||||
final String placeholder = 'hint text' * 20;
|
||||
const TextStyle placeholderStyle = TextStyle(
|
||||
fontFamily: 'Ahem',
|
||||
fontSize: 14.0,
|
||||
overflow: TextOverflow.fade,
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
CupertinoApp(
|
||||
home: Center(
|
||||
child: CupertinoTextField(
|
||||
placeholder: placeholder,
|
||||
placeholderStyle: placeholderStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
final Finder placeholderFinder = find.text(placeholder);
|
||||
final Text placeholderWidget = tester.widget(placeholderFinder);
|
||||
expect(placeholderWidget.overflow, placeholderStyle.overflow);
|
||||
expect(placeholderWidget.style!.overflow, placeholderStyle.overflow);
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user