Repository navigation
Conversation
pento
force-pushed
the
material-ui-migration
branch
from
September 27, 2026 11:01
9416b88 to
c457514
Compare
Author
|
@berkaycatak: I've updated this PR to be based on the 1.0.1 release. Happy to adjust things if this is something you're interested in merging. |
Flutter 3.47 decoupled the Material and Cupertino design systems from the SDK into the standalone material_ui and cupertino_ui packages. The SDK's bundled copies are scheduled for deprecation, so this migrates the package onto the standalone ones. Because material_ui and cupertino_ui are source forks of the SDK design libraries, their ThemeData, ThemeMode, CupertinoThemeData and InputDecoration are distinct Dart types from the identically-named SDK ones. A package typed against the SDK types cannot be consumed by an app that has migrated, and vice versa, so this is a breaking change for consumers. - Rewrite every package:flutter/material.dart and package:flutter/cupertino.dart import in lib/, test/ and example/lib/ to the standalone packages, including the 1.0 toolbar-host and iPhone Duo files. - Add material_ui ^1.0.0 and cupertino_ui ^1.0.0 as dependencies. - Raise the floor to Flutter >=3.47.0 and Dart ^3.12.0. - Drop flutter_localizations from the example in favour of GlobalMaterialLocalizations.delegates, which material_ui ships and which already bundles the material, cupertino and widgets delegates. - Bump CI and release workflows from Flutter 3.35.6 to 3.47.0. - Consolidate the README Requirements section with upstream's, add a material_ui/cupertino_ui migration note, and update CLAUDE.md's CI version and import convention. Raising the Flutter floor also raises the example's Android toolchain floor. The example now matches what flutter create generates on 3.47 - Gradle 9.3.1, Android Gradle Plugin 9.1.0 and Kotlin 2.4.0 - rather than the older minimums Flutter still nominally accepts. Those minimums build on CI but fail against the JDK current Android Studio ships, which needs Gradle 9.1.0 or newer, so the example would not build for most developers. The android.newDsl and android.builtInKotlin opt-outs the Flutter migrator adds are what let AGP 9 work without a DSL rewrite. The package version and CHANGELOG are deliberately left untouched, since releases are the maintainer's call. No native (Swift/Kotlin) source changes are required. flutter analyze --fatal-infos and flutter test are clean in both the package root and the example. BREAKING CHANGE: this package is now typed against material_ui and cupertino_ui rather than the SDK's bundled design libraries. Because those are source forks, their ThemeData, ThemeMode, CupertinoThemeData and InputDecoration are distinct Dart types from the SDK ones, so consumers must migrate their own imports in the same step. The minimum Flutter version is now 3.47.0.
pento
force-pushed
the
material-ui-migration
branch
from
October 11, 2026 20:42
c457514 to
558c214
Compare
Author
|
@berkaycatak: I've updated this PR to reflect |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Flutter 3.47 decoupled the Material and Cupertino design systems from the SDK into the standalone
material_uiandcupertino_uipackages. The SDK's bundled copies are frozen and scheduled for formal deprecation in the November stable release. This migrates the package onto the standalone packages.material_uiandcupertino_uiare full source forks of the SDK design libraries, so theirThemeData,ThemeMode,CupertinoThemeDataandInputDecorationare distinct Dart types from the identically-named SDK ones, despite being structurally identical. An app that's migrated can't use a package still typed against the SDK types, passing a modernThemeDatatoAdaptiveApp.materialLightThemefails withThe argument type 'ThemeData' can't be assigned to the parameter type 'ThemeData?'.Type of Change
Related Issues
Overlaps with #146.
Changes Made
package:flutter/material.dartandpackage:flutter/cupertino.dartimport inlib/,test/andexample/lib/to the standalone packages, including the 1.0 toolbar-host and iPhone Duo files. Only import lines change in those directories, apart from the example's localization setup below.material_ui: ^1.0.0andcupertino_ui: ^1.0.0topubspec.yamlandexample/pubspec.yaml, alongside 1.0'sfoldabledependency.>=3.47.0and Dart^3.12.0.GlobalMaterialLocalizations.delegatesand dropped itsflutter_localizationsdependency.material_uiships that constant and it already bundles the material, cupertino and widgets delegates — this is the patternmaterial_ui's README recommends.flutter creategenerates on 3.47 (Gradle 8.12→9.3.1, AGP 8.9.1→9.1.0, Kotlin 2.1.0→2.4.0, Java 11→17) and migratedapp/build.gradle.ktsoff thekotlinOptionsblock to thekotlin { compilerOptions { … } }DSL that AGP 9 requires.>=3.47.0, Dart^3.12.0, iOS 15.0), added a "Migrating to material_ui / cupertino_ui" guide next to "Migrating to 1.0.0", and updatedCLAUDE.md's CI version and import convention.No native code changes — nothing under
ios/orandroid/needed touching.Testing
Automated Tests
flutter test)flutter analyze --fatal-infos, package root and example).dart format) — the lines this PR adds are formatted, but I didn't rundart formatover the files it touches.Manual Testing
Checklist
Breaking Changes
Consumers must migrate to the standalone design-system packages in the same step. There is no mixed mode: any file that constructs a value passed to this package's API must import from
material_ui/cupertino_uirather than the SDK.Migration guide for consumers:
Add the packages and raise the Flutter floor:
Replace imports throughout the app:
If the app depends on other packages that still build legacy Material widgets internally, wrap the app's content in
MaterialUiCompatibilityBridge/CupertinoUiCompatibilityBridge.AdaptiveApp.builderis a natural place:Additional Notes
Releasing this. Flutter's guidance for package authors is to "treat this migration as a major version bump". Releasing it as the next major lets apps still on Flutter < 3.47 stay on 1.x. When you release it, the README's install snippet should name that major; I've left
version,CHANGELOG.mdand the install snippet alone, since releases are your call. Other packages have already done the same: go_router 18, animations 3, dynamic_color 2 and flex_color_scheme 9 each shipped the migration as a new major. The SDK copies have been frozen since April 2026, and their formal deprecation (flutter/flutter#192957) is targeted at the November stable.The Flutter 3.35
TickerMode.ofshim inadaptive_scaffold.dartis untouched. I left it exactly as it is so this PR stays mechanical. It can be dropped once the floor is 3.47.#146 covers the same ground. I'm happy to consolidate the two PRs in whichever direction suits you.
The example's Android toolchain changes could be split out if you'd prefer that. They're the largest non-mechanical part of this PR, and they can be upgraded prior to the design-system migration: let me know if you'd prefer them in a separate PR.
Raising the Flutter floor also raises the example's Android floor. Flutter 3.47's stated minimum is Gradle 8.14, and the example does build at that version, but Flutter warns that it "will soon be dropped, please upgrade to at least 9.1.0", and on a newer JDK, the build fails outright.
Rather than track a minimum that's already deprecation-warned, the example now matches what
flutter creategenerates on 3.47: Gradle 9.3.1, AGP 9.1.0, Kotlin 2.4.0, Java 17. AGP 9 additionally rejects thekotlinOptionsblock, soapp/build.gradle.ktsmoves to thekotlin { compilerOptions { … } }DSL. Theandroid.newDslandandroid.builtInKotlinopt-outs that Flutter's migrator adds are what let AGP 9 work without a wider DSL rewrite.If you'd rather stay closer to the current setup, Gradle 8.14 with AGP 8.11.1 and Kotlin 2.2.20 is the smaller change that satisfies Flutter 3.47 and keeps the existing
kotlinOptionsDSL.Demo Code
The localization setup is the one public-facing usage change, since
material_uisupplies the delegates that previously came fromflutter_localizations: