button with background color flutter code example
Example 1: raised button background color doesn't changeflutter
RaisedButton(
onPressed: null,
child: Text('Get in'), // change it to sign-in
color: Colors.blue,
disabledColor: Colors.blue,//add this to your code
)
Example 2: raisedbutton background color
List _list = [true, false, true, false];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Title")),
body: ListView(children: _buildButtons()),
);
}
List _buildButtons() {
List listButtons = List.generate(_list.length, (i) {
return RaisedButton(
color: _list[i] ? Colors.green : Colors.red,
onPressed: () {
setState(() {
_list[i] = !_list[i];
});
},
child: Text("Button #${i}"),
);
});
return listButtons;
}