Reputation: 1
When I add a color to my "TextButton" an error pop 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 it? Line of code below
Row(
children: <Widget>[
TextButton(
onPressed: () {},
child: Text('Entrar'),
color: Color(0xff7540ee).withOpacity(.2),
),
Upvotes: 0
Views: 586
Reputation: 1
If you want to change TextButton
color
Row(
children: <Widget>[
TextButton(
ButtonStyle(backgroundColor: MaterialStateProperty.all(
Color(0xff7540ee).withOpacity(.2),
),
),
],
),
Upvotes: 0
Reputation: 183
Replace this code
child: Text('Entrar'), color: Color(0xff7540ee).withOpacity(.2),
to this
child: Text('Entrar', style: TextStyle(Color(0xff7540ee).withOpacity(.2)),
Upvotes: 2
Reputation: 1006
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),
),
),
),
]
);
Upvotes: 0
Reputation: 327
Paste this code it will work.
Row(
children: <Widget>[
TextButton(
onPressed: () {},
child: Text('Entrar'),
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all(
Color(0xff7540ee).withOpacity(.2),
),
),
),
],
),
Upvotes: 0