Use style attribute of the Text widget, TextStyle class can be used with style attribute to change text color , font size , font weight etc..
Card(
color: Colors.blue,
child: Padding(
padding: EdgeInsets.all(12),
child: Container(
child: const Text("Hello World",
style: TextStyle(color: Colors.white)))))
it give white color to text in the Card widget.
how to apply font style to Text widget in Flutter?
if want to change text normal to italic format then
Text("Hello World",
style: TextStyle(
fontStyle: FontStyle.italic,
color: Colors.white))
fontStyle: FontStyle.italic give italic text style
how to apply font weight to Text widget in Flutter?
now suppose want to applies font weight : bold
Text("Hello World",
style: TextStyle(
fontWeight: FontWeight.bold,
fontStyle: FontStyle.italic,
color: Colors.white))
fontWeight: FontWeight.bold make font bold .
how to apply background color to only Text widget in Flutter?
Text("Hello World",
style: TextStyle(
backgroundColor: Colors.red,
fontWeight: FontWeight.bold,
fontStyle: FontStyle.italic,
color: Colors.white))
backgroundColor: Colors.red, give red background color to Text Widget.