Merge pull request #1510 from LucasXu0/fix_1488

fix: [Bug] Inconsistent font weights #1488
This commit is contained in:
Nathan.fooo 2022-11-30 20:31:39 +08:00 committed by GitHub
commit fff4af53e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 4 deletions

View File

@ -82,7 +82,7 @@ class ApplicationWidget extends StatelessWidget {
builder: (context, state) => MaterialApp(
builder: overlayManagerBuilder(),
debugShowCheckedModeBanner: false,
theme: state.theme.themeData,
theme: state.theme.getThemeData(state.locale),
localizationsDelegates: context.localizationDelegates +
[AppFlowyEditorLocalizations.delegate],
supportedLocales: context.supportedLocales,

View File

@ -155,13 +155,26 @@ class AppTheme {
}
}
ThemeData get themeData {
final textTheme = TextStyles(font: font, color: shader1);
ThemeData getThemeData(Locale locale) {
// Poppins and SF Mono are not well supported in some languages, so use the
// built-in font for the following languages.
final useBuiltInFontLanguages = [
const Locale('zh', 'CN'),
const Locale('zh', 'TW'),
];
TextStyles textTheme;
if (useBuiltInFontLanguages.contains(locale)) {
textTheme = TextStyles(font: '', color: shader1);
} else {
textTheme = TextStyles(font: font, color: shader1);
}
return ThemeData(
brightness: brightness,
textTheme: textTheme.generateTextTheme(),
textSelectionTheme: TextSelectionThemeData(
cursorColor: main2, selectionHandleColor: main2),
cursorColor: main2,
selectionHandleColor: main2,
),
primaryIconTheme: IconThemeData(color: hover),
iconTheme: IconThemeData(color: shader1),
scrollbarTheme: ScrollbarThemeData(