Skip to content

Conversation

@darrenaustin
Copy link
Contributor

@darrenaustin darrenaustin commented May 15, 2021

The current default page transitions defined for desktop and web platforms use existing slide-up or fade transitions used on Android and iOS. As page transitions like this are not the norm for desktops or web, this PR changes the defaults to only have transitions for the mobile platforms and shuts them off for everything else including web running on anything.

This doesn't appear to be a breaking change as I tested it against the community tests and our internal tests. However, if you need to restore the previous defaults, you can add this to your app's theme:

MaterialApp(
  theme: ThemeData(
      pageTransitionsTheme: const PageTransitionsTheme(
        builders: <TargetPlatform, PageTransitionsBuilder>{
          TargetPlatform.android: FadeUpwardsPageTransitionsBuilder(),
          TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
          TargetPlatform.linux: FadeUpwardsPageTransitionsBuilder(),
          TargetPlatform.macOS: CupertinoPageTransitionsBuilder(),
          TargetPlatform.windows: FadeUpwardsPageTransitionsBuilder(),
        },
      )
  )
)

Fixes: #82053

I updated several tests to ensure the right transitions are getting picked up, as well as removed macOS from several tests and turned some off when running on the web, as transitions were no longer the default in those configurations.

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 feature I am adding, or Hixie said the PR is test-exempt.
  • All existing and new tests are passing.

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels May 15, 2021
@google-cla google-cla bot added the cla: yes label May 15, 2021
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.

Wondering: Does the material spec define any kind of transition for Desktop (or the web)? In other words: Is not having a transition in line with the spec?

/cc @yjbanov Is it the right thing to not have a transition on the web?

@darrenaustin
Copy link
Contributor Author

Wondering: Does the material spec define any kind of transition for Desktop (or the web)? In other words: Is not having a transition in line with the spec?

I looked, but didn't see any guidance for this. As this is an uncommon in desktop applications it seems reasonable to turn them off. As I showed above, if and app does want them it is pretty straightforward to add them to the theme data for the app.

@darrenaustin darrenaustin requested a review from yjbanov May 18, 2021 23:27
@darrenaustin
Copy link
Contributor Author

I just updated the PR based on the review comments. I switched back to just a single builders parameter to the theme to keep it simple. Please let me know what you think. Thx.

Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

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

LGTM if also LGT web team

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

@yjbanov
Copy link
Contributor

yjbanov commented May 27, 2021

Our designers tell me that full page transitions without animations make sense, so LGTM!

Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

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

lgtm

/// animated transition for other platforms or if the app is running on the
/// web.
const PageTransitionsTheme({
Map<TargetPlatform, PageTransitionsBuilder> builders = kIsWeb ? _defaultWebBuilders : _defaultBuilders,
Copy link
Contributor

Choose a reason for hiding this comment

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

kIsWeb is true both in desktop and mobile browsers. Do we want to shut off transitions in mobile browsers too?

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 believe we do. That is the feedback I got when I asked this question on this issue. For most web apps that aren't PWAs I would think they would want consistent behavior. For apps that do want transitions, they can provide them either manually or by using the theme settings detailed above.

@johnpryan
Copy link
Contributor

I disagree that this should be disabled for the entire web platform - many web apps would like to keep the page transitions when the user accesses the web app from a mobile browser.

Could we base this decision on the platform, not the kIsWeb flag instead?

@darrenaustin
Copy link
Contributor Author

I disagree that this should be disabled for the entire web platform - many web apps would like to keep the page transitions when the user accesses the web app from a mobile browser.

You can get this behaviour by adding the following to their app's theme:

MaterialApp(
  theme: ThemeData(
      pageTransitionsTheme: const PageTransitionsTheme(
        builders: <TargetPlatform, PageTransitionsBuilder>{
          TargetPlatform.android: FadeUpwardsPageTransitionsBuilder(),
          TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
        },
      )
  )
)

Which will override the defaults for both web and mobile to use the mobile style transitions.

This PR is just changing the defaults, and the feedback we got was that in general apps for the web did not want transitions by default.

darrenaustin added a commit that referenced this pull request Sep 13, 2021
@goderbauer
Copy link
Member

You can get this behaviour by adding the following to their app's theme:

We should add that to the API docs somewhere. Maybe even on MaterialApp?

guidezpl added a commit that referenced this pull request Sep 15, 2021
* add `semanticsLabel` to `SelectableText`

* remove unused vars

* Squashed commit of the following:

commit 3e687a9
Author: engine-flutter-autoroll <[email protected]>
Date:   Tue Sep 14 17:42:05 2021 -0400

    Roll Plugins from 4a98e23 to b85edeb (2 revisions) (#90083)

commit ad936b4
Author: Christopher Fujino <[email protected]>
Date:   Tue Sep 14 14:39:17 2021 -0700

    [flutter_conductor] Support initial stable release version (#89775)

commit ff5dd54
Author: Ian Hickson <[email protected]>
Date:   Tue Sep 14 13:02:04 2021 -0700

    Mention the ToS on our README (#89765)

commit 8587b60
Author: Kate Lovett <[email protected]>
Date:   Tue Sep 14 14:53:33 2021 -0500

    Update local gold api (#90072)

commit 7d368dc
Author: Justin McCandless <[email protected]>
Date:   Tue Sep 14 12:39:19 2021 -0700

    InteractiveViewer with a child of zero size (#90012)

    Asserts that the InteractiveViewer child can't have zero size.

commit 2b4ef18
Author: Akira Aratani <[email protected]>
Date:   Wed Sep 15 03:30:50 2021 +0900

    Fix document of the switch. (#89641)

commit a2cd16b
Author: Christopher Fujino <[email protected]>
Date:   Tue Sep 14 11:22:02 2021 -0700

    use test logger, which does not allow colors (#90010)

commit 0f0613c
Author: Varun Sharma <[email protected]>
Date:   Tue Sep 14 11:17:03 2021 -0700

    Add specific permissions to .github/workflows/lock.yaml (#89820)

commit 2866f79
Author: Jason Simmons <[email protected]>
Date:   Tue Sep 14 10:46:35 2021 -0700

    Initialize all bindings before starting the text_editing_action_target test suite (#90067)

    Fixes #90057

commit b889915
Author: Michael Thomsen <[email protected]>
Date:   Tue Sep 14 14:08:36 2021 +0200

    Change min Dart SDK constraint to track actual version (#88743)

commit 3b7adb9
Author: godofredoc <[email protected]>
Date:   Mon Sep 13 21:32:04 2021 -0700

    Lock only issues. (#90023)

commit 528f77d
Author: Dan Field <[email protected]>
Date:   Mon Sep 13 19:10:15 2021 -0700

    Opacity fix (#90017)

    * Make sure Opacity widgets/layers do not drop the offset

commit 2470f63
Author: engine-flutter-autoroll <[email protected]>
Date:   Mon Sep 13 22:07:02 2021 -0400

    4a98e23 [flutter_plugin_tools] Make no unit tests fatal for iOS/macOS (flutter/plugins#4341) (#90016)

commit a01e473
Author: stuartmorgan <[email protected]>
Date:   Mon Sep 13 20:57:05 2021 -0400

    Re-enable plugin analysis test (#89856)

commit cdad35f
Author: Aneesh Rao <[email protected]>
Date:   Tue Sep 14 05:17:04 2021 +0530

    Fix path in example (#84707)

commit 576aab0
Author: Christopher Fujino <[email protected]>
Date:   Mon Sep 13 15:47:03 2021 -0700

    add analysis_options.yaml to dev/conductor (#90005)

commit fad5e4c
Author: Jason Simmons <[email protected]>
Date:   Mon Sep 13 13:37:07 2021 -0700

    Remove a redundant test case in the flutter_tools create_test (#89872)

commit 738430c
Author: Darren Austin <[email protected]>
Date:   Mon Sep 13 13:33:48 2021 -0700

    Revert "Removed default page transitions for desktop and web platforms. (#82596)" (#89997)

    This reverts commit 43e3197

commit 9db9256
Author: Dan Field <[email protected]>
Date:   Mon Sep 13 13:15:19 2021 -0700

    Revert "Make sure Opacity widgets/layers do not drop the offset (#89264)" (#89999)

    This reverts commit 0d0f7a4.

commit 00f78cf
Author: keyonghan <[email protected]>
Date:   Mon Sep 13 13:04:01 2021 -0700

    renew cirrus key (#89988)

commit 826da7f
Author: engine-flutter-autoroll <[email protected]>
Date:   Mon Sep 13 15:52:03 2021 -0400

    cfc8a20 renew cirrus key (flutter/plugins#4340) (#89996)

commit cd112e5
Author: Anna Gringauze <[email protected]>
Date:   Mon Sep 13 12:13:42 2021 -0700

    Update all packages (#89797)
christopherfujino added a commit that referenced this pull request Sep 17, 2021
* Fix KeyboardManager's synthesization  (#88967)

This PR fixes KeyboardManager's key event synthesization logic, which were dispatching events with incorrect keys, making subsequent key events crash the app.

* Revert clamping scroll simulation changes (#89885)

* Revert "Removed default page transitions for desktop and web platforms. (#82596)" (#89997)

This reverts commit 43e3197

* 'Update Engine revision to b3af521a050e6ef076778bcaf16e27b2521df8f8 for stable release 2.5.1'

* Update dds 2.0.3 -> 2.0.4

* renew cirrus key (#89988)

Co-authored-by: Tong Mu <[email protected]>
Co-authored-by: Kate Lovett <[email protected]>
Co-authored-by: Darren Austin <[email protected]>
Co-authored-by: Christopher Fujino <[email protected]>
Co-authored-by: keyonghan <[email protected]>
tomasz-karczewski-red pushed a commit to tomasz-karczewski-red/flutter that referenced this pull request Sep 23, 2021
…r#90281)

* Fix KeyboardManager's synthesization  (flutter#88967)

This PR fixes KeyboardManager's key event synthesization logic, which were dispatching events with incorrect keys, making subsequent key events crash the app.

* Revert clamping scroll simulation changes (flutter#89885)

* Revert "Removed default page transitions for desktop and web platforms. (flutter#82596)" (flutter#89997)

This reverts commit 43e3197

* 'Update Engine revision to b3af521a050e6ef076778bcaf16e27b2521df8f8 for stable release 2.5.1'

* Update dds 2.0.3 -> 2.0.4

* renew cirrus key (flutter#89988)

Co-authored-by: Tong Mu <[email protected]>
Co-authored-by: Kate Lovett <[email protected]>
Co-authored-by: Darren Austin <[email protected]>
Co-authored-by: Christopher Fujino <[email protected]>
Co-authored-by: keyonghan <[email protected]>
abhishekprofcyma pushed a commit to abhishekprofcyma/flutter that referenced this pull request Dec 2, 2021
…r#90281)

* Fix KeyboardManager's synthesization  (flutter#88967)

This PR fixes KeyboardManager's key event synthesization logic, which were dispatching events with incorrect keys, making subsequent key events crash the app.

* Revert clamping scroll simulation changes (flutter#89885)

* Revert "Removed default page transitions for desktop and web platforms. (flutter#82596)" (flutter#89997)

This reverts commit 43e3197

* 'Update Engine revision to b3af521a050e6ef076778bcaf16e27b2521df8f8 for stable release 2.5.1'

* Update dds 2.0.3 -> 2.0.4

* renew cirrus key (flutter#89988)

Co-authored-by: Tong Mu <[email protected]>
Co-authored-by: Kate Lovett <[email protected]>
Co-authored-by: Darren Austin <[email protected]>
Co-authored-by: Christopher Fujino <[email protected]>
Co-authored-by: keyonghan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Change default material page transition for Web and Desktop

6 participants