Skip to content

Hero broken while overriding pageTransitions in ThemeData #163989

@YukiAttano

Description

@YukiAttano

Steps to reproduce

overriding

ThemeData(
  pageTransitionsTheme: const PageTransitionsTheme(
      builders: {
        TargetPlatform.android: SomeTransitionsBuilder(),
      },
    ),
)

will break Hero animations for all platforms that are not explicitly listed in builders.

Expected results

As this behavior has changed from 3.27.x to 3.29, it should be mentioned in the docs.

Until 3.29, the behavior was to override the transitions that were mentioned in the map and regarding the documentation it says

// page_transitions_theme.dart

/// If a builder with a matching platform is not found, then the
/// [ZoomPageTransitionsBuilder] is used.

(but i am sure that omitting a value would preserve the default behavior instead of using ZoomPageTransitionsBuilder)

Actual results

Hero Animations break if transition is not explicitly added.

Code sample

Example Repo:
https://github.com/YukiAttano/herotest

Screenshots or Video

Screenshots / Video demonstration

3.27.4 (expected behavior)

Herotest_3.27.4_cut.mp4

3.29.0 (actual behavior)

herotest_3.29.0_cut.mp4

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.29.0, on macOS 15.0.1 24A348 darwin-arm64, locale de-DE) [265ms]
    • Flutter version 3.29.0 on channel stable at /Users/yukiattano/Library/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 35c388afb5 (2 weeks ago), 2025-02-10 12:48:41 -0800
    • Engine revision f73bfc4522
    • Dart version 3.7.0
    • DevTools version 2.42.2

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [934ms]
    • Android SDK at /Users/yukiattano/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.4+-12422083-b607.1)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2) [496ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.16.2

[✓] Android Studio (version 2024.2) [8ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.4+-12422083-b607.1)

[✓] Network resources [222ms]
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: animationAnimation APIsc: regressionIt was better in the past than it is nowf: material designflutter/packages/flutter/material repository.f: routesNavigator, Router, and related APIs.found in release: 3.29Found to occur in 3.29found in release: 3.30Found to occur in 3.30frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-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