NestedScrollView persistent header sometimes looks awkward
Try wrapping your SliverPersistentHeader
with a SliverOverlapAbsorber
usually when working with NestedScrollView you will need to wrap the header in this object in order to not encounter rare scrolling artifacts like the red line you described.
I was not able to reproduce the issue with the change stated below. But you could also take a look to SliverOverlapInjector and the NestedScrollView class documentation which has examples using both of these widgets
...
NestedScrollView(
headerSliverBuilder: (context, scrolling) => [
SliverOverlapAbsorber(
handle:
NestedScrollView.sliverOverlapAbsorberHandleFor(context),
sliver: SliverPersistentHeader(
delegate: _Delegate(),
pinned: true,
),
...
Alexey Subbotin
Updated on December 28, 2022Comments
-
Alexey Subbotin over 1 year
Often when scroll is fast enough my app shows a small transparent line between scrolling view and persistent header.
Minimal reproducible code: https://gist.github.com/Moonspeaker/0e8573ff6620a7e00b8f7b04937b51a1
This is how it looks recorded on video: https://www.youtube.com/watch?v=DDxu1NTkaMA&feature=youtu.be
I have no clue how to fix this. The issue seems to be in
Align
widget withAlginment.bottomCenter
.Column
withMainAxisAlignment.end
works the same way.-
rickimaru about 3 yearsCan you circle out the "small transparent line" you're referring to? I can only see a "big white line" and a "small red line below the white line".
-
Alexey Subbotin about 3 yearsThe background of the whole app is red. That small red line is a margin between listview and header that should not be there.
-
rickimaru about 3 yearsI can't replicate your issue using the "minimal reproducable code". I'm just using emulator though (Android & iOS).
-
Alexey Subbotin about 3 yearsit happens in both release and debug versions on emulator and real device. Scroll up and down fast several times and you'll be seeing this happen
-
Alexey Subbotin about 3 yearsThe screenshot was taken in the app compiled from this gist. Tested on sdk: ">=2.12.0-29.10.beta <3.0.0", latest beta channel flutter.
-
Alexey Subbotin about 3 yearsIt is easier to reproduce if you let scrollphysics finish the scroll releasing gesture halfway
-
rickimaru about 3 yearsMaybe it only happens in beta channel. I'm using stable channel, and can't replicate the issue.
-
Alexey Subbotin about 3 yearsThis is how it looks to me on latest stable: youtube.com/watch?v=DDxu1NTkaMA&feature=youtu.be
-
Alexey Subbotin about 3 yearsSame on emulator
-
Alexey Subbotin about 3 yearsI noticed that setting heap to 1gb and ram to 8gb+ makes it harder to reproduce it on emulator somehow
-
Shriya Pandya about 3 yearsDo you meant about this transparent section stackoverflow.com/questions/51119795/…. ?
-