Skip to content

Conversation

@chunhtai
Copy link
Contributor

@chunhtai chunhtai commented Mar 22, 2023

fixes #71396

and move semantics to sliverReoderableList

all i18n related change is in first commit.

reorderable list related change is in second commit

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.

@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 Mar 22, 2023
@flutter-dashboard flutter-dashboard bot added a: internationalization Supporting other languages or locales. (aka i18n) c: contributor-productivity Team-specific productivity, code health, technical debt. labels Mar 23, 2023
@chunhtai chunhtai marked this pull request as ready for review March 23, 2023 20:17
@chunhtai chunhtai force-pushed the issues/71396 branch 2 times, most recently from 7cd4d89 to a18805d Compare March 23, 2023 20:55
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 make this required because this has to be the same as the scrollview, so It feels weird to me that we let people omit this property.

Copy link
Member

Choose a reason for hiding this comment

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

It's a bit surprising that you have to tell the sliver in which direction it scrolls (and keep that in sync manually with e.g. the ScrollView). I don't think we do this for any other sliver. Can this sliver not find out the scroll direction by e.g. looking up Scrollable.of?

cc @Piinks

Copy link
Contributor

Choose a reason for hiding this comment

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

This should not be necessary, the scroll direction is provided to the sliver during layout in the SliverConstraints.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, it looks like the scroll direction is already known, there is a _scrollDirection available in the widgets/SliverReorderableListState

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rendering layer may be too late to apply the semantics actions to children.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right right, SliverReorderableList does not actually have its own rendering object anyways, my mistake. Does the _scrollDirection that is already available from the state work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Piinks Do you think using Scrollable.maybeOf would be a good solution?

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 yeah, I missed it, it looks like it was using scrollable.of. I will just use that.

@chunhtai
Copy link
Contributor Author

I have separated out i18n and reorderablelist changes into separate commit, hopefully this makes it easier to review

@chunhtai
Copy link
Contributor Author

a friendly bump

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.

The first commit is super-hard to review. Maybe separate hand-crafted changes to the tool and automatically generated changes into two separate commits.

Also, do the changes to the tool have to happen in the same PR that modifies the semantics of the reorderable list? Should/could those land separately?

Last, but not least, please get someone more familiar with dev/tools/localization and flutter_localizations to review those bits.

Copy link
Member

Choose a reason for hiding this comment

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

It's a bit surprising that you have to tell the sliver in which direction it scrolls (and keep that in sync manually with e.g. the ScrollView). I don't think we do this for any other sliver. Can this sliver not find out the scroll direction by e.g. looking up Scrollable.of?

cc @Piinks

Copy link
Member

Choose a reason for hiding this comment

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

Is this method a straight copy from reorderable_list.dart?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

Copy link
Member

Choose a reason for hiding this comment

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

Should this be widgetsLocaleToResources? Maybe add a test that would have failed for this case

Copy link
Member

Choose a reason for hiding this comment

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

wondering: why are they not all const?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this bool decide whether to add const keyword when calling factory. Since material/cupertino pass in parameter to when calling factory, they can't use the const. Will update the name to be more precise

Copy link
Contributor

Choose a reason for hiding this comment

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

What if this conflicts with the scroll direction provided by the constraints during layout?

@chunhtai chunhtai mentioned this pull request Mar 28, 2023
8 tasks
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (widget.scrollDirection == Axis.horizontal) {
if (_scrollDirection == Axis.horizontal) {

Maybe?

@chunhtai
Copy link
Contributor Author

turning this into draft until https://github.com/flutter/flutter/pull/123620/files is merged

@chunhtai chunhtai marked this pull request as draft March 28, 2023 17:35
@chunhtai chunhtai force-pushed the issues/71396 branch 2 times, most recently from 0ecd0a7 to eab3c1a Compare April 5, 2023 20:11
@chunhtai chunhtai marked this pull request as ready for review April 5, 2023 20:12

/// The semantics label used for [ReorderableListView] to reorder an item in the
/// list to the start of the list.
String get reorderItemToStart;
Copy link
Contributor

Choose a reason for hiding this comment

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

Will removing these public getters be a breaking change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If someone is using it, then yes. It is hard to imagine how people will reuse this though.

I am not sure whether people would extend this class. @thkim1011, do you know if there is use case for that?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not familiar with any use cases regarding extending the class, but I assume anyone can get the localizations and use those strings in their project? I'm not too sure how we've handled deprecating strings in the past.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is technically not a breaking change given all tests pass. The breaking change guide states it would be optional whether we announce this as a courtesy. I personally think it is very unlikely this would be a breaking change. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

If no tests broke that sounds fine to me. I would probably do a global test run in Google before this lands though to make sure.

@chunhtai chunhtai requested a review from goderbauer April 6, 2023 20:26
@chunhtai chunhtai requested a review from Piinks April 6, 2023 20:26
Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

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

Flutter_LGTM

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!

@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 6, 2023
@auto-submit auto-submit bot merged commit 94327e7 into flutter:master Apr 6, 2023
XilaiZhang added a commit that referenced this pull request Apr 6, 2023
@borjandev
Copy link

@Piinks @chunhtai This breaks https://pub.dev/packages/reorderables

Could not build the precompiled application for the device.
Error (Xcode): ../../.pub-cache/hosted/pub.dev/reorderables-0.6.0/lib/src/widgets/reorderable_wrap.dart:737:34: Error: The getter 'reorderItemToStart' isn't defined for the class 'MaterialLocalizations'.

However, maybe the resolution is for the package maintainer, I believe @hanshengchiu to update the package instead

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 7, 2023
@chunhtai chunhtai added revert Autorevert PR (with "Reason for revert:" comment) and removed revert Autorevert PR (with "Reason for revert:" comment) labels Apr 7, 2023
@chunhtai
Copy link
Contributor Author

chunhtai commented Apr 7, 2023

I will prepare a migration guide and dart fix, it looks like it is more widely used than I think

@Piinks
Copy link
Contributor

Piinks commented Apr 7, 2023

Thanks @chunhtai !

@borjandev unfortunately any change could potentially break a package on pub.dev
We cannot account for all of them, but we do have several signals we use to indicate breaking changes to us.

Any contributor can add tests to flutter/tests, and if a change breaks them, we won't make the change without working with the contributor to ensure the package is not broken. Maybe https://pub.dev/packages/reorderables would like to contribute tests.

We also look at how our own tests are affected by a change, and how customer tests inside of Google are affected.

In this case, our signals worked and the change was reverted after we found Google tests were broken by the change.

To learn more about our breaking change policy and how we determine breaking changes, you can read the breaking change section in the wiki.

exaby73 pushed a commit to NevercodeHQ/flutter that referenced this pull request Apr 17, 2023
Refactor reorderable list semantics
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

a: internationalization Supporting other languages or locales. (aka i18n) autosubmit Merge PR when tree becomes green via auto submit App c: contributor-productivity Team-specific productivity, code health, technical debt. f: cupertino flutter/packages/flutter/cupertino repository f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ReorderableListView merges semantics of list item's children preventing activation of child widget

5 participants