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

Remove hack from PageView. #141138

Merged
merged 28 commits into from
Jan 12, 2024
Merged

Remove hack from PageView. #141138

merged 28 commits into from
Jan 12, 2024

Conversation

polina-c
Copy link
Contributor

@polina-c polina-c commented Jan 8, 2024

Fixes #141119

The change is breaking, because now controller is nullable.

Migration path: flutter/website#10033

Packages to fix:

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@github-actions github-actions bot added the framework flutter/packages/flutter repository. See also f: labels. label Jan 8, 2024
@polina-c polina-c added a: leak tracking Issues and PRs related to memory leaks detected by leak_tracker and removed framework flutter/packages/flutter repository. See also f: labels. labels Jan 8, 2024
@github-actions github-actions bot added the framework flutter/packages/flutter repository. See also f: labels. label Jan 8, 2024
@polina-c polina-c marked this pull request as draft January 8, 2024 22:24
@flutter-dashboard
Copy link

This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

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.

fly-by comment

packages/flutter/lib/src/widgets/page_view.dart Outdated Show resolved Hide resolved
@github-actions github-actions bot added the f: material design flutter/packages/flutter/material repository. label Jan 10, 2024
@github-actions github-actions bot added d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos labels Jan 10, 2024
@@ -49,7 +49,7 @@ void main() {

// Verify that page view index is also updated with same index to page indicator.
final PageView pageView = tester.widget<PageView>(find.byType(PageView));
expect(pageView.controller.page, 1);
expect(pageView.controller!.page, 1);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: Document migration path if in general the change is ok.

Copy link
Contributor Author

@polina-c polina-c Jan 10, 2024

Choose a reason for hiding this comment

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

It is strange google testing is not triggered.
TODO: test in Google separately.

Copy link
Member

Choose a reason for hiding this comment

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

If nothing in Google and no customer_test is failing this wouldn't need a migration.

Copy link
Contributor Author

@polina-c polina-c Jan 10, 2024

Choose a reason for hiding this comment

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

One failure in Google: http://cl/597367314 😄

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

@Levi-Lesches
Copy link
Contributor

Maybe I'm missing something here, but why use ! in the workaround? If a controller wasn't provided that would fail, and if a controller was provided, then you should use that variable instead of pageView.controller. Shouldn't the official advice be ?. instead?

@polina-c
Copy link
Contributor Author

polina-c commented Jan 11, 2024

Maybe I'm missing something here, but why use ! in the workaround? If a controller wasn't provided that would fail, and if a controller was provided, then you should use that variable instead of pageView.controller. Shouldn't the official advice be ?. instead?

If you want to control the state of widget, you need to provide controller, so it is not null. And, normally, if you provide the controller, you already have it, so you do not need to get it from widget.

If you do not want to control the state of widget, you do not need to access the controller.

Does it help?

@polina-c polina-c added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 12, 2024
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jan 12, 2024
Copy link
Contributor

auto-submit bot commented Jan 12, 2024

auto label is removed for flutter/flutter/141138, due to - The status or check suite Linux flutter_plugins has failed. Please fix the issues identified (or deflake) before re-applying this label.

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

@polina-c polina-c merged commit 2da87e6 into flutter:master Jan 12, 2024
66 checks passed
@polina-c polina-c deleted the fix-page-view branch January 12, 2024 17:47
@itsjustkevin itsjustkevin added the revert Autorevert PR (with "Reason for revert:" comment) label Jan 12, 2024
auto-submit bot pushed a commit that referenced this pull request Jan 12, 2024
@auto-submit auto-submit bot removed the revert Autorevert PR (with "Reason for revert:" comment) label Jan 12, 2024
auto-submit bot added a commit that referenced this pull request Jan 12, 2024
Reverts #141138
Initiated by: itsjustkevin
This change reverts the following previous change:
Original Description:
Fixes #141119

The change is breaking, because now controller is nullable.

Migration path: flutter/website#10033

Packages to fix:
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 13, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 13, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 14, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 14, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 14, 2024
@polina-c polina-c restored the fix-page-view branch January 14, 2024 18:52
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jan 14, 2024
flutter/flutter@7dc856a...1a2c315

2024-01-14 sokolovskyi.konstantin@gmail.com BoxPainter should dispatch creation and disposal events. (flutter/flutter#141526)
2024-01-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from a0ac66ecaa2b to f20657354d8b (1 revision) (flutter/flutter#141518)
2024-01-13 engine-flutter-autoroll@skia.org Roll Flutter Engine from b06478b70a2f to a0ac66ecaa2b (1 revision) (flutter/flutter#141498)
2024-01-13 engine-flutter-autoroll@skia.org Roll Flutter Engine from 205ed6882a8f to b06478b70a2f (3 revisions) (flutter/flutter#141496)
2024-01-13 engine-flutter-autoroll@skia.org Roll Flutter Engine from b8e5d4776908 to 205ed6882a8f (1 revision) (flutter/flutter#141492)
2024-01-12 engine-flutter-autoroll@skia.org Roll Flutter Engine from 418c9e918a22 to b8e5d4776908 (7 revisions) (flutter/flutter#141489)
2024-01-12 everythingoutdated@gmail.com Added newline at end of `.gitignore` files (flutter/flutter#141270)
2024-01-12 49699333+dependabot[bot]@users.noreply.github.com Bump actions/upload-artifact from 4.0.0 to 4.1.0 (flutter/flutter#141480)
2024-01-12 anis.alibegic@gmail.com Fixed a lot of typos (flutter/flutter#141431)
2024-01-12 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Remove hack from PageView." (flutter/flutter#141479)
2024-01-12 engine-flutter-autoroll@skia.org Roll Flutter Engine from 01e353544dd7 to 418c9e918a22 (2 revisions) (flutter/flutter#141474)
2024-01-12 engine-flutter-autoroll@skia.org Roll Flutter Engine from 0ac8215c70ae to 01e353544dd7 (1 revision) (flutter/flutter#141470)
2024-01-12 engine-flutter-autoroll@skia.org Roll Flutter Engine from ef2cf86c35a5 to 0ac8215c70ae (2 revisions) (flutter/flutter#141464)
2024-01-12 christopherfujino@gmail.com unpin web_socket_channel and roll pub packages (flutter/flutter#141424)
2024-01-12 barpac02@gmail.com FlutterExtension: make fields non-static (flutter/flutter#141463)
2024-01-12 jhy03261997@gmail.com [deep link]  Update a gradle task to add flag check and intent filter check to the AppLinkSettings (flutter/flutter#141231)
2024-01-12 barpac02@gmail.com Expose versionCode and versionName from local.properties in FlutterExtension (flutter/flutter#141417)
2024-01-12 engine-flutter-autoroll@skia.org Roll Flutter Engine from a56f346dbbf9 to ef2cf86c35a5 (1 revision) (flutter/flutter#141456)
2024-01-12 jonahwilliams@google.com When Impeller is enabled for flutter tester choose correct shader target. (flutter/flutter#141391)
2024-01-12 polinach@google.com Remove hack from PageView. (flutter/flutter#141138)
2024-01-12 engine-flutter-autoroll@skia.org Roll Flutter Engine from d0f9329c5ce4 to a56f346dbbf9 (6 revisions) (flutter/flutter#141451)
2024-01-12 50643541+Mairramer@users.noreply.github.com Adds support for StepStyle visual property bundle to the Step widget (flutter/flutter#140825)
2024-01-12 engine-flutter-autoroll@skia.org Roll Flutter Engine from 44a0a6ee4d39 to d0f9329c5ce4 (1 revision) (flutter/flutter#141435)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC camillesimon@google.com,rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
arc-yong pushed a commit to Arctuition/packages-arc that referenced this pull request Jun 14, 2024
…r#5895)

flutter/flutter@7dc856a...1a2c315

2024-01-14 sokolovskyi.konstantin@gmail.com BoxPainter should dispatch creation and disposal events. (flutter/flutter#141526)
2024-01-14 engine-flutter-autoroll@skia.org Roll Flutter Engine from a0ac66ecaa2b to f20657354d8b (1 revision) (flutter/flutter#141518)
2024-01-13 engine-flutter-autoroll@skia.org Roll Flutter Engine from b06478b70a2f to a0ac66ecaa2b (1 revision) (flutter/flutter#141498)
2024-01-13 engine-flutter-autoroll@skia.org Roll Flutter Engine from 205ed6882a8f to b06478b70a2f (3 revisions) (flutter/flutter#141496)
2024-01-13 engine-flutter-autoroll@skia.org Roll Flutter Engine from b8e5d4776908 to 205ed6882a8f (1 revision) (flutter/flutter#141492)
2024-01-12 engine-flutter-autoroll@skia.org Roll Flutter Engine from 418c9e918a22 to b8e5d4776908 (7 revisions) (flutter/flutter#141489)
2024-01-12 everythingoutdated@gmail.com Added newline at end of `.gitignore` files (flutter/flutter#141270)
2024-01-12 49699333+dependabot[bot]@users.noreply.github.com Bump actions/upload-artifact from 4.0.0 to 4.1.0 (flutter/flutter#141480)
2024-01-12 anis.alibegic@gmail.com Fixed a lot of typos (flutter/flutter#141431)
2024-01-12 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Remove hack from PageView." (flutter/flutter#141479)
2024-01-12 engine-flutter-autoroll@skia.org Roll Flutter Engine from 01e353544dd7 to 418c9e918a22 (2 revisions) (flutter/flutter#141474)
2024-01-12 engine-flutter-autoroll@skia.org Roll Flutter Engine from 0ac8215c70ae to 01e353544dd7 (1 revision) (flutter/flutter#141470)
2024-01-12 engine-flutter-autoroll@skia.org Roll Flutter Engine from ef2cf86c35a5 to 0ac8215c70ae (2 revisions) (flutter/flutter#141464)
2024-01-12 christopherfujino@gmail.com unpin web_socket_channel and roll pub packages (flutter/flutter#141424)
2024-01-12 barpac02@gmail.com FlutterExtension: make fields non-static (flutter/flutter#141463)
2024-01-12 jhy03261997@gmail.com [deep link]  Update a gradle task to add flag check and intent filter check to the AppLinkSettings (flutter/flutter#141231)
2024-01-12 barpac02@gmail.com Expose versionCode and versionName from local.properties in FlutterExtension (flutter/flutter#141417)
2024-01-12 engine-flutter-autoroll@skia.org Roll Flutter Engine from a56f346dbbf9 to ef2cf86c35a5 (1 revision) (flutter/flutter#141456)
2024-01-12 jonahwilliams@google.com When Impeller is enabled for flutter tester choose correct shader target. (flutter/flutter#141391)
2024-01-12 polinach@google.com Remove hack from PageView. (flutter/flutter#141138)
2024-01-12 engine-flutter-autoroll@skia.org Roll Flutter Engine from d0f9329c5ce4 to a56f346dbbf9 (6 revisions) (flutter/flutter#141451)
2024-01-12 50643541+Mairramer@users.noreply.github.com Adds support for StepStyle visual property bundle to the Step widget (flutter/flutter#140825)
2024-01-12 engine-flutter-autoroll@skia.org Roll Flutter Engine from 44a0a6ee4d39 to d0f9329c5ce4 (1 revision) (flutter/flutter#141435)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC camillesimon@google.com,rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: leak tracking Issues and PRs related to memory leaks detected by leak_tracker d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos 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.

PageView uses global controller, that is never disposed.
4 participants