Dears, I have 2 qestions in flutter If you don't mind.
1- How to change the color of the cursor as it default blue and I don't like it
2- how can I make the text at the bottom of the screen whatever the screen size. ??
Thank you in advance.
To change TextField cursor color in Flutter, simply add the cursorColor property and set the color of your choice.
Example: Change TextField Cursor Color In this Flutter Application, we shall create a TextField and change the cursor color to red. Run the above Flutter Application in an Android smartphone or Android Emulator, and you should see that the cursor color changed to red as shown in the following screenshot.
you can play around with input decoration parameter content-padding to reduce space between The limit area of text field and the TextForm style parameter to make text and cursor height bigger.
put cursorColor: Colors.white,
inside the TextFormField
This works fine in both iOS and Android:
TextField(cursorColor: Colors.white)
But, if you like to set it in theme then
SOLUTION 1 - Original answer, recently not tested, also, seems it's deprecated:
I found the solution here:
import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; MaterialApp( title: "Rate your Colleagues", theme: ThemeData( // for iOS cupertinoOverrideTheme: CupertinoThemeData( primaryColor: Colors.red, ), // for others(Android, Fuchsia) cursorColor: Colors.red, home: SplashScreen(), ); ...
SOLUTION 2 - edited answer - not tested - please give credit to @i4guar
I found the solution here:
MaterialApp( title: "Rate your Colleagues", theme: ThemeData( textSelectionTheme: TextSelectionThemeData( cursorColor: darkPrimarySwatchColor, selectionColor: darkPrimarySwatchColor, selectionHandleColor: darkPrimarySwatchColor, ), ), home: SplashScreen(), );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With