Skip to content

[material_ui] Add SliverAppBar showOnScreen semantics test coverage - #12631

Draft
Vi-debug wants to merge 5 commits into
flutter:mainfrom
Vi-debug:test-sliver-app-bar-show-on-screen-semantics
Draft

Vi-debug wants to merge 5 commits into
flutter:mainfrom
Vi-debug:test-sliver-app-bar-show-on-screen-semantics

Conversation

@Vi-debug

Copy link
Copy Markdown

Reopen of #12341, now that material_ui is accepting contributions (per flutter/flutter#188444).

Restores showOnScreen semantics coverage for a pinned SliverAppBar that was lost in flutter/flutter#186611, per flutter/flutter#189117. Companion framework-only PR: flutter/flutter#190410.

No version bump or CHANGELOG entry: test-only change, documented exemption.

@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 adds two widget tests to app_bar_sliver_test.dart to verify showOnScreen functionality with a pinned SliverAppBar using a sliver list and individual slivers. The review feedback recommends removing the k prefix from local constants to adhere to Dart style guidelines and replacing hardcoded pump delays with pumpAndSettle for more robust animation waiting.

Comment thread packages/material_ui/test/app_bar_sliver_test.dart Outdated
Comment thread packages/material_ui/test/app_bar_sliver_test.dart Outdated
Comment thread packages/material_ui/test/app_bar_sliver_test.dart Outdated
Comment thread packages/material_ui/test/app_bar_sliver_test.dart Outdated
@Vi-debug

Copy link
Copy Markdown
Author

Addressed both suggestions in c4cbb73: dropped the k prefix on local constants and switched to pumpAndSettle() in both new tests, matching the rest of this file.

The widgets test 'showOnScreen works with pinned app bar and sliver list'
in flutter/flutter was switched from SliverAppBar to a
SliverPersistentHeader delegate in flutter/flutter#186611, which left the
SliverAppBar path without coverage for SemanticsAction.showOnScreen.

Add that coverage here, as the original TODO pointed at material_ui and
Material is frozen in flutter/flutter.

Fixes flutter/flutter#189117
flutter/flutter#186611 removed SliverAppBar from two showOnScreen tests,
but only the sliver-list one was tracked by a TODO. Restore the
individual-slivers case as well, which exercises FlexibleSpaceBar
collapse behaviour that the SliverPersistentHeader stand-in does not.
kItemHeight was inherited from the upstream test but held 100.0 while the
items were 72.0 tall; it was only ever used to compute the initial scroll
offset. Make kItemHeight the actual item height and give the offset its
own constant. No behaviour change: items are still 72.0 and the initial
offset is still 250.0.
Matches this file's existing conventions.

@elliette elliette left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for adding this test coverage! Left a few suggestions

Comment thread packages/material_ui/test/app_bar_sliver_test.dart
Comment thread packages/material_ui/test/app_bar_sliver_test.dart
Comment thread packages/material_ui/test/app_bar_sliver_test.dart Outdated
@Vi-debug
Vi-debug requested a review from elliette September 4, 2026 07:09

@QuncCccccc QuncCccccc 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.

Thank you for your contribution! Because of the volume of PRs we receive, we require that new contributors use our checklist to guide them through critical steps in creating a Flutter PR. This PR's description is missing that checklist, so it is being marked as a Draft.

Please edit the PR description to add the checklist, then ensure that you have completed all of the steps. Once you've done that, please mark the PR as ready for review.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@QuncCccccc
QuncCccccc marked this pull request as draft September 8, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p: material_ui triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants