Unverified Commit 497a5280 authored by 陈昱's avatar 陈昱 Committed by GitHub

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.
parent 496cf627
......@@ -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);
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment