most Easy Way to add a BackGroundColor to Textbutton
TextButton(
style: TextButton.styleFrom(
backgroundColor: Colors.red),
),
BUT, I also want to change text color:
TextButton(
style: TextButton.styleFrom(
textColor: Colors.white,
backgroundColor: Colors.red),
),
CodePudding user response:
You don't need to change textColor
with TextButton
Style. you can do that with child
widget like this:
TextButton(
style: TextButton.styleFrom(
backgroundColor: Colors.yellow,
),
onPressed: () {},
child: Text(
'click',
style: TextStyle(
color: Colors.red,
),
),
),