tap_canvas 0.9.2 copy "tap_canvas: ^0.9.2" to clipboard
tap_canvas: ^0.9.2 copied to clipboard

outdated

Detect taps outside the currently defined widget and provide a callback when taps occur.

🚰 TapCanvas #

Detect taps outside the currently defined widget and provide a callback when taps occur.

codecov

Example #

Define the area within which you care about taps #

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) => MaterialApp(
    home: TapCanvas(
      child: MyHomeWidget(),
    ),
  );
}

Now your widgets can react when the user taps outside them #

class TapOutsideAwareWidget extends StatelessWidget {
  const TapOutsideAwareWidget({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) => TapOutsideDetectorWidget(
    onTappedOutside: () {
      print('OUTSIDE TAPPED');
    },
    onTappedInside: () {
      print('INSIDE TAPPED');
    },
    child: MyWidgetThatCaresAboutTaps(),
  );
}
14
likes
0
pub points
85%
popularity

Publisher

unverified uploader

Detect taps outside the currently defined widget and provide a callback when taps occur.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on tap_canvas