Repository navigation
Conversation
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.
There was a problem hiding this comment.
Code Review
This pull request adds two new widget tests to app_bar_sliver_test.dart to verify that showOnScreen works correctly with a pinned SliverAppBar when using a sliver list or individual slivers. Feedback was provided to use the defined kItemHeight constant instead of a hardcoded value of 72.0 for the height of individual sliver items to ensure consistency.
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.
rezaflutter1374
left a comment
There was a problem hiding this comment.
Reviewed the added test coverage. Could you confirm whether the collapsed SliverAppBar state should also have equivalent semantics coverage?
|
Thanks for looking, @rezaflutter1374. If you mean
In the second test the scroll offset (250.0) is past the collapse distance ( That's the whole point of the assertion being |
|
Hi @Vi-debug, these packages are not accepting contributions yet. We will announce when they are, for now, I am going to close this PR. Thank you! |
|
Superseded by #12631 now that material_ui is accepting contributions. |
In flutter/flutter#186611,
scrollable_semantics_test.darthad itsmaterialimport removed, which meant replacingSliverAppBarwith a privateSliverPersistentHeaderdelegate in two tests:showOnScreen works with pinned app bar and sliver listshowOnScreen works with pinned app bar and individual sliversThose were the only tests exercising
SemanticsAction.showOnScreenagainst a pinnedSliverAppBar, so that behavior lost its coverage. This PR restores both, inpackages/material_ui/test/app_bar_sliver_test.dart— which already importssemantics_tester.dartand is where the otherSliverAppBarsemantics tests live.The two cases are not redundant:
expandedHeightof 56.0, so the app bar never collapses; asserts the revealed item lands atkExpandedAppBarHeight.expandedHeightof 256.0 with the scroll offset already past the collapse point; asserts the revealed item lands atkToolbarHeight. This is the case that actually exercisesFlexibleSpaceBarcollapse behavior, which theSliverPersistentHeaderstand-in does not reproduce.The coverage is added here rather than in
flutter/flutterbecause Material is frozen there (flutter/flutter#184093), and the TODO left behind by #186611 explicitly pointed at thematerial_uipackage.A note on scope: flutter/flutter#189117 mentions only the first test, and only that one got a TODO. The second
SliverAppBarremoval in #186611 was untracked, so restoring only the first would have left the collapsing-app-bar path uncovered with nothing pointing at it. Happy to split the second test out if you'd rather keep this scoped to the issue as filed.Verification, in
packages/material_ui:flutter test test/app_bar_sliver_test.dart— all tests pass.pinnedtofalse, which fails them.No version bump or CHANGELOG entry: this is a test-only change, which is a documented exemption.
Fixes flutter/flutter#189117
Pre-Review Checklist
[shared_preferences]///).Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2