Skip to content

[google_fonts] support material ui - #12489

Open
Segatti wants to merge 4 commits into
flutter:mainfrom
Segatti:main
Open

[google_fonts] support material ui#12489
Segatti wants to merge 4 commits into
flutter:mainfrom
Segatti:main

Conversation

@Segatti

@SegattiSegatti commented Aug 17, 2026

Copy link
Copy Markdown

Added Material UI support to Google Fonts.

List which issues are fixed by this PR. You must list at least one issue.
Fixesflutter/flutter#191067

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

@gemini-code-assistgemini-code-assistBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces standard Flutter SDK imports (package:flutter/material.dart and package:flutter/cupertino.dart) with external third-party packages (package:material_ui/material_ui.dart and package:cupertino_ui/cupertino_ui.dart) and adds them as dependencies in pubspec.yaml. The reviewer flags these changes as critical security and correctness issues, noting that replacing built-in Flutter SDK libraries with external packages introduces supply chain risks and breaks compatibility, and recommends reverting back to the standard Flutter SDK libraries.

Comment threadpackages/google_fonts/pubspec.yaml Outdated
Comment on lines +13 to +17
cupertino_ui: ^1.0.0
flutter:
sdk: flutter
http: ^1.0.0
material_ui: ^1.0.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-criticalcritical

Replacing the standard Flutter SDK dependencies with external third-party packages like cupertino_ui and material_ui is a critical security and correctness issue. Flutter's Material and Cupertino libraries are built directly into the Flutter SDK. Using external packages instead of the official SDK libraries introduces severe security risks (such as supply chain attacks or typosquatting) and breaks compatibility.

flutter:
sdk: flutterhttp: ^1.0.0

import'package:crypto/crypto.dart';
import'package:flutter/foundation.dart'show kIsWeb;
import'package:flutter/material.dart';
import'package:material_ui/material_ui.dart';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-criticalcritical

Do not import material_ui from an external package. Use the standard Flutter SDK Material library instead.

Suggested change
import'package:material_ui/material_ui.dart';
import'package:flutter/material.dart';

Comment on lines +5 to +6
import 'package:cupertino_ui/cupertino_ui.dart';
import 'package:material_ui/material_ui.dart';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-criticalcritical

Do not import cupertino_ui or material_ui from external packages. Use the standard Flutter SDK Cupertino and Material libraries instead.

Suggested change
import'package:cupertino_ui/cupertino_ui.dart';
import'package:material_ui/material_ui.dart';
import'package:flutter/cupertino.dart';
import'package:flutter/material.dart';

@github-actionsgithub-actionsBot added p: google_fonts triage-framework Should be looked at in framework triage labels Aug 17, 2026
@stuartmorgan-g

Copy link
Copy Markdown
Collaborator

Thanks for the contribution! You haven’t completed all of the items in the PR checklist above, so I’m assuming this is a work in progress and am marking it as a Draft. Please review the checklist, updating the PR as appropriate, and when that’s complete please feel free to mark the PR as ready for review.

@stuartmorgan-g
stuartmorgan-g marked this pull request as draft August 18, 2026 18:41
@Segatti
Segatti marked this pull request as ready for review August 18, 2026 22:34

@gemini-code-assistgemini-code-assistBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the standard Flutter SDK imports and dependencies (package:flutter/material.dart and package:flutter/cupertino.dart) with external packages (material_ui and cupertino_ui) across the google_fonts package and its examples. Feedback from the reviewer highlights that these changes introduce critical compatibility issues, as google_fonts must rely on the official Flutter SDK's material and cupertino libraries to ensure type safety and compatibility with standard Flutter applications.

Comment threadpackages/google_fonts/pubspec.yaml
path_provider: ^2.0.0

dev_dependencies:
cupertino_ui: ^1.0.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Adding cupertino_ui as a dependency and replacing the standard package:flutter/cupertino.dart imports is incorrect. The package must use the official Flutter SDK's Cupertino library to maintain compatibility and type safety with standard Flutter applications.

Comment threadpackages/google_fonts/lib/src/google_fonts_base.dart
@PiinksPiinks added the CICD Run CI/CD label Aug 19, 2026

@PiinksPiinks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Segatti thanks for putting this together. It looks like some checks are failing, can you take a look?

@flutter-dashboardflutter-dashboardBot removed the CICD Run CI/CD label Aug 19, 2026
@Segatti

Copy link
Copy Markdown
Author

Hi @Piinks , do you mean the conflict between the Google Fonts versions, or the errors in other libraries (Google Maps, for example) that I didn’t modify?

@PiinksPiinks added the CICD Run CI/CD label Aug 19, 2026
@Piinks

Copy link
Copy Markdown
Contributor

The dashboard checks here. They are in the middle of a fresh run right now.

@github-actionsgithub-actionsBot added triage-design Should be looked at in design triage and removed triage-framework Should be looked at in framework triage labels Aug 19, 2026
@Segatti

Copy link
Copy Markdown
Author

@Piinks Hi, why are the other checks still pending?

@Piinks

Copy link
Copy Markdown
Contributor

Because they are waiting for a security check before running. :)

@PiinksPiinks added the CICD Run CI/CD label Aug 20, 2026
@juampiq6

Copy link
Copy Markdown

Will this new code require for every user to migrate their apps to use and import material ui and cupertino ui?
We should mark this as BREAKING CHANGE and maybe a link to the dart migration tool?

@Piinks

Copy link
Copy Markdown
Contributor

@juampiq6 this is still under review. We have already advised that packages migrating to material_ui and/or cupertino_ui should consider it a breaking change.

Comment on lines +1 to +4
## 8.2.2

- Adds support for the `material_ui` package so `TextStyle` and `TextTheme` types are compatible with Material Design widgets that use `material_ui`.
- Updates minimum supported SDK version to Flutter 3.44/Dart 3.12.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 8.2.2
-Adds support for the `material_ui` package so `TextStyle` and `TextTheme` types are compatible with Material Design widgets that use `material_ui`.
- Updates minimum supported SDK version to Flutter 3.44/Dart 3.12.
## 9.0.0
-Migrates to the `material_ui` package, not backwards compatible with package:flutter/material.dart.
- Updates minimum supported SDK version to Flutter 3.44/Dart 3.12.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, instead of 9.0.0, let's mark this "Next". There is another PR out that introduces another breaking change. Rather than release 2 major versions, we'll aim to batch these changes together for one 9.0.0 release.
Let's make this "Next", and in pubspec.yaml, set publish_to: none.

repository: https://github.com/flutter/packages/tree/main/packages/google_fonts
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_fonts%22
version: 8.2.1
version: 8.2.2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update to 9.0.0

Comment on lines +1 to +4
## 8.2.2

- Adds support for the `material_ui` package so `TextStyle` and `TextTheme` types are compatible with Material Design widgets that use `material_ui`.
- Updates minimum supported SDK version to Flutter 3.44/Dart 3.12.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, instead of 9.0.0, let's mark this "Next". There is another PR out that introduces another breaking change. Rather than release 2 major versions, we'll aim to batch these changes together for one 9.0.0 release.
Let's make this "Next", and in pubspec.yaml, set publish_to: none.


import 'dart:ui' as ui;
import 'package:flutter/material.dart';
import 'package:material_ui/material_ui.dart';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you run the generator for this? Or was this import updated manually/by dart fix? See comment at the top of the file.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used this: dart fix --apply --code=migrate_design_widgets

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICDRun CI/CDp: google_fontstriage-designShould be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

material_ui TextTheme conflict after Flutter/package update - previously working [google_fonts]

4 participants

@Segatti@stuartmorgan-g@Piinks@juampiq6