fix: text height behavior

This commit is contained in:
Rongjian Zhang 2022-10-09 02:19:28 +08:00
parent 56402d789c
commit e2de7feec2
1 changed files with 30 additions and 34 deletions

View File

@ -15,9 +15,31 @@ class MyApp extends StatelessWidget {
final auth = Provider.of<AuthModel>(context);
final theme = Provider.of<ThemeModel>(context);
// ignore: prefer_function_declarations_over_variables
final LocaleListResolutionCallback localeListResolutionCallback =
(locales, supportedLocales) {
return AntTheme(
key: auth.rootKey,
data: AntThemeData(brightness: theme.brightness),
child: Builder(
builder: (context) {
final antTheme = AntTheme.of(context);
return CupertinoApp.router(
routeInformationProvider: router.routeInformationProvider,
routeInformationParser: router.routeInformationParser,
routerDelegate: router.routerDelegate,
theme: CupertinoThemeData(
brightness: theme.brightness,
primaryColor: antTheme.colorPrimary,
scaffoldBackgroundColor: antTheme.colorBox,
textTheme: CupertinoTextThemeData(
textStyle: TextStyle(
fontSize: antTheme.fontSizeMain,
color: antTheme.colorText,
),
),
),
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
localeListResolutionCallback: (locales, supportedLocales) {
// 1. user set locale
// 2. system locale
try {
@ -46,33 +68,7 @@ class MyApp extends StatelessWidget {
// 3. if none match, use the default
return supportedLocales.firstWhere((l) => l.languageCode == 'en');
};
return AntTheme(
key: auth.rootKey,
data: AntThemeData(brightness: theme.brightness),
child: Builder(
builder: (context) {
final antTheme = AntTheme.of(context);
return CupertinoApp.router(
routeInformationProvider: router.routeInformationProvider,
routeInformationParser: router.routeInformationParser,
routerDelegate: router.routerDelegate,
theme: CupertinoThemeData(
brightness: theme.brightness,
primaryColor: antTheme.colorPrimary,
scaffoldBackgroundColor: antTheme.colorBox,
textTheme: CupertinoTextThemeData(
textStyle: TextStyle(
fontSize: antTheme.fontSizeMain,
color: antTheme.colorText,
),
),
),
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
localeListResolutionCallback: localeListResolutionCallback,
},
);
},
),