GestureDetector

A widget that detects gestures.

Example

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'}'),
    ),
  );
}

Related Links