phase3: generated l10n/messages_all, events, actions, dialog null-safe

This commit is contained in:
2026-07-24 20:30:00 +08:00
parent 1f85ae1e63
commit e2f0d37edd
4 changed files with 6 additions and 6 deletions

View File

@@ -87,7 +87,7 @@ class OnProductWillAddToCart {
double price; double price;
String description; String description;
Business business; Business business;
GlobalKey buttonKey; GlobalKey? buttonKey;
OnProductWillAddToCart(this.product, this.selections, this.price, this.description, this.business, {this.buttonKey}); OnProductWillAddToCart(this.product, this.selections, this.price, this.description, this.business, {this.buttonKey});
} }

View File

@@ -24,7 +24,7 @@ Map<String, LibraryLoader> _deferredLibraries = {
'zh_CN': () => new Future.value(null), 'zh_CN': () => new Future.value(null),
}; };
MessageLookupByLibrary _findExact(String localeName) { MessageLookupByLibrary? _findExact(String localeName) {
switch (localeName) { switch (localeName) {
case 'en': case 'en':
return messages_en.messages; return messages_en.messages;
@@ -59,7 +59,7 @@ bool _messagesExistFor(String locale) {
} }
} }
MessageLookupByLibrary _findGeneratedMessagesFor(String locale) { MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) {
var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor, var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor,
onFailure: (_) => null); onFailure: (_) => null);
if (actualLocale == null) return null; if (actualLocale == null) return null;

View File

@@ -15,7 +15,7 @@ import 'intl/messages_all.dart';
class S { class S {
S(); S();
static S current; static S current = S();
static const AppLocalizationDelegate delegate = static const AppLocalizationDelegate delegate =
AppLocalizationDelegate(); AppLocalizationDelegate();
@@ -32,7 +32,7 @@ class S {
} }
static S of(BuildContext context) { static S of(BuildContext context) {
return Localizations.of<S>(context, S); return Localizations.of<S>(context, S) ?? S.current;
} }
/// `About` /// `About`

View File

@@ -15,7 +15,7 @@ class UpdateLocale {
} }
class UpdateCurrentUser { class UpdateCurrentUser {
final User user; final User? user;
UpdateCurrentUser(this.user); UpdateCurrentUser(this.user);
} }