Skip to content

Example in NestedScrollView documentation is overcomplicated and misleading #20877

@jadengis

Description

@jadengis

I was using the NestedScrollView widget in my flutter application and was following the example present in the widget documentation here.

Following the example, I wrapped my SliverAppBar in a SliverOverlapAbsorber and used a SliverOverlapInjector in my inner scrollview to align it with the bottom of the SliverAppBar

Even though this has the desired effect of aligning the scrollview with the app bar, it has the following issues:

  • The GlowingOverscrollIndicator is hidden by the sliver app bar when you are scrolling upwards
  • The RefreshIndicator is not visible if the inner scroll view is wrapped in one.

The fix to all of these issues, to my surprise, was simply to completely remove the overlap absorber and injectors. The scrollview was appropriately aligned and the overscroll indicators and refresh indicators are visible.

I think the documentation here is misleading as it seems to suggest that these absorbers and injectors are necessary in order to use the NestedScrollView correctly, and it does not indicate the exact scenario when these special widgets are required (if they are required at all anymore).

Maybe the documentation should be updated to contain a simpler example that targets the simplest most common use case (that is, a scrolling app bar shared across multiple tabs / pages).

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.d: api docsIssues with https://api.flutter.dev/d: examplesSample code and demosf: scrollingViewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions