mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
fix windows font
This commit is contained in:
@@ -132,6 +132,38 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ThemeData getTheme(
|
||||||
|
Color primary,
|
||||||
|
Color? secondary,
|
||||||
|
Color? tertiary,
|
||||||
|
Brightness brightness,
|
||||||
|
) {
|
||||||
|
String? font;
|
||||||
|
List<String>? fallback;
|
||||||
|
if (App.isWindows) {
|
||||||
|
font = 'Segoe UI';
|
||||||
|
fallback = [
|
||||||
|
'Segoe UI',
|
||||||
|
'Microsoft YaHei',
|
||||||
|
'PingFang SC',
|
||||||
|
'Noto Sans CJK',
|
||||||
|
'Arial',
|
||||||
|
'sans-serif'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return ThemeData(
|
||||||
|
colorScheme: SeedColorScheme.fromSeeds(
|
||||||
|
primaryKey: primary,
|
||||||
|
secondaryKey: secondary,
|
||||||
|
tertiaryKey: tertiary,
|
||||||
|
brightness: brightness,
|
||||||
|
tones: FlexTones.vividBackground(brightness),
|
||||||
|
),
|
||||||
|
fontFamily: font,
|
||||||
|
fontFamilyFallback: fallback,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Widget home;
|
Widget home;
|
||||||
@@ -158,24 +190,9 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
|||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
home: home,
|
home: home,
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
theme: ThemeData(
|
theme: getTheme(primary, secondary, tertiary, Brightness.light),
|
||||||
colorScheme: SeedColorScheme.fromSeeds(
|
|
||||||
primaryKey: primary,
|
|
||||||
secondaryKey: secondary,
|
|
||||||
tertiaryKey: tertiary,
|
|
||||||
tones: FlexTones.vividBackground(Brightness.light),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
navigatorKey: App.rootNavigatorKey,
|
navigatorKey: App.rootNavigatorKey,
|
||||||
darkTheme: ThemeData(
|
darkTheme: getTheme(primary, secondary, tertiary, Brightness.dark),
|
||||||
colorScheme: SeedColorScheme.fromSeeds(
|
|
||||||
primaryKey: primary,
|
|
||||||
secondaryKey: secondary,
|
|
||||||
tertiaryKey: tertiary,
|
|
||||||
brightness: Brightness.dark,
|
|
||||||
tones: FlexTones.vividBackground(Brightness.dark),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
themeMode: switch (appdata.settings['theme_mode']) {
|
themeMode: switch (appdata.settings['theme_mode']) {
|
||||||
'light' => ThemeMode.light,
|
'light' => ThemeMode.light,
|
||||||
'dark' => ThemeMode.dark,
|
'dark' => ThemeMode.dark,
|
||||||
|
Reference in New Issue
Block a user