Tuesday, December 31, 2019

Flutter: Grid List

Flutter: Grid List

A sample is like below

Flutter : Handling Gestures

Below are the steps involved in this:

1. Create a UI Element
2. Wrap it with GestureDetector with the onTap callback


Class MyButton extends StatelessWidget {

@override
Widget build(BuildContext context) {
    return GestureDetector (
    onTap() {
    final snackbar = SnackBar (content:Text("Tap"))
    Scaffold.of(context).showSnackBar(snackBar)
}
child:Container(padding: EdgeInsets.all(12.0),decoration : BoxDecoration(color:Theme.of(context).buttonColor,borderRadius:BorderRadius.circular(8.0))),
child:Text("My Button");
    )

}

}

References:
https://flutter.io/cookbook/gestures/handling-taps/

No comments:

Post a Comment