Monday, October 29, 2018

Flutter: Adding Material Touch Ripples

Below given some guidelines for adding ripple animation when something is touched on the screen.

1. Create a Widget to tap
2. Wrap it in an InkWell widget to manage tap callbacks and ripple animations

Class MyButtpn extends StatelessWidget {
    @override
    Widget build(BuildContext context){   
        return InkWell(
            onTap:() {
                Scaffold.of.(context).showSnackBar(SnackBar (content : Text('Tap')),
            }
            child:Container(padding:EdgeInsets.all(12.0)),child:Text('Flat Button')
        );
    }
}


References:
https://flutter.io/cookbook/gestures/ripples/

No comments:

Post a Comment