elevated button flutter color code example
Example 1: elevated button flutter color
ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith<Color>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.pressed))
return Colors.green;
return null;
},
),
),
)
Example 2: flutter raisedbutton example
RaisedButton(child: Text("Rock & Roll"),
onPressed: _changeText,
color: Colors.red,
textColor: Colors.yellow,
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
splashColor: Colors.grey,
)
Example 3: elevated Button Theme background color in flutter
style: ElevatedButton.styleFrom(
primary: Colors.purple,
),
Example 4: flutter elevated button
ElevatedButton(
onPressed: () {},
child: Text('Submit'),
);