Repository navigation
Conversation
Use `...GlobalMaterialLocalizations.delegates` in `AppLocalizations.localizationsDelegates` instead of referencing individual `.delegate` getters on each global localization class. This ensures compatibility with both `flutter_localizations` and standalone UI packages (such as `material_ui` and `cupertino_ui`). Fixes flutter#191072
There was a problem hiding this comment.
Code Review
This pull request introduces support for standalone UI packages (material_ui and cupertino_ui) in localizations generation by reading the project's pubspec.yaml dependencies and dynamically adjusting the imported packages and default localization delegates. Feedback on these changes highlights a compilation error due to an undefined logger variable (which should be _logger) and recommends caching the parsed dependencies to avoid inefficient, repetitive I/O operations.
| final FlutterManifest? flutterManifest = FlutterManifest.createFromPath( | ||
| projectDirectory.childFile('pubspec.yaml').path, | ||
| fileSystem: _fs, | ||
| logger: logger, | ||
| ); |
There was a problem hiding this comment.
The field for the logger in LocalizationsGenerator is _logger (with a leading underscore). Using logger here will result in a compilation error because logger is not defined in this scope.
| final FlutterManifest? flutterManifest = FlutterManifest.createFromPath( | |
| projectDirectory.childFile('pubspec.yaml').path, | |
| fileSystem: _fs, | |
| logger: logger, | |
| ); | |
| final FlutterManifest? flutterManifest = FlutterManifest.createFromPath( | |
| projectDirectory.childFile('pubspec.yaml').path, | |
| fileSystem: _fs, | |
| logger: _logger, | |
| ); |
| final FlutterManifest? flutterManifest = FlutterManifest.createFromPath( | ||
| projectDirectory.childFile('pubspec.yaml').path, | ||
| fileSystem: _fs, | ||
| logger: logger, | ||
| ); |
There was a problem hiding this comment.
|
This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Updates LocalizationsGenerator and gen-l10n templates to support applications migrated to standalone UI packages (package:material_ui and package:cupertino_ui). Inspects pubspec.yaml dependencies to emit the matching package import alongside GlobalMaterialLocalizations.delegates or GlobalCupertinoLocalizations.delegates in the generated localizations file.
Fixes #191072