Search packages, repositories and app categories

Package detailsv1.0.1

transparent_pointer

Provides TransparentPointer to control hit testing

AndroidiOSWebmacOSWindowsLinux
30-day downloads
15.6K
Likes
59
Pub points
150

Install package

flutter pub add transparent_pointer

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The transparent_pointer package provides a widget called TransparentPointer that allows developers to control hit testing in Flutter applications. By wrapping widgets with this component, you can make them transparent to pointer events, enabling underlying widgets to receive touch or mouse input instead. This is particularly useful during testing or when building complex UIs where precise event handling is required. The package supports all major platforms including Android, iOS, Web, macOS, Windows, and Linux.

Use cases

  • Testing UI interactions
  • Bypassing hit testing for overlays
  • Creating layered UI components
  • Debugging gesture conflicts
  • Implementing transparent touch zones
  • Simulating user input in tests

Key features

  • Controls hit testing behavior
  • Supports all Flutter platforms
  • Simple widget wrapper
  • Ideal for test scenarios
  • Enables event delegation
  • Lightweight and minimal

Suitable for

  • Test automation engineers
  • UI developers needing fine-grained control
  • Flutter app testers
  • Developers building interactive overlays
  • Those debugging gesture issues
  • Prototyping complex gesture flows

Considerations

  • Not intended for production UIs
  • May interfere with normal touch behavior
  • Requires careful integration in complex layouts
  • Limited to hit testing manipulation
  • Best used in development or testing environments
  • Does not affect visual rendering

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

transparent_pointer

TransparentPointer is a widget that is invisible for its parent to hit testing, but still allows its subtree to receive pointer events. This is useful to allow a gesture detector that is visually behind another widget to still receive pointer events, while at the same time allowing that other widget to receive those events as well.

Example

In this example, a drag can be started anywhere in the widget, including on top of the text button, even though the button is visually in front of the background gesture detector. At the same time, the button is tappable.

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        GestureDetector(
          behavior: HitTestBehavior.opaque,
          onVerticalDragStart: (_) => print("Background drag started"),
        ),
        Positioned(
          top: 60,
          left: 60,
          height: 60,
          width: 60,
          child: TransparentPointer(
            child: TextButton(
              child: Text("Tap me"),
              onPressed: () => print("You tapped me"),
            ),
          ),
        ),
      ],
    );
  }
}

Categories

Source repository

Projects using this package

No data available yet.