mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: inconsistent font weight in Chinese #1488
This commit is contained in:
parent
c127fd28b8
commit
086195d2cf
@ -82,7 +82,7 @@ class ApplicationWidget extends StatelessWidget {
|
|||||||
builder: (context, state) => MaterialApp(
|
builder: (context, state) => MaterialApp(
|
||||||
builder: overlayManagerBuilder(),
|
builder: overlayManagerBuilder(),
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
theme: state.theme.themeData,
|
theme: state.theme.getThemeData(state.locale),
|
||||||
localizationsDelegates: context.localizationDelegates +
|
localizationsDelegates: context.localizationDelegates +
|
||||||
[AppFlowyEditorLocalizations.delegate],
|
[AppFlowyEditorLocalizations.delegate],
|
||||||
supportedLocales: context.supportedLocales,
|
supportedLocales: context.supportedLocales,
|
||||||
|
@ -155,13 +155,26 @@ class AppTheme {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ThemeData get themeData {
|
ThemeData getThemeData(Locale locale) {
|
||||||
final textTheme = TextStyles(font: font, color: shader1);
|
// 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(
|
return ThemeData(
|
||||||
brightness: brightness,
|
brightness: brightness,
|
||||||
textTheme: textTheme.generateTextTheme(),
|
textTheme: textTheme.generateTextTheme(),
|
||||||
textSelectionTheme: TextSelectionThemeData(
|
textSelectionTheme: TextSelectionThemeData(
|
||||||
cursorColor: main2, selectionHandleColor: main2),
|
cursorColor: main2,
|
||||||
|
selectionHandleColor: main2,
|
||||||
|
),
|
||||||
primaryIconTheme: IconThemeData(color: hover),
|
primaryIconTheme: IconThemeData(color: hover),
|
||||||
iconTheme: IconThemeData(color: shader1),
|
iconTheme: IconThemeData(color: shader1),
|
||||||
scrollbarTheme: ScrollbarThemeData(
|
scrollbarTheme: ScrollbarThemeData(
|
||||||
|
Loading…
Reference in New Issue
Block a user