File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -672,6 +672,7 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with AutomaticK
672
672
final CupertinoThemeData themeData = CupertinoTheme .of (context);
673
673
final TextStyle textStyle = themeData.textTheme.textStyle.merge (widget.style);
674
674
final Brightness keyboardAppearance = widget.keyboardAppearance ?? themeData.brightness;
675
+ final Color cursorColor = widget.cursorColor ?? themeData.primaryColor;
675
676
676
677
final Widget paddedEditable = Padding (
677
678
padding: widget.padding,
@@ -702,7 +703,7 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with AutomaticK
702
703
rendererIgnoresPointer: true ,
703
704
cursorWidth: widget.cursorWidth,
704
705
cursorRadius: widget.cursorRadius,
705
- cursorColor: themeData.primaryColor ,
706
+ cursorColor: cursorColor ,
706
707
cursorOpacityAnimates: true ,
707
708
cursorOffset: cursorOffset,
708
709
paintCursorAboveText: true ,
Original file line number Diff line number Diff line change @@ -1918,4 +1918,20 @@ void main() {
1918
1918
await tester.pump ();
1919
1919
expect (renderEditable.cursorColor, const Color (0xFFF44336 ));
1920
1920
});
1921
+
1922
+ testWidgets ('cursor can override color from theme' , (WidgetTester tester) async {
1923
+ await tester.pumpWidget (
1924
+ const CupertinoApp (
1925
+ theme: CupertinoThemeData (),
1926
+ home: Center (
1927
+ child: CupertinoTextField (
1928
+ cursorColor: Color (0xFFF44336 ),
1929
+ ),
1930
+ ),
1931
+ ),
1932
+ );
1933
+
1934
+ final EditableText editableText = tester.firstWidget (find.byType (EditableText ));
1935
+ expect (editableText.cursorColor, const Color (0xFFF44336 ));
1936
+ });
1921
1937
}
You can’t perform that action at this time.
0 commit comments