Skip to content

Support customizable page transition durations #42802

Open

Description

@shihaohong

The latest Android 10 activity transition occurs over 400ms. Currently, MaterialPageRoute has a transition duration that is set to a constant of 300ms.

We should create a new parameter so that developers can modify/customize the transition duration if they'd like. This also allows Flutter's Android 10 transition to have the correct transition duration.

  • Add MaterialPageRoute.transitionDuration parameter
  • If possible, add a new PageTransitionsTheme.transitionDuration property that is correctly looked up by all page route classes so that it needs to only be specified in one place instead of wherever a new page route is defined.

Activity

  1. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    on Oct 15, 2019
  2. self-assigned this
    on Oct 15, 2019
  3. changed the title [-]Create `MaterialPageRoute.transitionDuration` parameter[/-] [+]Support customizable page transition durations[/+] on Oct 15, 2019
  4. shihaohong commented on Oct 25, 2019

    @shihaohong
    ContributorAuthor

    This is related to #29068

  5. shihaohong commented on Jan 14, 2020

    @shihaohong
    ContributorAuthor

    cc/ @HansMuller, this is the issue that I was struggling to find a solution for. The only way I could think of was to write some wrapper after making MaterialPageRoute's transitionDuration customizable like so:

    Future<T> openNewRoute(BuildContext context) {
      PageTransitionsTheme pageTransitionsTheme = PageTransitionsTheme.of(context);
      Navigator.of(context).push(
        MaterialPageRoute(
          // ... 
          transitionDuration: pageTransitionsTheme.transitionDuration,
        ),
      );
    }

    However, that seems clunky and will force our users to use a new method to create new routes for their apps if they want something that adheres to PageTransitionsTheme that is not already a default transitionDuration for MaterialPageRoute.

  6. removed their assignment
    on Jun 5, 2020
  7. removed their assignment
    on Jun 5, 2020
  8. added
    P2Important issues not at the top of the work list
    on May 16, 2021
  9. added
    packageflutter/packages repository. See also p: labels.
    and removed
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listp: cupertino_uicupertino_ui package in flutter/packagesp: material_uimaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions