Skip to content

Update ScrollableDetails for 2D scrolling - #122555

Merged
auto-submit[bot] merged 5 commits into
flutter:masterfrom
Piinks:scrollableDetailsUpgrade
Mar 14, 2023
Merged

auto-submit[bot] merged 5 commits into
flutter:masterfrom
Piinks:scrollableDetailsUpgrade

Conversation

@Piinks

@Piinks Piinks commented Mar 13, 2023

Copy link
Copy Markdown
Contributor

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 p: cupertino_ui cupertino_ui package in flutter/packages p: material_ui material_ui package in flutter/packages c: contributor-productivity Team-specific productivity, code health, technical debt. 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
Copy Markdown
Member

nit: the doc check is unhappy about some references.

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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. :)

Comment thread packages/flutter/test_fixes/cupertino/cupertino.dart Outdated
Comment thread packages/flutter/lib/fix_data/fix_widgets/fix_widgets.yaml Outdated
Comment thread packages/flutter/lib/fix_data/fix_widgets/fix_widgets.yaml Outdated
Comment thread packages/flutter/lib/src/widgets/scrollable_helpers.dart Outdated
Comment thread packages/flutter/test_fixes/cupertino/cupertino.dart Outdated
Comment thread packages/flutter/test_fixes/cupertino/cupertino.dart.expect Outdated
Comment thread packages/flutter/test_fixes/material/material.dart Outdated
Comment thread packages/flutter/test_fixes/material/material.dart.expect Outdated
Comment thread packages/flutter/test_fixes/widgets/widgets.dart Outdated
Comment thread packages/flutter/test_fixes/widgets/widgets.dart.expect Outdated
@Piinks
Piinks requested a review from goderbauer March 14, 2023 18:44

@goderbauer goderbauer left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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
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: contributor-productivity Team-specific productivity, code health, technical debt. c: new feature Nothing broken; request for a new capability c: tech-debt Technical debt, code quality, testing, etc. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. p: cupertino_ui cupertino_ui package in flutter/packages p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expand ScrollableDetails to include more info

2 participants