-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Refactor: Migrate page transition builder to widgets #174090
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
base: master
Are you sure you want to change the base?
Conversation
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. 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.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refactors several page transition related classes, moving them from the material
library to the widgets
library. This is a good step towards better code organization. My main feedback is regarding a layering violation introduced by the move, where the new files in the widgets
library still have dependencies on the material
library. I've left a specific comment on how to address this.
import '../material/color_scheme.dart'; | ||
import '../material/theme.dart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file has been moved to the widgets
library, but it still has dependencies on the material
library. The widgets
library is a lower-level package than material
and should not depend on it. These imports introduce a layering violation.
To resolve this, consider removing the dependency on Theme
and ColorScheme
by passing the required values (like backgroundColor
) down from the material layer where these builders are used, instead of looking them up from the context here.
Current implementation still contains import '../material/color_scheme.dart';
import '../material/theme.dart'; as import in |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate you jumping on this @rkishan516!
+1 to what @victorsanni said: #174090 (comment)
I just wanted to chime in to say that I'm exploring adding a widgets/system_ui directory for this kind of stuff. Depending on if or what you are able to move out of Material, that might be the long term destination for it.
Actually @victorsanni, Its both PageTransitionBuilder and PageTransitionTheme that depends on MaterialTheme right now.
Sure @justinmc, I can keep this MR on hold until |
It's a hard requirement that the Widgets library can't import Material or Cupertino, or else it creates a circular dependency. I do not think there is a way to move PageTransitionTheme down without causing issues right now, so that should stay in Material. Ongoing investigations are happening around theming options in the Widget layer and that may provide a way to do that later. So what should move down is PageTransitionsBuilder and the classes that extend from it. That still leaves the dependency on Theme and ColorScheme. Both are used to get a default background color for the transitions that need it. That gets partially resolved by adding a Also the Cupertino transition builder will need the relevant code from Cupertino to move down as well. |
b5ffd93
to
2e6a8ea
Compare
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. 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. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
2e6a8ea
to
98a9ced
Compare
@MitchellGoodwin I have updated PR based on your suggestion, but when backgroundColor is not given in PageTransitionBuilder, I had to fallback to transparent.
|
Hi @rkishan516, can you draft this PR and open separate PRs migrating these builders individually? Will make it much easier to review. |
Sure @victorsanni, Will do. |
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 Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
@victorsanni, 1st PR for migrate through breaking this PR. |
Changes:
part of: #172929
Pre-launch Checklist
///
).