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

Update ScrollableDetails for 2D scrolling #122555

Merged
merged 5 commits into from Mar 14, 2023

Conversation

Piinks
Copy link
Contributor

@Piinks Piinks commented Mar 13, 2023

2D Scrolling proposal: flutter.dev/go/2D-Foundation

Fixes #122415

This expands the ScrollableDetails class to incorporate more properties of Scrollable. This will allow users to specify details for the scrollable of each axis without an ugly API that enumerates everything twice.

Highlights:

  • Deprecated clipBehavior in preference of decorationClipBehavior
    • This came up in design review as some existing API that was unclear how it applies to the scrollable class. It is not expected to have a lot of use as it is a lower level class used internally, but the name will be a lot clearer. Dart fix supported.
  • add scroll physics property
  • make controller nullable
    • this allows the PrimaryScrollController to be used in the context of TwoDimensionalScrollView
    • Requires adding assertions where previously required (ScrollBehavior.buildScrollbar + subclasses)
  • adds copyWith, ==, and hashCode methods
  • removed semanticChildCount and restorationId based on feedback from proposal (linked above)

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 this 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.

@Piinks Piinks added c: new feature Nothing broken; request for a new capability framework flutter/packages/flutter repository. See also f: labels. f: scrolling Viewports, list views, slivers, etc. labels Mar 13, 2023
@flutter-dashboard flutter-dashboard bot added f: cupertino flutter/packages/flutter/cupertino repository f: material design flutter/packages/flutter/material repository. team Infra upgrades, team productivity, code health, technical debt. See also team: labels. c: tech-debt Technical debt, code quality, testing, etc. labels Mar 13, 2023
@Piinks Piinks requested a review from goderbauer March 13, 2023 21:48
@goderbauer
Copy link
Member

nit: the doc check is unhappy about some references.

packages/flutter/lib/fix_data/fix_widgets/fix_widgets.yaml Outdated Show resolved Hide resolved
packages/flutter/lib/fix_data/fix_widgets/fix_widgets.yaml Outdated Show resolved Hide resolved
packages/flutter/lib/src/widgets/scrollable_helpers.dart Outdated Show resolved Hide resolved
Comment on lines +69 to +70
/// {@macro flutter.widgets.Scrollable.controller}
final ScrollController? controller;
Copy link
Member

Choose a reason for hiding this comment

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

Why is this nullable now? I noticed same new asserts above that assert its not. Maybe add some docs describing in what circumstances this needs to be set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do! This is nullable now because it needs to be ok for developers to not provide a scroll controller when using ScrollableDetails to configure a 2D scroller. This allows for things like PrimaryScrollController.

Copy link
Member

Choose a reason for hiding this comment

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

Am I right to assume that the 2D scroller will than fill this in with a ScrollController before this reaches the decoration stuff, which assumes this is set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup! It will, and that is also why I added the assertions, so any use ensures a controller is set. :)

packages/flutter/test_fixes/cupertino/cupertino.dart Outdated Show resolved Hide resolved
@Piinks Piinks requested a review from goderbauer March 14, 2023 18:44
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

Comment on lines +69 to +70
/// {@macro flutter.widgets.Scrollable.controller}
final ScrollController? controller;
Copy link
Member

Choose a reason for hiding this comment

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

Am I right to assume that the 2D scroller will than fill this in with a ScrollController before this reaches the decoration stuff, which assumes this is set?

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 14, 2023
@auto-submit auto-submit bot merged commit 4cac07b into flutter:master Mar 14, 2023
35 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App c: new feature Nothing broken; request for a new capability c: tech-debt Technical debt, code quality, testing, etc. 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. team Infra upgrades, team productivity, code health, technical debt. See also team: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expand ScrollableDetails to include more info
2 participants