Skip to content

Instantly share code, notes, and snippets.

@MarcinusX
Created January 13, 2019 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarcinusX/9f9828cadb24a7dc1fd77641ee2b6d6d to your computer and use it in GitHub Desktop.
Save MarcinusX/9f9828cadb24a7dc1fd77641ee2b6d6d to your computer and use it in GitHub Desktop.
class Tile extends StatelessWidget {
final VoidCallback onTap; //<--new parameter
const Tile({Key key, this.height, this.state, this.onTap}) : super(key: key);
@override
Widget build(BuildContext context) {
return SizedBox(
width: double.infinity,
height: height,
child: GestureDetector(
onTapDown: (_) => onTap(), //<-- call onTap
child: Container(color: color),
),
);
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment