Skip to content

Add hit-test position selector#118

Merged
passsy merged 2 commits into
mainfrom
codex/fix-issue-#28
Jun 10, 2026
Merged

Add hit-test position selector#118
passsy merged 2 commits into
mainfrom
codex/fix-issue-#28

Conversation

@passsy

@passsy passsy commented Jun 16, 2025

Copy link
Copy Markdown
Owner

Adds hit-test based position selectors for widgets at a global screen coordinate.

spotAtPosition(const Offset(400, 300)).existsAtLeastNTimes(1);
spot<ColoredBox>().atPosition(const Offset(400, 300)).existsOnce();

spotAtPosition starts a selector from a global position.
atPosition narrows an existing selector by the Flutter hit-test path.
The selectors follow Flutter hit testing, so overlapping siblings that do not receive the hit are not reported.

Fixes #28

Comment thread lib/spot.dart Outdated
@passsy passsy requested a review from Copilot June 16, 2025 15:05
Comment thread lib/src/spot/selectors.dart Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds utilities to select multiple widgets at a given screen position.

  • Introduce a PositionFilter and PositionSelectors extension to hit-test widgets by global coordinates
  • Remove the old singular selector and expose the new spotWidgetsAtPosition in the public API
  • Update tests and changelog to reflect the new plural selector

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/spot/widget_at_position_test.dart Adapted tests to use spotWidgetsAtPosition and added new cases
lib/src/spot/selectors.dart Imported PositionFilter and added PositionSelectors extension
lib/src/spot/filters/position_filter.dart Implemented widget hit-testing logic via PositionFilter
lib/spot.dart Exposed top-level spotWidgetsAtPosition and exported PositionFilter
CHANGELOG.md Bumped to 0.18.1 and documented the new selector
Comments suppressed due to low confidence (1)

test/spot/widget_at_position_test.dart:49

  • [nitpick] Consider adding a test case where spotWidgetsAtPosition is called at a point with no widgets (e.g., outside the stack) to ensure it returns an empty result.
}

Comment thread lib/src/spot/filters/position_filter.dart
Comment thread lib/src/spot/filters/position_filter.dart
Comment thread lib/src/spot/filters/position_filter.dart Outdated
@passsy passsy force-pushed the codex/fix-issue-#28 branch from 9269110 to 42d8dde Compare June 10, 2026 00:25
@passsy passsy changed the title Implement spotWidgetAtPosition utilities Add hit-test position selectors Jun 10, 2026
@passsy passsy force-pushed the codex/fix-issue-#28 branch 5 times, most recently from 27ce2df to 64befdc Compare June 10, 2026 08:49
@passsy passsy changed the title Add hit-test position selectors Add hit-test position selector Jun 10, 2026
@passsy passsy force-pushed the codex/fix-issue-#28 branch from 64befdc to f97e2a7 Compare June 10, 2026 08:51
@passsy passsy merged commit d70a9dd into main Jun 10, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spotWidgetAtPosition

2 participants