Sitelet https://github.com/flutter/flutter/pull/188940
Skip to content

Make the AbsorbPointer sample show the difference from IgnorePointer - #188940

Merged
auto-submit[bot] merged 7 commits into
flutter:masterfrom
theprantadutta:samples/absorb-pointer-vs-ignore-pointer
Aug 29, 2026
Merged

auto-submit[bot] merged 7 commits into
flutter:masterfrom
theprantadutta:samples/absorb-pointer-vs-ignore-pointer

Conversation

@theprantadutta

Copy link
Copy Markdown
Contributor

The AbsorbPointer sample shows two overlapping buttons in a Stack, but neither button gives any visible feedback when tapped, so the sample doesn't let you observe what AbsorbPointer actually does — and as #87936 points out, it especially doesn't show how it differs from IgnorePointer.

This implements the design discussed on the issue (keep the existing example, add an IgnorePointer counterpart so the side-by-side makes the distinction observable — suggested by @victorsanni):

  • The sample now shows the original crossed-buttons stack twice, side by side: one overlay wrapped in AbsorbPointer, the other in IgnorePointer, with a visible "Taps received" counter under each stack.
  • Tapping the overlapping region on the AbsorbPointer side does nothing — the AbsorbPointer absorbs the pointer events itself, so neither its child button nor the button behind it receives the tap. Tapping the same region on the IgnorePointer side increments the counter of the button behind — the IgnorePointer is invisible to hit testing, so the event goes through to the next target in the stack.
  • The {@tool dartpad} blurb on the AbsorbPointer class docs is updated to describe the comparison.
  • The sample test now asserts the observable tap behavior on both sides (including that the uncovered part of the button behind the AbsorbPointer still receives taps), replacing the previous mouse-cursor-only check.

Fixes #87936

Pre-launch Checklist

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos labels Jul 3, 2026
Comment thread examples/api/lib/widgets/basic/absorb_pointer.0.dart Outdated
Comment thread examples/api/test/widgets/basic/absorb_pointer.0_test.dart Outdated
Comment thread examples/api/test/widgets/basic/absorb_pointer.0_test.dart Outdated
Comment thread examples/api/test/widgets/basic/absorb_pointer.0_test.dart Outdated
@theprantadutta

Copy link
Copy Markdown
Contributor Author

Thanks for the early review @navaronbracke! All four points addressed in 6e5e3af — the example now uses only widgets-library APIs (WidgetsApp + GestureDetector/Container targets, modeled on the tap_region example), the test imports package:flutter/widgets.dart, and both test comments use your suggested wording. Tests still 2/2 and the analyzer is clean. (Still a draft only because of the open-PR limit — happy to keep iterating meanwhile.)

@theprantadutta
theprantadutta marked this pull request as ready for review August 12, 2026 16:14

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the AbsorbPointer sample code, documentation, and tests to showcase both AbsorbPointer and IgnorePointer side-by-side. The reviewer recommends reverting the import to material.dart and refactoring the implementation to use MaterialApp and ElevatedButton instead of WidgetsApp and custom containers. This simplifies the code, restores built-in tap feedback, and resolves compilation errors caused by invalid leading-dot syntax.

@victorsanni victorsanni left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @theprantadutta, can you fix the merge conflicts in this PR, then re-request a review to get this PR back on my queue? Thanks!

@theprantadutta

Copy link
Copy Markdown
Contributor Author

@victorsanni conflicts are resolved in e419044 — this is ready for another look.

The conflict came from the examples/api → packages/flutter/examples/api move on master, so both sample files are now at their new paths with my changes carried across. Verified after merging:

  • dart analyze examples/api (the whole package at its new location) — No issues found
  • both example tests pass: AbsorbPointer absorbs taps over the overlapping region and IgnorePointer passes taps through to the widget behind
  • diff is still just the 3 files (sample, its test, and the AbsorbPointer dartdoc in basic.dart)

I can't use GitHub's re-request-review button — as a non-collaborator I get a permissions error on RequestReviewsByLogin — so tagging you here instead. Apologies if that's noisier than the button.

One note for whenever you get to it: the gemini-code-assist bot left two high-priority comments above that I believe are both incorrect, and I've replied inline with the details. Short version — it flags the Dart dot shorthands (.center) as compilation errors, but the package analyzes clean and master's own copy of this file already uses that syntax; and it asks for a revert to package:flutter/material.dart, which would undo the widgets-only change @navaronbracke requested in review.

@navaronbracke navaronbracke left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@victorsanni
victorsanni self-requested a review August 18, 2026 18:51
@victorsanni victorsanni added the CICD Run CI/CD label Aug 19, 2026

@victorsanni victorsanni left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the file from check_examples_cross_imports.dart as @navaronbracke suggested?

…e its labels a color

The sample and its test no longer import Material, so they no longer
belong in knownExamplesCrossImports.

WidgetsApp does not install a DefaultTextStyle, so the section titles and
tap counters were falling back to a style with no color and rendering
invisibly against the white background. Set WidgetsApp.textStyle so they
are legible.
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Aug 22, 2026
@theprantadutta

Copy link
Copy Markdown
Contributor Author

Done in f9555b0 — removed both entries from knownExamplesCrossImports (the lib one at L270 and the _test one at L472), since neither file imports Material any more.

Verified by running the checker itself:

$ bin/cache/dart-sdk/bin/dart --enable-asserts dev/bots/check_examples_cross_imports.dart
No errors were detected with examples cross imports.

Thanks @navaronbracke for pointing at the exact lines.

theprantadutta added a commit to theprantadutta/flutter that referenced this pull request Aug 22, 2026
theprantadutta added a commit to theprantadutta/flutter that referenced this pull request Aug 22, 2026
navaronbracke
navaronbracke previously approved these changes Aug 23, 2026
@navaronbracke navaronbracke added the CICD Run CI/CD label Aug 23, 2026

@victorsanni victorsanni left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one comment.

Comment thread packages/flutter/lib/src/widgets/basic.dart
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Aug 26, 2026
victorsanni
victorsanni previously approved these changes Aug 26, 2026
@victorsanni victorsanni added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 26, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 26, 2026
@auto-submit

auto-submit Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/188940, because This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 2 more review(s) in order to merge this PR.

  • Merge guidelines: A PR needs at least one approved review if the author is already part of flutter-hackers or two member reviews if the author is not a member of flutter-hackers before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@theprantadutta

Copy link
Copy Markdown
Contributor Author

Thanks for the approval @victorsanni, and for the IgnorePointer suggestion — the docs read better with it even though you'd marked it optional.

@navaronbracke, a heads-up you probably can't see from the timeline: your approval from Aug 23 was auto-dismissed when the later commits landed (the master merge, then 05033f4 adding the IgnorePointer dartdoc reference). Nothing changed in the parts you reviewed — the sample and its test are as you approved them, and the only change since is the extra {@tool dartpad} block on IgnorePointer. Would you mind re-approving the current head when you get a chance?

For context on why I'm asking rather than waiting: the auto-submit bot removed the autosubmit label on Aug 26 because it needs two approvals for a non-flutter-hackers author, and at that moment there were none registered. There's one now, so it needs one more — and the label re-applied once it's there.

Everything else is green on my side: no conflicts, all review threads answered, and the example analyzes, formats and tests clean.

@navaronbracke navaronbracke added the CICD Run CI/CD label Aug 26, 2026
@theprantadutta

Copy link
Copy Markdown
Contributor Author

Thanks for the re-approval @navaronbracke 🙏

This looks ready to go now — two approvals on the current head (05033f4), all CI green (14 passing, nothing failing or pending), and mergeable is clean.

The only thing left is the autosubmit label: the bot removed it on Aug 26 when the approval count was short, and it hasn't been re-applied since. Could one of you add it back? I don't have permission to (403 Must have admin rights), so it needs someone on your side.

@navaronbracke navaronbracke added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 29, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 29, 2026
Merged via the queue into flutter:master with commit b254071 Aug 29, 2026
41 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 29, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Aug 30, 2026
flutter/flutter@8d8c1aa...c978386

2026-08-30 engine-flutter-autoroll@skia.org Roll Skia from ce359c7fbfe6 to 588b550a4dd8 (1 revision) (flutter/flutter#192040)
2026-08-30 engine-flutter-autoroll@skia.org Roll Skia from 3ae8e3d1e335 to ce359c7fbfe6 (1 revision) (flutter/flutter#192037)
2026-08-30 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from J123CwfDPYyVDpkMl... to o9DikEfRoFyVK3LKD... (flutter/flutter#192031)
2026-08-29 44747303+theprantadutta@users.noreply.github.com Make the AbsorbPointer sample show the difference from IgnorePointer (flutter/flutter#188940)
2026-08-29 engine-flutter-autoroll@skia.org Roll Dart SDK from 391ff83cd1d3 to 76abdf94faa8 (1 revision) (flutter/flutter#192021)
2026-08-29 engine-flutter-autoroll@skia.org Roll Skia from b392fb672d13 to 3ae8e3d1e335 (1 revision) (flutter/flutter#192020)
2026-08-29 engine-flutter-autoroll@skia.org Roll Skia from 0b4249b26b38 to b392fb672d13 (6 revisions) (flutter/flutter#192016)
2026-08-29 97480502+b-luk@users.noreply.github.com Fixes for texture-backed gradients (flutter/flutter#191925)
2026-08-29 engine-flutter-autoroll@skia.org Roll Dart SDK from ae63a6eca3f1 to 391ff83cd1d3 (3 revisions) (flutter/flutter#192010)
2026-08-29 166619967+ik020@users.noreply.github.com Fix Android license detection for cmdline-tools 23.0+ (flutter/flutter#191554)
2026-08-29 bkonyi@google.com [flutter_tools] Pause web server requests until initial compilation finishes (flutter/flutter#191990)
2026-08-28 codefu@google.com fix(workflow): Mac Verify Binaries needs `Linux mac_android_aot_engine` (flutter/flutter#191999)
2026-08-28 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from dDxH8G5cDBP602eyG... to J123CwfDPYyVDpkMl... (flutter/flutter#191984)
2026-08-28 katelovett@google.com Update scheduled workflow for more tasks, add goldctl update (flutter/flutter#191991)
2026-08-28 katelovett@google.com Update no-main-prs to leave a comment (flutter/flutter#191973)
2026-08-28 269567208+reidbaker-agent@users.noreply.github.com [AGP 9.1.0 Migration #4] Replace plugin build-type copy with initWith on public DSL (flutter/flutter#191606)
2026-08-28 engine-flutter-autoroll@skia.org Roll Skia from fe0b9a5261f9 to 0b4249b26b38 (1 revision) (flutter/flutter#191974)
2026-08-28 louisehsu@google.com [UIScene] Migrate dev/benchmarks/macrobenchmarks to UIScene lifecycle (flutter/flutter#191648)
2026-08-28 louisehsu@google.com Uiscene migrate remaining apps (flutter/flutter#191652)
2026-08-28 bkonyi@google.com [tool] Migrate SymbolizeCommand to modular dependency injection (flutter/flutter#190744)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC bmparr@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
victorsanni pushed a commit to victorsanni/packages that referenced this pull request Sep 9, 2026
…r#12693)

flutter/flutter@8d8c1aa...c978386

2026-08-30 engine-flutter-autoroll@skia.org Roll Skia from ce359c7fbfe6 to 588b550a4dd8 (1 revision) (flutter/flutter#192040)
2026-08-30 engine-flutter-autoroll@skia.org Roll Skia from 3ae8e3d1e335 to ce359c7fbfe6 (1 revision) (flutter/flutter#192037)
2026-08-30 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from J123CwfDPYyVDpkMl... to o9DikEfRoFyVK3LKD... (flutter/flutter#192031)
2026-08-29 44747303+theprantadutta@users.noreply.github.com Make the AbsorbPointer sample show the difference from IgnorePointer (flutter/flutter#188940)
2026-08-29 engine-flutter-autoroll@skia.org Roll Dart SDK from 391ff83cd1d3 to 76abdf94faa8 (1 revision) (flutter/flutter#192021)
2026-08-29 engine-flutter-autoroll@skia.org Roll Skia from b392fb672d13 to 3ae8e3d1e335 (1 revision) (flutter/flutter#192020)
2026-08-29 engine-flutter-autoroll@skia.org Roll Skia from 0b4249b26b38 to b392fb672d13 (6 revisions) (flutter/flutter#192016)
2026-08-29 97480502+b-luk@users.noreply.github.com Fixes for texture-backed gradients (flutter/flutter#191925)
2026-08-29 engine-flutter-autoroll@skia.org Roll Dart SDK from ae63a6eca3f1 to 391ff83cd1d3 (3 revisions) (flutter/flutter#192010)
2026-08-29 166619967+ik020@users.noreply.github.com Fix Android license detection for cmdline-tools 23.0+ (flutter/flutter#191554)
2026-08-29 bkonyi@google.com [flutter_tools] Pause web server requests until initial compilation finishes (flutter/flutter#191990)
2026-08-28 codefu@google.com fix(workflow): Mac Verify Binaries needs `Linux mac_android_aot_engine` (flutter/flutter#191999)
2026-08-28 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from dDxH8G5cDBP602eyG... to J123CwfDPYyVDpkMl... (flutter/flutter#191984)
2026-08-28 katelovett@google.com Update scheduled workflow for more tasks, add goldctl update (flutter/flutter#191991)
2026-08-28 katelovett@google.com Update no-main-prs to leave a comment (flutter/flutter#191973)
2026-08-28 269567208+reidbaker-agent@users.noreply.github.com [AGP 9.1.0 Migration flutter#4] Replace plugin build-type copy with initWith on public DSL (flutter/flutter#191606)
2026-08-28 engine-flutter-autoroll@skia.org Roll Skia from fe0b9a5261f9 to 0b4249b26b38 (1 revision) (flutter/flutter#191974)
2026-08-28 louisehsu@google.com [UIScene] Migrate dev/benchmarks/macrobenchmarks to UIScene lifecycle (flutter/flutter#191648)
2026-08-28 louisehsu@google.com Uiscene migrate remaining apps (flutter/flutter#191652)
2026-08-28 bkonyi@google.com [tool] Migrate SymbolizeCommand to modular dependency injection (flutter/flutter#190744)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC bmparr@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
victorsanni pushed a commit to victorsanni/packages that referenced this pull request Sep 9, 2026
…r#12693)

flutter/flutter@8d8c1aa...c978386

2026-08-30 engine-flutter-autoroll@skia.org Roll Skia from ce359c7fbfe6 to 588b550a4dd8 (1 revision) (flutter/flutter#192040)
2026-08-30 engine-flutter-autoroll@skia.org Roll Skia from 3ae8e3d1e335 to ce359c7fbfe6 (1 revision) (flutter/flutter#192037)
2026-08-30 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from J123CwfDPYyVDpkMl... to o9DikEfRoFyVK3LKD... (flutter/flutter#192031)
2026-08-29 44747303+theprantadutta@users.noreply.github.com Make the AbsorbPointer sample show the difference from IgnorePointer (flutter/flutter#188940)
2026-08-29 engine-flutter-autoroll@skia.org Roll Dart SDK from 391ff83cd1d3 to 76abdf94faa8 (1 revision) (flutter/flutter#192021)
2026-08-29 engine-flutter-autoroll@skia.org Roll Skia from b392fb672d13 to 3ae8e3d1e335 (1 revision) (flutter/flutter#192020)
2026-08-29 engine-flutter-autoroll@skia.org Roll Skia from 0b4249b26b38 to b392fb672d13 (6 revisions) (flutter/flutter#192016)
2026-08-29 97480502+b-luk@users.noreply.github.com Fixes for texture-backed gradients (flutter/flutter#191925)
2026-08-29 engine-flutter-autoroll@skia.org Roll Dart SDK from ae63a6eca3f1 to 391ff83cd1d3 (3 revisions) (flutter/flutter#192010)
2026-08-29 166619967+ik020@users.noreply.github.com Fix Android license detection for cmdline-tools 23.0+ (flutter/flutter#191554)
2026-08-29 bkonyi@google.com [flutter_tools] Pause web server requests until initial compilation finishes (flutter/flutter#191990)
2026-08-28 codefu@google.com fix(workflow): Mac Verify Binaries needs `Linux mac_android_aot_engine` (flutter/flutter#191999)
2026-08-28 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from dDxH8G5cDBP602eyG... to J123CwfDPYyVDpkMl... (flutter/flutter#191984)
2026-08-28 katelovett@google.com Update scheduled workflow for more tasks, add goldctl update (flutter/flutter#191991)
2026-08-28 katelovett@google.com Update no-main-prs to leave a comment (flutter/flutter#191973)
2026-08-28 269567208+reidbaker-agent@users.noreply.github.com [AGP 9.1.0 Migration flutter#4] Replace plugin build-type copy with initWith on public DSL (flutter/flutter#191606)
2026-08-28 engine-flutter-autoroll@skia.org Roll Skia from fe0b9a5261f9 to 0b4249b26b38 (1 revision) (flutter/flutter#191974)
2026-08-28 louisehsu@google.com [UIScene] Migrate dev/benchmarks/macrobenchmarks to UIScene lifecycle (flutter/flutter#191648)
2026-08-28 louisehsu@google.com Uiscene migrate remaining apps (flutter/flutter#191652)
2026-08-28 bkonyi@google.com [tool] Migrate SymbolizeCommand to modular dependency injection (flutter/flutter#190744)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC bmparr@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Documentation]: Make Sample code for AbsorbPointer simpler

3 participants