Are you running your app on the Apple Simulator? Because cursorColor seems to be platform dependent. The documentation for the TextField class states that the cursorColor field
Defaults to [ThemeData.cursorColor] or [CupertinoTheme.primaryColor] depending on [ThemeData.platform].
I had to create a CupertinoThemeData and pass it to the ThemeData of my app in the main.dart file, like this:
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: appBarCursorColorTheme(context),
home: MyHomePage(); // MySearchDelegate contained inside MyHomePage()
);
}
ThemeData appBarCursorColorTheme(BuildContext context) {
final ThemeData theme = Theme.of(context);
CupertinoThemeData ctd =
CupertinoThemeData.raw(null, Colors.white, null, null, null, null);
return theme.copyWith(
cupertinoOverrideTheme: ctd,
);
}