问题
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.
回答1:
put cursorColor: Colors.white,
inside TextFormField
回答2:
For question 1 you can set the cursorColor
for theme
attribute when calling MaterialApp
like the below
new MaterialApp(
title: "Flutter App",
theme: ThemeData(
cursorColor: Colors.red,
home: HomeScreen(),
)
回答3:
You can use:
TextField( cursorColor: Colors.red),
回答4:
This works fine in both iOS and Android:
TextField(cursorColor: Colors.white)
But, if you like to set it in theme then 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(),
);
...
来源:https://stackoverflow.com/questions/55991901/how-to-change-cursor-color-in-flutter