mirror of
https://github.com/git-touch/git-touch
synced 2025-02-08 07:38:45 +01:00
fix: text height behavior
This commit is contained in:
parent
56402d789c
commit
e2de7feec2
64
lib/app.dart
64
lib/app.dart
@ -15,39 +15,6 @@ class MyApp extends StatelessWidget {
|
|||||||
final auth = Provider.of<AuthModel>(context);
|
final auth = Provider.of<AuthModel>(context);
|
||||||
final theme = Provider.of<ThemeModel>(context);
|
final theme = Provider.of<ThemeModel>(context);
|
||||||
|
|
||||||
// ignore: prefer_function_declarations_over_variables
|
|
||||||
final LocaleListResolutionCallback localeListResolutionCallback =
|
|
||||||
(locales, supportedLocales) {
|
|
||||||
// 1. user set locale
|
|
||||||
// 2. system locale
|
|
||||||
try {
|
|
||||||
if (theme.locale != null) {
|
|
||||||
final intlLocale = l.Locale.parse(theme.locale!);
|
|
||||||
locales = [
|
|
||||||
Locale.fromSubtags(
|
|
||||||
languageCode: intlLocale.languageCode,
|
|
||||||
countryCode: intlLocale.countryCode,
|
|
||||||
scriptCode: intlLocale.scriptCode,
|
|
||||||
),
|
|
||||||
...locales!
|
|
||||||
];
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
print(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final locale in locales!) {
|
|
||||||
// this is necessary because Flutter only handles zh_Hans -> zh
|
|
||||||
// and would not handle non-exist language code
|
|
||||||
if (AppLocalizations.delegate.isSupported(locale)) {
|
|
||||||
return locale;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. if none match, use the default
|
|
||||||
return supportedLocales.firstWhere((l) => l.languageCode == 'en');
|
|
||||||
};
|
|
||||||
|
|
||||||
return AntTheme(
|
return AntTheme(
|
||||||
key: auth.rootKey,
|
key: auth.rootKey,
|
||||||
data: AntThemeData(brightness: theme.brightness),
|
data: AntThemeData(brightness: theme.brightness),
|
||||||
@ -72,7 +39,36 @@ class MyApp extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||||
supportedLocales: AppLocalizations.supportedLocales,
|
supportedLocales: AppLocalizations.supportedLocales,
|
||||||
localeListResolutionCallback: localeListResolutionCallback,
|
localeListResolutionCallback: (locales, supportedLocales) {
|
||||||
|
// 1. user set locale
|
||||||
|
// 2. system locale
|
||||||
|
try {
|
||||||
|
if (theme.locale != null) {
|
||||||
|
final intlLocale = l.Locale.parse(theme.locale!);
|
||||||
|
locales = [
|
||||||
|
Locale.fromSubtags(
|
||||||
|
languageCode: intlLocale.languageCode,
|
||||||
|
countryCode: intlLocale.countryCode,
|
||||||
|
scriptCode: intlLocale.scriptCode,
|
||||||
|
),
|
||||||
|
...locales!
|
||||||
|
];
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
print(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (final locale in locales!) {
|
||||||
|
// this is necessary because Flutter only handles zh_Hans -> zh
|
||||||
|
// and would not handle non-exist language code
|
||||||
|
if (AppLocalizations.delegate.isSupported(locale)) {
|
||||||
|
return locale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. if none match, use the default
|
||||||
|
return supportedLocales.firstWhere((l) => l.languageCode == 'en');
|
||||||
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user