-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Cleanup PageTransitionsTheme documentation and add one example #121701
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
Cleanup PageTransitionsTheme documentation and add one example #121701
Conversation
61b81da to
56479db
Compare
|
@jason-simmons |
HansMuller
left a comment
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.
Looks good, just some trivialities.
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.
It's a little confusing to say that we're deactivating the snapshotting optimzation, since presumably we're turning allowEnterRouteSnapshotting off as a performance optimization. It might be simpler to demo the allowSnapshotting property. You could reuse the API doc's description for the comment: Improve performance by disabling [SnapshotWidget]-based animations on both the outgoing and incoming route.
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.
since presumably we're turning allowEnterRouteSnapshotting off as a performance optimization
It’s very interesting that you made this comment because it shows that the documentation is not clear enough.
Enabling snapshotting is the performance optimization. The main documentation for allowSnapshotting explains this well (https://master-api.flutter.dev/flutter/widgets/PageRoute/allowSnapshotting.html) but the _ZoomPageTransition.allowSnapshotting comment is ambiguous.
I updated the PR with a change in _ZoomPageTransition.allowSnapshotting comment.
It might be simpler to demo the allowSnapshotting property
I hesitated to demo this in the example, but it turned out that we had several reports related to this (for instance #121100 and #119897). And one goal was to have somewhere to point out.
I too would have preferred to demo allowSnapshotting instead of allowEnterRouteSnapshotting but allowSnapshotting is not available on ZoomPageTransitionsBuilder.
It would be great to discuss if we want to expose this property. My concern is that exposing it might lead to people deactivating the optimization just in case…
While looking again at ZoomPageTransitionsBuilder, I think not exposing this property was done on purpose and that it is expected to configure this only on a per route basis instead of configuring this globally.
Demoing neither allowSnapshotting nor allowEnterRouteSnapshotting in this PR code sample seems to be the best solution for the moment. It is probably wiser to demo ‘allowSnapshotting’ by adding an example to MaterialPageRoute.
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.
Its true that globally disabling this property is not easy right now. I would not be opposed to making it public though - if folks want to opt out they should certainly be able to
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 agree that the code is simpler and so easier to read now. The updated API docs are easier to read too. LGTM
3fd03b8 to
0eb497d
Compare
HansMuller
left a comment
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.
LGTM
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.
| /// When this value is true, this improves performance by disabling animations | |
| /// When this value is true, performance is improved by disabling animations |
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 agree that the code is simpler and so easier to read now. The updated API docs are easier to read too. LGTM
0eb497d to
27556e5
Compare
Description
This PR cleanup
PageTransitionsThemedocumentation and adds one example to show how to set a customPageTransitionsThemefor aMaterialApp.Related Issue
Fixes #121700
Tests
Adds 1 test for the new example.