When I add a color to my "TextButton" an error pops up.
The named parameter 'color' isn't defined. Try correcting the name to an existing named parameter's name, or defining a named parameter with the name 'color'.
How do I solve? Line of code below
Row(
children: <Widget>[
TextButton(
onPressed: () {},
child: Text('Entrar'),
color: Color(0xff7540ee).withOpacity(.2),
),
CodePudding user response:
Paste this code it will work.
Row(
children: <Widget>[
TextButton(
onPressed: () {},
child: Text('Entrar'),
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all(
Color(0xff7540ee).withOpacity(.2),
),
),
),
],
),
CodePudding user response:
if you want change text color
Row(
children: <Widget>[
TextButton(
onPressed: (){},
child: Text('Entrar',
style: TextStyle(color: Colors.amber),
),
),
]
);
or.
if you want change button color
Row(
children: <Widget>[
Container(
color: Colors.amber,
child: TextButton(
onPressed: (){},
child: Text('Entrar',
style: TextStyle(color: Colors.amber),
),
),
),
]
);
CodePudding user response:
Replace this code
child: Text('Entrar'), color: Color(0xff7540ee).withOpacity(.2),
to this
child: Text('Entrar', style: TextStyle(Color(0xff7540ee).withOpacity(.2)),