change color of container on tap flutter code example

Example 1: how to change appbar color in flutter

appBar: AppBar(
      title: const Text('Example'),
      backgroundColor: Colors.black,
    ),

Example 2: flutter toggle color card on tap

new RaisedButton(
  child: new Text('Attention'),
  textColor: Colors.white,
  shape: new RoundedRectangleBorder(
    borderRadius: new BorderRadius.circular(30.0),
  ),
  color: pressAttention ? Colors.grey : Colors.blue,
  onPressed: () => setState(() => pressAttention = !pressAttention),
);

Tags:

Misc Example