InkWell

  • Code

    In Flutter, the InkWell widget is used to create a material touch ripple effect for its child widget. It's often used to make a portion of your UI respond to touch gestures, such as tapping. The InkWell widget wraps around another widget and provides a visual response to user interactions.

    
    
    import 'package:flutter/material.dart';
    
    void main() {
      runApp(MyApp());
    }
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          home: Scaffold(
            appBar: AppBar(
              title: Text('InkWell Example'),
            ),
            body: Center(
              child: InkWell(
                onTap: () {
                  // Handle tap event
                  print('InkWell tapped!');
                },
                child: Container(
                  padding: EdgeInsets.all(16.0),
                  child: Text('Tap me'),
                ),
              ),
            ),
          ),
        );
      }
    }