Skip to content

Setting ThemeData.cupertinoOverrideTheme breaks themes equality and causes multiple rebuilds #165455

@FeodorFitsner

Description

@FeodorFitsner

Steps to reproduce

  1. Create a new MaterialApp with theme set to ThemeData(cupertinoOverrideTheme: CupertinoThemeData()).
  2. When the widget with MaterialApp is built it causes dozens of unwanted rebuilds of child widgets, as it's "lerping" between two ThemeData instances which are supposed to be equal.

Similar issue: #89127 (comment)

Expected results

Both instances of ThemeData(cupertinoOverrideTheme: CupertinoThemeData()) are equal.

Actual results

ThemeData instances are not equal.

Code sample

Code sample
var td1 = ThemeData(cupertinoOverrideTheme: CupertinoThemeData());
var td2 = ThemeData(cupertinoOverrideTheme: CupertinoThemeData());
print(td1 == td2); // false

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.29.2, on macOS 15.3.1 24D70
    darwin-arm64, locale en-CA) [348ms]
    • Flutter version 3.29.2 on channel stable at
      /Users/feodor/fvm/versions/3.29.2
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision c236373904 (5 days ago), 2025-03-13
      16:17:06 -0400
    • Engine revision 18b71d647a
    • Dart version 3.7.2
    • DevTools version 2.42.3

[✓] Android toolchain - develop for Android devices (Android SDK
    version 34.0.0) [1,205ms]
    • Android SDK at /Users/feodor/Library/Android/sdk
    • Platform android-35, build-tools 34.0.0
    • Java binary at:
      /Users/feodor/Library/Java/JavaVirtualMachines/jdk-17.0.2+8/C
      ontents/Home/bin/java
      This JDK is specified in your Flutter configuration.
      To change the current JDK, run: `flutter config
      --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment Temurin-17.0.2+8
      (build 17.0.2+8)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 16.2) [886ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    ! CocoaPods 1.14.3 out of date (1.16.2 is recommended).
        CocoaPods is a package manager for iOS or macOS platform
        code.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/to/platform-plugins
      To update CocoaPods, see
      https://guides.cocoapods.org/using/getting-started.html#updat
      ing-cocoapods

[✓] Chrome - develop for the web [11ms]
    • CHROME_EXECUTABLE = /Applications/Microsoft
      Edge.app/Contents/MacOS/Microsoft Edge

[✓] Android Studio (version 2022.2) [11ms]
    • 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
      17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.98.0) [10ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.106.0

[✓] Connected device (5 available) [6.1s]
    • Feodor’s iPhone 14 Pro (wireless) (mobile) •
      00008120-001134213493C01E            • ios            • iOS
      18.3.1 22D72
    • iPhone 16 (mobile)                         •
      BF108663-0E31-45CF-8950-67ABC46C5D1A • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-18-2 (simulator)
    • macOS (desktop)                            • macos
      • darwin-arm64   • macOS 15.3.1 24D70 darwin-arm64
    • Mac Designed for iPad (desktop)            •
      mac-designed-for-ipad                • darwin         • macOS
      15.3.1 24D70 darwin-arm64
    • Chrome (web)                               • chrome
      • web-javascript • Microsoft Edge 128.0.2739.63

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

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listf: cupertinoflutter/packages/flutter/cupertino repositoryfound in release: 3.29Found to occur in 3.29found in release: 3.31Found to occur in 3.31frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-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