Skip to content

Fix Material localizations after material_ui migration - #1161

Open
MangelSpec wants to merge 1 commit into
TomBursch:mainfrom
MangelSpec:codex/material-ui-localizations
Open

MangelSpec wants to merge 1 commit into
TomBursch:mainfrom
MangelSpec:codex/material-ui-localizations

Conversation

@MangelSpec

@MangelSpec MangelSpec commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

This was split out of #1153 following review so the background-fetch and localization fixes can be reviewed independently.

What was happening

After the material_ui migration, opening KitchenOwl with a non-English locale could show a red exception screen.

AppLocalizations.localizationsDelegates still contains the legacy delegates from flutter_localizations. Those do not provide the localization types expected by widgets from the decoupled material_ui package.

Emulator screenshot (German locale)

KitchenOwl showing No MaterialLocalizations found with a German locale

Exception and stack trace
No MaterialLocalizations found.
AppBar widgets require MaterialLocalizations to be provided by a
Localizations widget ancestor.

#0  debugCheckHasMaterialLocalizations
    (package:material_ui/src/debug.dart:97:7)
#1  debugCheckHasMaterialLocalizations
    (package:material_ui/src/debug.dart:117:4)
#2  _AppBarState.build
    (package:material_ui/src/app_bar.dart:946:12)
#3  StatefulElement.build
    (package:flutter/src/widgets/framework.dart:5944:27)
#4  ComponentElement.performRebuild
    (package:flutter/src/widgets/framework.dart:5830:15)
#5  StatefulElement.performRebuild
    (package:flutter/src/widgets/framework.dart:5995:11)

The runner also reported:

A MaterialLocalizations delegate that supports the de locale was not found.
A CupertinoLocalizations delegate that supports the de locale was not found.

What changed

  • Keep AppLocalizations.delegate for KitchenOwl's translated messages.
  • Register GlobalMaterialLocalizations.delegates from material_ui.
  • Keep the locale-name delegate.
  • Add a focused German localization regression test.

GlobalMaterialLocalizations.delegates includes the Material, Cupertino, and Widgets delegates required by the decoupled UI packages.

Verification

  • Reproduced the red exception screen on an emulator using de-DE.
  • Installed the fixed APK on the same emulator and confirmed the German login screen renders normally.
  • Confirmed the fresh Flutter log contains no localization warning or exception.
  • Focused regression test passes.
  • Scoped analysis reports no issues.
  • Debug APK builds with Flutter 3.47.5.

- Register the material_ui delegates alongside the generated app delegate.
- Cover German Material widgets with a focused regression test.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant