mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00: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:
parent
b031a8cac1
commit
bcd17c2ebe
6 changed files with 60 additions and 21 deletions
|
|
@ -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,
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue