Skip to content

Conversation

@bleroux
Copy link
Contributor

@bleroux bleroux commented Mar 1, 2023

Description

This PR cleanup PageTransitionsTheme documentation and adds one example to show how to set a custom PageTransitionsTheme for a MaterialApp.

Related Issue

Fixes #121700

Tests

Adds 1 test for the new example.

@flutter-dashboard flutter-dashboard bot added d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos documentation f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. c: contributor-productivity Team-specific productivity, code health, technical debt. labels Mar 1, 2023
@bleroux bleroux force-pushed the cleanup_PageTransitionsTheme_documentation branch 2 times, most recently from 61b81da to 56479db Compare March 1, 2023 18:08
@bleroux
Copy link
Contributor Author

bleroux commented Mar 1, 2023

@jason-simmons
I filed this PR after reading your comment in #121325 (comment).
You might be interested in reviewing it.

Copy link
Contributor

@HansMuller HansMuller left a 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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor

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

@bleroux bleroux force-pushed the cleanup_PageTransitionsTheme_documentation branch from 3fd03b8 to 0eb497d Compare March 2, 2023 09:57
@bleroux bleroux requested a review from HansMuller March 2, 2023 13:11
Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

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

LGTM

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
/// When this value is true, this improves performance by disabling animations
/// When this value is true, performance is improved by disabling animations

Copy link
Contributor

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

@bleroux bleroux force-pushed the cleanup_PageTransitionsTheme_documentation branch from 0eb497d to 27556e5 Compare March 2, 2023 19:07
@bleroux bleroux added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 2, 2023
@auto-submit auto-submit bot merged commit a4ecd3e into flutter:master Mar 2, 2023
@bleroux bleroux deleted the cleanup_PageTransitionsTheme_documentation branch March 2, 2023 20:51
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 3, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 3, 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. 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.

PageTransitionsTheme documentation needs some cleanup

3 participants