feat!: migrate to the decoupled material_ui package - #135
Merged
Merged
Conversation
Material and Cupertino ship as standalone packages from Flutter 3.47. Applied `dart fix --apply --code=migrate_design_widgets` and raised the SDK floor to the minimum material_ui requires (Dart 3.13, Flutter 3.47). badge_gradient_type.dart imported package:flutter/cupertino.dart only so its doc-comment gradient references resolve, so it moves to package:flutter/widgets.dart rather than pulling in cupertino_ui. Also replaces SizeTransition.axisAlignment, deprecated after v3.41, with alignment, using the mapping the SDK documents. The public BadgeAnimation.sizeTransitionAxisAlignment double is unchanged.
- Run `dart format .`: raising the SDK floor to 3.13 switches the formatter to the tall style, so CI's format check failed on 16 files. - example/pubspec.yaml: require Dart 3.13 / Flutter 3.47, which material_ui needs. - CHANGELOG: describe what actually changes for apps on material_ui vs package:flutter/material.dart. - README: keep the flutter/material.dart `hide Badge` import for apps that haven't migrated yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The example's SDK floor is now 3.13 too, so its files use the tall style. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
Thanks a lot for this, and for the careful write-up! The We tested it on iOS and Android, and the example looks pixel-identical to before. I pushed two small commits to your branch before merging:
This ships in 4.0.0, together with a batch of bug fixes. Thanks again! 🙏 |
Collaborator
|
4.0.0 with your migration is now live on pub.dev: https://pub.dev/packages/badges/versions/4.0.0 🎉 Release notes: https://github.com/yako-dev/flutter_badges/releases/tag/v4.0.0 |
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.
Material and Cupertino moved out of the SDK into their own packages in Flutter 3.47. Right now apps that have migrated can't really use badges, because Dart treats
ThemeDatafrompackage:flutter/material.dartand frompackage:material_uias different types, so you can't pass your theme or colors into this package.What I did:
dart fix --apply --code=migrate_design_widgets, the official migration (31 files, imports only)material_ui: ^1.4.0and bumped to 4.0.0, since the Flutter team asks packages to treat this as a major releaseBadgeimportTwo things I changed by hand:
dart fixalso wanted to addcupertino_ui. The only file importing cupertino wasbadge_gradient_type.dart, which is just an enum. The import is only there so theLinearGradient,RadialGradientandSweepGradientreferences in its doc comments resolve, and those come frompainting. So I switched that file topackage:flutter/widgets.dartand leftcupertino_uiout. No new dependency apart from material_ui.I also replaced
SizeTransition.axisAlignmentwithalignment. The old one has been deprecated since v3.41 and was showing up in analyze. I used the mapping from the SDK docs.BadgeAnimation.sizeTransitionAxisAlignmentstill takes a double, so nothing changes for users.Tests: 175/175 pass, same as before the migration.
flutter analyzeis clean now, it had one deprecation warning before.