migrate: flutter 3.32

This commit is contained in:
lollipopkit🏳️‍⚧️
2025-05-25 17:05:46 +08:00
parent 7e16d2f159
commit 9547d92ac5
25 changed files with 1380 additions and 825 deletions

View File

@@ -72,7 +72,8 @@ import 'l10n_zh.dart';
/// be consistent with the languages listed in the AppLocalizations.supportedLocales
/// property.
abstract class AppLocalizations {
AppLocalizations(String locale) : localeName = intl.Intl.canonicalizedLocale(locale.toString());
AppLocalizations(String locale)
: localeName = intl.Intl.canonicalizedLocale(locale.toString());
final String localeName;
@@ -80,7 +81,8 @@ abstract class AppLocalizations {
return Localizations.of<AppLocalizations>(context, AppLocalizations);
}
static const LocalizationsDelegate<AppLocalizations> delegate = _AppLocalizationsDelegate();
static const LocalizationsDelegate<AppLocalizations> delegate =
_AppLocalizationsDelegate();
/// A list of this localizations delegate along with the default localizations
/// delegates.
@@ -92,7 +94,8 @@ abstract class AppLocalizations {
/// Additional delegates can be added by appending to this list in
/// MaterialApp. This list does not have to be used at all if a custom list
/// of delegates is preferred or required.
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates = <LocalizationsDelegate<dynamic>>[
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates =
<LocalizationsDelegate<dynamic>>[
delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
@@ -366,7 +369,8 @@ abstract class AppLocalizations {
///
/// In en, this message translates to:
/// **'{runningCount} running, {stoppedCount} container stopped.'**
String dockerStatusRunningAndStoppedFmt(Object runningCount, Object stoppedCount);
String dockerStatusRunningAndStoppedFmt(
Object runningCount, Object stoppedCount);
/// No description provided for @dockerStatusRunningFmt.
///
@@ -1473,7 +1477,8 @@ abstract class AppLocalizations {
String get writeScriptTip;
}
class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
class _AppLocalizationsDelegate
extends LocalizationsDelegate<AppLocalizations> {
const _AppLocalizationsDelegate();
@override
@@ -1482,44 +1487,69 @@ class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations>
}
@override
bool isSupported(Locale locale) => <String>['de', 'en', 'es', 'fr', 'id', 'ja', 'nl', 'pt', 'ru', 'tr', 'uk', 'zh'].contains(locale.languageCode);
bool isSupported(Locale locale) => <String>[
'de',
'en',
'es',
'fr',
'id',
'ja',
'nl',
'pt',
'ru',
'tr',
'uk',
'zh'
].contains(locale.languageCode);
@override
bool shouldReload(_AppLocalizationsDelegate old) => false;
}
AppLocalizations lookupAppLocalizations(Locale locale) {
// Lookup logic when language+country codes are specified.
switch (locale.languageCode) {
case 'zh': {
switch (locale.countryCode) {
case 'TW': return AppLocalizationsZhTw();
}
break;
}
case 'zh':
{
switch (locale.countryCode) {
case 'TW':
return AppLocalizationsZhTw();
}
break;
}
}
// Lookup logic when only language code is specified.
switch (locale.languageCode) {
case 'de': return AppLocalizationsDe();
case 'en': return AppLocalizationsEn();
case 'es': return AppLocalizationsEs();
case 'fr': return AppLocalizationsFr();
case 'id': return AppLocalizationsId();
case 'ja': return AppLocalizationsJa();
case 'nl': return AppLocalizationsNl();
case 'pt': return AppLocalizationsPt();
case 'ru': return AppLocalizationsRu();
case 'tr': return AppLocalizationsTr();
case 'uk': return AppLocalizationsUk();
case 'zh': return AppLocalizationsZh();
case 'de':
return AppLocalizationsDe();
case 'en':
return AppLocalizationsEn();
case 'es':
return AppLocalizationsEs();
case 'fr':
return AppLocalizationsFr();
case 'id':
return AppLocalizationsId();
case 'ja':
return AppLocalizationsJa();
case 'nl':
return AppLocalizationsNl();
case 'pt':
return AppLocalizationsPt();
case 'ru':
return AppLocalizationsRu();
case 'tr':
return AppLocalizationsTr();
case 'uk':
return AppLocalizationsUk();
case 'zh':
return AppLocalizationsZh();
}
throw FlutterError(
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
'an issue with the localizations generation tool. Please file an issue '
'on GitHub with a reproducible sample app and the gen-l10n configuration '
'that was used.'
);
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
'an issue with the localizations generation tool. Please file an issue '
'on GitHub with a reproducible sample app and the gen-l10n configuration '
'that was used.');
}