Add locale based font

This commit is contained in:
problematicconsumer
2023-07-24 18:53:02 +03:30
parent acc438c40e
commit 49948398b5
3 changed files with 13 additions and 6 deletions

Binary file not shown.

View File

@@ -19,6 +19,9 @@ class AppView extends HookConsumerWidget with PresLogger {
ref.watch(commonControllersProvider);
// HACK temporary solution
final fontFamily = locale.languageCode == "fa" ? "Shabnam" : "";
return MaterialApp.router(
routerConfig: router,
locale: locale,
@@ -26,8 +29,8 @@ class AppView extends HookConsumerWidget with PresLogger {
localizationsDelegates: GlobalMaterialLocalizations.delegates,
debugShowCheckedModeBanner: false,
themeMode: theme.themeMode,
theme: theme.light,
darkTheme: theme.dark,
theme: theme.light(fontFamily: fontFamily),
darkTheme: theme.dark(fontFamily: fontFamily),
title: 'Hiddify',
).animate().fadeIn();
}

View File

@@ -4,7 +4,9 @@ import 'package:hiddify/core/theme/theme_prefs.dart';
// mostly exact copy of flex color scheme 7.1's fabulous 12 theme
extension AppTheme on ThemePrefs {
ThemeData get light {
ThemeData light({
String fontFamily = "Shabnam",
}) {
return FlexThemeData.light(
scheme: FlexScheme.indigoM3,
surfaceMode: FlexSurfaceMode.highScaffoldLowSurface,
@@ -59,11 +61,13 @@ extension AppTheme on ThemePrefs {
),
tones: FlexTones.jolly(Brightness.light),
visualDensity: FlexColorScheme.comfortablePlatformDensity,
fontFamily: "Shabnam",
fontFamily: fontFamily,
);
}
ThemeData get dark {
ThemeData dark({
String fontFamily = "Shabnam",
}) {
return FlexThemeData.dark(
scheme: FlexScheme.indigoM3,
useMaterial3: true,
@@ -119,7 +123,7 @@ extension AppTheme on ThemePrefs {
),
// tones: FlexTones.jolly(Brightness.dark),
visualDensity: FlexColorScheme.comfortablePlatformDensity,
fontFamily: "Shabnam",
fontFamily: fontFamily,
);
}
}