This commit is contained in:
2026-03-22 00:51:45 +03:00
parent b5df1b9367
commit 8972ebdfd5
2 changed files with 35 additions and 5 deletions
+26 -2
View File
@@ -2,13 +2,37 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import '../core/constants.dart'; import '../core/constants.dart';
final _nunitoFamily = GoogleFonts.nunito().fontFamily;
TextTheme _withCyrillicFallback(TextTheme theme) {
return theme.copyWith(
displayLarge: theme.displayLarge?.copyWith(fontFamilyFallback: [_nunitoFamily!]),
displayMedium: theme.displayMedium?.copyWith(fontFamilyFallback: [_nunitoFamily!]),
displaySmall: theme.displaySmall?.copyWith(fontFamilyFallback: [_nunitoFamily!]),
headlineLarge: theme.headlineLarge?.copyWith(fontFamilyFallback: [_nunitoFamily!]),
headlineMedium: theme.headlineMedium?.copyWith(fontFamilyFallback: [_nunitoFamily!]),
headlineSmall: theme.headlineSmall?.copyWith(fontFamilyFallback: [_nunitoFamily!]),
titleLarge: theme.titleLarge?.copyWith(fontFamilyFallback: [_nunitoFamily!]),
titleMedium: theme.titleMedium?.copyWith(fontFamilyFallback: [_nunitoFamily!]),
titleSmall: theme.titleSmall?.copyWith(fontFamilyFallback: [_nunitoFamily!]),
bodyLarge: theme.bodyLarge?.copyWith(fontFamilyFallback: [_nunitoFamily!]),
bodyMedium: theme.bodyMedium?.copyWith(fontFamilyFallback: [_nunitoFamily!]),
bodySmall: theme.bodySmall?.copyWith(fontFamilyFallback: [_nunitoFamily!]),
labelLarge: theme.labelLarge?.copyWith(fontFamilyFallback: [_nunitoFamily!]),
labelMedium: theme.labelMedium?.copyWith(fontFamilyFallback: [_nunitoFamily!]),
labelSmall: theme.labelSmall?.copyWith(fontFamilyFallback: [_nunitoFamily!]),
);
}
class AppTheme { class AppTheme {
static ThemeData get darkTheme { static ThemeData get darkTheme {
final base = ThemeData.dark(useMaterial3: true); final base = ThemeData.dark(useMaterial3: true);
final textTheme = GoogleFonts.poppinsTextTheme(base.textTheme).apply( final textTheme = _withCyrillicFallback(
GoogleFonts.poppinsTextTheme(base.textTheme).apply(
bodyColor: AppColors.textPrimary, bodyColor: AppColors.textPrimary,
displayColor: AppColors.textPrimary, displayColor: AppColors.textPrimary,
fontFamilyFallback: ['Nunito'], // Ensures Cyrillic renders with same visual style ),
); );
return base.copyWith( return base.copyWith(
+7 -1
View File
@@ -15,7 +15,13 @@ void main() async {
await initializeDateFormatting('ru_RU', null); await initializeDateFormatting('ru_RU', null);
await initializeDateFormatting('en', null); await initializeDateFormatting('en', null);
await initializeDateFormatting('ru', null); await initializeDateFormatting('ru', null);
await GoogleFonts.pendingFonts([GoogleFonts.nunito()]); await GoogleFonts.pendingFonts([
GoogleFonts.nunito(),
GoogleFonts.nunito(fontWeight: FontWeight.w600),
GoogleFonts.nunito(fontWeight: FontWeight.w700),
GoogleFonts.nunito(fontWeight: FontWeight.w800),
]);
final prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
await HapticService.init(); await HapticService.init();