Add Material touch ripples

Domains: Flutter

Widgets that follow the Material Design guidelines display a ripple animation when tapped.

Flutter provides the InkWell widget to perform this effect. Create a ripple effect using the following steps:

  1. Create a widget that supports tap.
  2. Wrap it in an InkWell widget to manage tap callbacks and ripple animations.
// The InkWell wraps the custom flat button widget.
InkWell(
  // When the user taps the button, show a snackbar.
  onTap: () {
    Scaffold.of(context).showSnackBar(SnackBar(
      content: Text('Tap'),
    ));
  },
  child: Container(
    padding: EdgeInsets.all(12.0),
    child: Text('Flat Button'),
  ),
);

Similar pages

Page structure
Terms

Widget

Animation

Flutter

Container