mirror of
https://github.com/immich-app/immich.git
synced 2025-12-18 01:11:07 +03:00
feat(mobile): exclude locales from overpass font (#14158)
* feat(mobile): create localeProvider This provider can be used to refresh providers that provide UI elements and get cached. * feat(mobile): use default font for locales not supported by Overpass * chore(mobile): fix test * refactor(mobile): use Locale instead of String
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:dynamic_color/dynamic_color.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/constants/immich_colors.dart';
|
||||
import 'package:immich_mobile/constants/locales.dart';
|
||||
import 'package:immich_mobile/extensions/theme_extensions.dart';
|
||||
import 'package:immich_mobile/providers/app_settings.provider.dart';
|
||||
import 'package:immich_mobile/services/app_settings.service.dart';
|
||||
@@ -145,7 +146,18 @@ ImmichTheme _decolorizeSurfaces({
|
||||
);
|
||||
}
|
||||
|
||||
ThemeData getThemeData({required ColorScheme colorScheme}) {
|
||||
String? getFontFamilyFromLocale(Locale locale) {
|
||||
if (localesNotSupportedByOverpass.contains(locale)) {
|
||||
// Let Flutter use the default font
|
||||
return null;
|
||||
}
|
||||
return 'Overpass';
|
||||
}
|
||||
|
||||
ThemeData getThemeData({
|
||||
required ColorScheme colorScheme,
|
||||
required Locale locale,
|
||||
}) {
|
||||
var isDark = colorScheme.brightness == Brightness.dark;
|
||||
var primaryColor = colorScheme.primary;
|
||||
|
||||
@@ -163,10 +175,10 @@ ThemeData getThemeData({required ColorScheme colorScheme}) {
|
||||
bottomSheetTheme: BottomSheetThemeData(
|
||||
backgroundColor: colorScheme.surfaceContainer,
|
||||
),
|
||||
fontFamily: 'Overpass',
|
||||
fontFamily: getFontFamilyFromLocale(locale),
|
||||
snackBarTheme: SnackBarThemeData(
|
||||
contentTextStyle: TextStyle(
|
||||
fontFamily: 'Overpass',
|
||||
fontFamily: getFontFamilyFromLocale(locale),
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -175,7 +187,7 @@ ThemeData getThemeData({required ColorScheme colorScheme}) {
|
||||
appBarTheme: AppBarTheme(
|
||||
titleTextStyle: TextStyle(
|
||||
color: primaryColor,
|
||||
fontFamily: 'Overpass',
|
||||
fontFamily: getFontFamilyFromLocale(locale),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user