-
Notifications
You must be signed in to change notification settings - Fork 29.2k
Android 12 overscroll stretch effect #87839
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
Conversation
Gold has detected about 6 new digest(s) on patchset 5. |
Gold has detected about 6 new digest(s) on patchset 7. |
Looks like some docs are not compiling.. |
Gold has detected about 6 new digest(s) on patchset 8. |
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Gold has detected about 6 new digest(s) on patchset 12. |
Now that we're working on this, maybe the new How one could remove the glowing color with as less code as possible to match the native implementation? |
Hey @pedromassango, I am not sure I follow. The stretching overscroll indicator is intended to be used instead of the glowing overscroll indicator. They are not intended to be used together. Why would the stretch require a color? |
Sorry, my goal is to achieve the original behavior with just the new widget. This is the code I used to build the app above: StretchingOverscrollIndicator(
axisDirection: AxisDirection.down,
child: ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) {
return Text('$index');
},
),
) I was expecting to not see the glowing color, so what I'm suggesting is to have a way to easily remove that color |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
3753721
to
825ba59
Compare
Gold has detected about 1 new digest(s) on patchset 12. |
Gold has detected about 6 new digest(s) on patchset 13. |
How do you enable the new overscroll effect? I'm not seeing the procedure anywhere. |
You can enable the new overscroll stretch effect by
StretchingOverscrollIndicator(
axisDirection: AxisDirection.down,
child: CustomScrollView(...),
)
MaterialApp(
theme: ThemeData(
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
...
),
darkTheme: ThemeData(
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
...
),
themeMode: ThemeMode.system,
home: Scaffold(
body: MyHomePage(),
),
); Edit: As of Flutter 3.0, ScrollBehavior.androidOverscrollIndicator is deprecated, use ThemeData.useMaterial3, or override ScrollBehavior.buildOverscrollIndicator to choose the desired indicator |
@@ -271,7 +279,7 @@ class _GlowingOverscrollIndicatorState extends State<GlowingOverscrollIndicator> | |||
assert(false); | |||
} | |||
final bool isLeading = controller == _leadingController; | |||
if (_lastNotificationType != OverscrollNotification) { | |||
if (_lastNotificationType is! OverscrollNotification) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ref #113212
The deprecated OverscrollIndicatorNotification.disallowGlow has expired and is removed in the PR. The replacement is OverscrollIndicatorNotification.disallowIndicator. This deprecation was introduced in #87839 when the StretchingOverscrollIndicator was added. The name change made it clearer since there is now more than one overscroll indicator. This change is supported by dart fix. � Part of #127042
…er#127050) The deprecated OverscrollIndicatorNotification.disallowGlow has expired and is removed in the PR. The replacement is OverscrollIndicatorNotification.disallowIndicator. This deprecation was introduced in flutter#87839 when the StretchingOverscrollIndicator was added. The name change made it clearer since there is now more than one overscroll indicator. This change is supported by dart fix. â�� Part of flutter#127042
This adds an approximation of the Android 12 overscroll effect.
Part of #82906
This does not make it the default (for now). Investigating how breaking it would be to make that switch (from glowing to stretching). A migration period may be necessary first.
A full fidelity update will be necessary after https://github.com/flutter/flutter/projects/207 is completed.
overscroll.mov
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.