Update CupertinoTextField (#29008)

This commit is contained in:
Luka Knezic 2019-03-22 19:21:06 +01:00 committed by xster
parent 475d93a172
commit fa2fd11275
2 changed files with 18 additions and 1 deletions

View File

@ -672,6 +672,7 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with AutomaticK
final CupertinoThemeData themeData = CupertinoTheme.of(context);
final TextStyle textStyle = themeData.textTheme.textStyle.merge(widget.style);
final Brightness keyboardAppearance = widget.keyboardAppearance ?? themeData.brightness;
final Color cursorColor = widget.cursorColor ?? themeData.primaryColor;
final Widget paddedEditable = Padding(
padding: widget.padding,
@ -702,7 +703,7 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with AutomaticK
rendererIgnoresPointer: true,
cursorWidth: widget.cursorWidth,
cursorRadius: widget.cursorRadius,
cursorColor: themeData.primaryColor,
cursorColor: cursorColor,
cursorOpacityAnimates: true,
cursorOffset: cursorOffset,
paintCursorAboveText: true,

View File

@ -1918,4 +1918,20 @@ void main() {
await tester.pump();
expect(renderEditable.cursorColor, const Color(0xFFF44336));
});
testWidgets('cursor can override color from theme', (WidgetTester tester) async {
await tester.pumpWidget(
const CupertinoApp(
theme: CupertinoThemeData(),
home: Center(
child: CupertinoTextField(
cursorColor: Color(0xFFF44336),
),
),
),
);
final EditableText editableText = tester.firstWidget(find.byType(EditableText));
expect(editableText.cursorColor, const Color(0xFFF44336));
});
}