mirror of
https://github.com/wgh136/pixes.git
synced 2025-09-27 04:57:23 +00:00
Add font fallback for Linux and Windows platforms
This commit is contained in:
@@ -134,12 +134,29 @@ class MyApp extends StatelessWidget {
|
|||||||
throw "widget is null";
|
throw "widget is null";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String? font;
|
||||||
|
List<String>? fallback;
|
||||||
|
if (App.isLinux || App.isWindows) {
|
||||||
|
font = 'Noto Sans CJK';
|
||||||
|
fallback = [
|
||||||
|
'Segoe UI',
|
||||||
|
'Noto Sans SC',
|
||||||
|
'Noto Sans TC',
|
||||||
|
'Noto Sans',
|
||||||
|
'Microsoft YaHei',
|
||||||
|
'PingFang SC',
|
||||||
|
'Arial',
|
||||||
|
'sans-serif'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
Widget widget = MdTheme(
|
Widget widget = MdTheme(
|
||||||
data: MdThemeData.from(
|
data: MdThemeData.from(
|
||||||
colorScheme: colorScheme, useMaterial3: true),
|
colorScheme: colorScheme, useMaterial3: true),
|
||||||
child: DefaultTextStyle.merge(
|
child: DefaultTextStyle.merge(
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontFamily: App.isWindows ? "Microsoft YaHei UI" : null,
|
fontFamily: font,
|
||||||
|
fontFamilyFallback: fallback,
|
||||||
),
|
),
|
||||||
child: OverlayWidget(child),
|
child: OverlayWidget(child),
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user