The default Hint(Place Holder) text color of TextField is Grey. Today we will change TextField hint color using hintStyle property of decoration. We can pass any Text Style in hintStyle and make hint text bold, Italic, update font style, font color.
Flutter Change TextField Hint Color
1. Creating TextField and define hintStyle with Color of Hint text.
TextField(
autocorrect: true,
decoration: InputDecoration(
hintText: 'Type Text Here...',
hintStyle: TextStyle(color: Colors.red),
filled: true,
fillColor: Colors.white,
))
Screenshot:
import 'package:flutter/material.dart';
void main() => runApp(const App());
class App extends StatelessWidget {
const App({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: Scaffold(
body: Center(
child: SizedBox(
width: 280,
child: TextField(
autocorrect: true,
decoration: InputDecoration(
hintText: 'Type Text Here...',
hintStyle: TextStyle(color: Colors.red),
filled: true,
fillColor: Colors.white,
))))));
}
}
Comments
Post a Comment