bool _lights = false;


Widget build(BuildContext context) {
  return GestureDetector(
    onTap: () {
      setState(() { _lights = true; });
    },
    child: Container(
      color: _lights ? Colors.yellow : Colors.grey,
      child: Text('TURN LIGHTS ${_lights ? 'ON' : 'OFF'}'),
    ),
  );
}

Subscribe For Daily Updates

Flutter Questions
Android Questions