Skip to content

Conversation

@simolus3
Copy link
Contributor

This PR is a duplicate of #111479, I've copied the description here:

An IndexedStack only ever shows one of its children. Other children aren't rendered or hit-tested. In this sense, I think these other children could be considered off-stage.
This PR changes the behavior of IndexedStack to hide inactive children from an element visitor only interested in on-stage children. The main effect is that inactive children are no longer found through a finder in widget tests by default.

This closes #111478.

I was asked to re-open this PR so that the impact of this breaking change can be evaluated (cc @goderbauer).

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

@flutter-dashboard flutter-dashboard bot added a: tests "flutter test", flutter_test, or one of our tests d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos documentation f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. c: contributor-productivity Team-specific productivity, code health, technical debt. labels Mar 21, 2023
@goderbauer goderbauer self-requested a review March 21, 2023 22:11
@fzyzcjy
Copy link
Contributor

fzyzcjy commented Mar 22, 2023

For future readers: Context #122393 (comment)

@goderbauer
Copy link
Member

I've kicked off an internal test run, let's see what happens...

@goderbauer goderbauer force-pushed the indexed-stack-hide-from-finder-v2 branch from dfc5539 to df434c4 Compare March 23, 2023 22:09
Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

Please also add tests that specifically test the new behavior of the offstage behavior of IndexStack.

Comment on lines 4020 to 4021
Copy link
Member

Choose a reason for hiding this comment

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

This will consider all children onstage, right? I though if the index is null, the IndexedStack displays nothing, so all of them should be offstage?

Comment on lines 4023 to 4026
Copy link
Member

Choose a reason for hiding this comment

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

couldn't this be simplified to

Suggested change
final Iterator<Element> onlyOnstageChild = children.skip(index).iterator;
if (onlyOnstageChild.moveNext()) {
visitor(onlyOnstageChild.current);
}
visitor(children.elementAt(index));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to special-case the scenario where index is out of bounds because there are no children (the default when constructing an IndexedStack()), but elementAt is much more readable. Thanks for the suggestion!

@goderbauer
Copy link
Member

From initial testing, it doesn't look too bad. Once the comment about the index == null case is addressed, I can run some additional tests to get the full picture.

@simolus3 simolus3 force-pushed the indexed-stack-hide-from-finder-v2 branch from df434c4 to 623980f Compare March 24, 2023 20:51
Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM, but we have to wait and see what Google Testing does

@goderbauer
Copy link
Member

@simolus3 something got messed up when I tried to rebase this PR and a lot of checks are failing now. If you have a chance, could you take a look?

@goderbauer
Copy link
Member

The customer_testing checks are failing because of #123669.

@goderbauer goderbauer force-pushed the indexed-stack-hide-from-finder-v2 branch from 84fe65c to 78c70a8 Compare March 29, 2023 18:03
@goderbauer
Copy link
Member

The handful of google tests that were failing on this have been migrated, so all checks are green on this PR now. We just need to get a secondary review on this to land it.

Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

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

Flutter_LGTM

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 29, 2023
@auto-submit auto-submit bot merged commit c71f1dd into flutter:master Mar 29, 2023
@simolus3 simolus3 deleted the indexed-stack-hide-from-finder-v2 branch March 29, 2023 21:27
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 30, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 30, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 30, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 30, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 30, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 31, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 1, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 1, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 1, 2023
CaseyHillers added a commit that referenced this pull request Apr 3, 2023
@CaseyHillers
Copy link
Contributor

As FYI, this is breaking Google Testing, and I've put up a revert in #124035. I'm checking with @goderbauer and @Piinks to see if we can fix forward without the need to revert this change.

@goderbauer
Copy link
Member

A g3fix for that breakage is scheduled. No further action should be necessary.

exaby73 pushed a commit to NevercodeHQ/flutter that referenced this pull request Apr 17, 2023
…tter#123129)

Treat hidden `IndexedStack` children as offstage for test finder
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: tests "flutter test", flutter_test, or one of our tests autosubmit Merge PR when tree becomes green via auto submit App c: contributor-productivity Team-specific productivity, code health, technical debt. d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Widget test] Make IndexedStack hide non-active children from finder

5 participants