Skip to content

Conversation

@Piinks
Copy link
Contributor

@Piinks Piinks commented Feb 24, 2021

This change exposes the current ScrollBehaviors used in Widgets, Cupertino, and Material Apps. The default behaviors for Cupertino and Material were previously private, so they have been made public to enable users to extend and build on them to create their own custom ScrollBehaviors.
This also adds the ability to provide your own default ScrollBehavior at the app level. This was not easily achieved or discovered before by users looking to change default behaviors like the glowing overscroll indicator. Previously, users would need to add their own ScrollConfiguration in the tree to subvert the default one created by the app.

This is an important prerequisite to #71322 and #40107, which will add new default features to ScrollBehavior.

Fixes #76490

Design Document

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added f: cupertino flutter/packages/flutter/cupertino repository f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Feb 24, 2021
@google-cla google-cla bot added the cla: yes label Feb 24, 2021
@skia-gold
Copy link

Gold has detected about 1 untriaged digest(s) on patchset 1.
View them at https://flutter-gold.skia.org/cl/github/76739

@Piinks Piinks added f: scrolling Viewports, list views, slivers, etc. a: desktop Running on desktop platform-web Web applications specifically c: new feature Nothing broken; request for a new capability labels Feb 25, 2021
@Piinks Piinks changed the title [WIP] Exposing ScrollBehaviors Exposing ScrollBehaviors for app-wide settings Mar 9, 2021
@Piinks Piinks marked this pull request as ready for review March 9, 2021 22:02
@Piinks Piinks requested a review from goderbauer March 9, 2021 22:07
///
/// {@macro flutter.widgets.scrollBehavior}
///
/// Setting a [CupertinoScrollBehavior] for your app will result in
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

(also elsewhere in this PR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh gosh thanks. I've feel like I've fallen off the wagon lately with passive language and empty prose. 🤣

this.shortcuts,
this.actions,
this.restorationScopeId,
this.scrollBehavior,
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to bake this into the WidgetApp? The widget app could just not have an oppinion and you can provide the behavior you want by wrapping it in a ScrollConfiguration.

Copy link
Member

Choose a reason for hiding this comment

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

(if we keep this, MaterialApp and CuppertinoApp should pass this in instead of wrapping with their own ScrollConfiguraiton)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I go back and forth, I settled on yes since every app has to have a ScrollBehavior.. but I could go either way. I'll clean this up to have Material/Cupertino pass it and see how it looks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, now that I play with it the other way, I think it's cleaner to go with the other option.

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

@fluttergithubbot
Copy link
Contributor

This pull request is not suitable for automatic merging in its current state.

  • The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@Piinks
Copy link
Contributor Author

Piinks commented Mar 11, 2021

Confirmed the Google testing failure was a flake. Set to green manually.

@Piinks Piinks mentioned this pull request Apr 5, 2021
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop c: new feature Nothing broken; request for a new capability f: cupertino flutter/packages/flutter/cupertino repository f: material design flutter/packages/flutter/material repository. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. platform-web Web applications specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add GlowlessScrollBehavior

4 participants