Commit fa2fd112 authored by Luka Knezic's avatar Luka Knezic Committed by xster

Update CupertinoTextField (#29008)

parent 475d93a1
......@@ -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,
......
......@@ -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));
});
}
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