Skip to content
pubscout

defer_pointer

0.0.2, released 5 years ago by gskinner.com

Provides a widget to render and hit‑test children outside their parent bounds.

WASM-ready
$ flutter pub add defer_pointer
Source repository

What it does

DeferPointer lets a child widget be painted and hit‑tested outside the bounds of its parent by delegating these tasks to a DeferredPointerHandler higher in the tree. It works like an Overlay but with finer control over the target area and optional top‑painting.

AI-written summary of version 0.0.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need dropdowns, menus, or panels that extend beyond their parent without manual layer management
  • You require precise hit‑testing for widgets positioned outside their original bounds

Skip it when

  • The built‑in Overlay already satisfies your needs
  • The UI is simple and does not need out‑of‑bounds rendering

Strengths

  • Simple API with just two widgets
  • Granular control over which ancestor handles painting and hit‑testing
  • Works on all Flutter platforms

Weaknesses

  • Adds an extra widget layer which may affect performance in very large trees
  • Small ecosystem and limited community support

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1
Widget build(BuildContext context) {
  return DeferredPointerHandler(
    child: SizedBox(
      width: 100,
      height: 100,
      child: Stack(
        clipBehavior: Clip.none,
        children: [
          Positioned(
            bottom: -30,
            child: DeferPointer(child: TextButton(onPressed: () {}, child: Text('Btn'))),
          ),
          Positioned.fill(
            child: Container(color: Colors.green),
          ),
        ],
      ),
    ),
  );
}

Alternatives

Packages that do the same job and could replace defer_pointer.

Works with

Packages commonly used together with defer_pointer: ones it builds on, ones built on it, and its own family.