Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sliverappbar stretch effect #73

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

himalaya-nuts
Copy link

Fixes issue: Unable to stretch SliverAppBar issue

This is a quick hack, optimal effect requires extensive refactoring, thus official Flutter team is not picking up this issue. Some limitations apply:

  1. The body scroll view must have BouncingScrollPhysics, when the SliverAppBar background stretches, so does the body scroll view.
  2. SliverAppBar and body scroll physics does not connect seamlessly. As a result, the SliverAppBar won't stretch by carried momentum (when you quick fling down then not touching the screen), your fingertip has to be touching the screen when stretching the SliverAppBar.

See scroll to top demo to have a play.

@@ -723,7 +730,8 @@ class _NestedScrollCoordinator
}
}

if (innerPosition == null) {
// Kenshin: if innser scrollview is scrolled beyond top, change _outerPosition only
if (innerPosition == null || (_stretchHeaderSlivers && innerPosition.pixels == 0.0)) {

Choose a reason for hiding this comment

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

this should be innerPosition.pixels <= 0.0, if use equal, sometimes, inner scrollview is not scroll to top

Copy link
Author

Choose a reason for hiding this comment

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

thanks!

@Ruslanbek0809
Copy link

Hi I used your commit. When I use stretch I get errors like these:
'package:extended_nested_scroll_view/src/old_extended_nested_scroll_view.dart': Failed assertion: line 832 pos 16: 'minRange <= maxRange': is not true.

'package:flutter/src/widgets/scrollable.dart': Failed assertion: line 628 pos 12: '_drag == null': is not true.

Are there any solutions?

@flutting
Copy link

你的代码已经报错了, 需要改一下才能运行, 这样是不能合并的.

@akbulutdora
Copy link

Does anyone follow this PR or this problem anymore? If you've found a solution, what was it?

@zmtzawqlp
Copy link
Member

i'm waiting an official pr, if you have a good idea, you can push a pr to flutter team. i must make sure the codes will not breaking any other function

@akbulutdora
Copy link

I understand. My question was regarding this problem with the outer body overscrolling/stretching at the top (for refresh effect similar to popular social media apps) and load more effect with the bottom (i can actually achieve this one myself using the infinite_scroll_pagination package). Could not achieve a proper refresh effect so far.

@fikretsengul
Copy link

I'm trying to simulate the app bar large title stretch effect in iOS, it would be great if we could especially fix the 2nd problem and add this as a feature for this package. @zmtzawqlp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants