Skip to content

Add SliverAppBar test coverage for showOnScreen semantics #189117

Closed

Description

@rkishan516

The widgets test showOnScreen works with pinned app bar and sliver list was updated to use SliverPersistentHeader.

Add equivalent coverage in the material library using SliverAppBar, so Flutter keeps test coverage for the SliverAppBar behavior.

Context: #186611 (comment)

Activity

  1. added
    team-designOwned by Design Languages team
    p: material_uimaterial_ui package in flutter/packages
    frameworkflutter/packages/flutter repository. See also f: labels.
    a: tests"flutter test", flutter_test, or one of our tests
    on Jul 8, 2026
  2. added
    P1High-priority issues at the top of the work list
    triaged-designTriaged by Design Languages team
    on Jul 8, 2026
  3. added a commit that references this issue on Aug 2, 2026
    7ff110d
  4. Vi-debug commented on Aug 2, 2026

    @Vi-debug
    Contributor

    I've picked this up, @rkishan516. Summary of the approach and the merge order, since it ended up spanning two repos.

    [Outdated - check lastest comment]

    Where the tests went. Not packages/flutter/test/material/ — that path fails the required Check Code Freeze job, since Material and Cupertino are frozen here per #184093, and that policy says in-flight Material PRs should be closed and ported to the new packages. So the coverage goes to packages/material_ui/test/app_bar_sliver_test.dart in flutter/packages, which matches what your TODO said. (I initially opened #190410 against the Material test dir before working that out; it's closed in favour of the below.)

    Two PRs, in this order:

    1. [material_ui] Add SliverAppBar showOnScreen semantics test coverage packages#12341 — adds the tests to material_ui. This is the actual fix.
    2. Remove stale SliverAppBar showOnScreen TODO #190412 — removes the now-stale TODO from scrollable_semantics_test.dart. Currently a draft and should not land until [material_ui] Add SliverAppBar showOnScreen semantics test coverage packages#12341 merges, otherwise the tracking marker disappears while the gap is still open. It carries Fixes #189117, so this issue closes automatically when it lands.

    One scope note worth your opinion. #186611 removed SliverAppBar from two tests, but only the sliver-list one got a TODO, so this issue mentions only that one. I restored both, because the second case isn't redundant:

    expandedHeight asserts exercises
    ...and sliver list 56.0 dy == kExpandedAppBarHeight pinned bar, never collapses
    ...and individual slivers 256.0 dy == kToolbarHeight FlexibleSpaceBar collapse

    The second is the one that actually runs the Material collapse path, which the _PinnedHeaderDelegate.collapsing stand-in doesn't reproduce. Restoring only the first would have left that uncovered with nothing tracking it. Happy to split it into its own PR if you'd rather keep this scoped to the issue as filed.

    Both assertions were confirmed load-bearing — flipping pinned to false fails each with Expected: <56.0> Actual: <6.0>.

    One thing neither PR addresses: the frozen packages/flutter/test/material/app_bar_sliver_test.dart stays without this coverage permanently. showOnScreen depends on core scrolling/semantics code that isn't frozen, so a regression there would break legacy Material SliverAppBar with no presubmit here catching it — flutter/packages CI would surface it against master, but out-of-band. Flagging in case team-design wants that tracked separately; it seems like an accepted consequence of the freeze rather than something in scope here.

  5. rkishan516 commented on Aug 3, 2026

    @rkishan516
    ContributorAuthor

    Hey @Vi-debug , Your approach looks good.

    About second test, yes we have to recover that also in material ui. No need to split.

    and yes lets not handle coverage in material ui as part of this.

  6. Vi-debug commented on Aug 3, 2026

    @Vi-debug
    Contributor

    Thank you @rkishan516 , if everything is okay. I think we can merge 2 PR

  7. added
    packageflutter/packages repository. See also p: labels.
    and removed
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 17, 2026
  8. added a commit that references this issue on Aug 26, 2026
    88c56fe
  9. Vi-debug commented on Aug 26, 2026

    @Vi-debug
    Contributor

    Update: the framework-side fix (removing the stale TODO) is in #190410. The actual SliverAppBar showOnScreen test coverage now lives in flutter/packages#12631, since Material is frozen here and the tests moved to material_ui per #188444.

  10. added a commit that references this issue on Aug 26, 2026
    e40bc54
  11. github-actions commented on Sep 10, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  12. locked as resolved and limited conversation to collaborators on Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: tests"flutter test", flutter_test, or one of our testsp: material_uimaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions