diff --git a/lib/src/core/localization/generated/intl/messages_all.dart b/lib/src/core/localization/generated/intl/messages_all.dart index abae25a5..14f33c3b 100644 --- a/lib/src/core/localization/generated/intl/messages_all.dart +++ b/lib/src/core/localization/generated/intl/messages_all.dart @@ -20,6 +20,7 @@ import 'messages_en.dart' as messages_en; import 'messages_ru.dart' as messages_ru; typedef Future LibraryLoader(); + Map _deferredLibraries = { 'en': () => new SynchronousFuture(null), 'ru': () => new SynchronousFuture(null), @@ -38,9 +39,8 @@ MessageLookupByLibrary? _findExact(String localeName) { /// User programs should call this before using [localeName] for messages. Future initializeMessages(String localeName) { - var availableLocale = Intl.verifiedLocale( - localeName, (locale) => _deferredLibraries[locale] != null, - onFailure: (_) => null); + var availableLocale = + Intl.verifiedLocale(localeName, (locale) => _deferredLibraries[locale] != null, onFailure: (_) => null); if (availableLocale == null) { return new SynchronousFuture(false); } @@ -60,8 +60,7 @@ bool _messagesExistFor(String locale) { } MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) { - var actualLocale = - Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null); + var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null); if (actualLocale == null) return null; return _findExact(actualLocale); } diff --git a/lib/src/core/localization/generated/intl/messages_en.dart b/lib/src/core/localization/generated/intl/messages_en.dart index 236fd419..b7a8b139 100644 --- a/lib/src/core/localization/generated/intl/messages_en.dart +++ b/lib/src/core/localization/generated/intl/messages_en.dart @@ -23,6 +23,7 @@ class MessageLookup extends MessageLookupByLibrary { static String m0(number) => "Level ${number}"; final messages = _notInlinedMessages(_notInlinedMessages); + static Map _notInlinedMessages(_) => { "about": MessageLookupByLibrary.simpleMessage("About"), "appDictionary": MessageLookupByLibrary.simpleMessage("App dictionary"), @@ -30,23 +31,20 @@ class MessageLookup extends MessageLookupByLibrary { "appTitle": MessageLookupByLibrary.simpleMessage("Wordly Plus"), "casual": MessageLookupByLibrary.simpleMessage("Default"), "colorMode": MessageLookupByLibrary.simpleMessage("Color mode"), - "currentStreak": - MessageLookupByLibrary.simpleMessage("Current\nStreak"), + "currentStreak": MessageLookupByLibrary.simpleMessage("Current\nStreak"), "daily": MessageLookupByLibrary.simpleMessage("Daily"), "en": MessageLookupByLibrary.simpleMessage("English"), - "guessDistribution": - MessageLookupByLibrary.simpleMessage("Guess distribution"), + "guessDistribution": MessageLookupByLibrary.simpleMessage("Guess distribution"), "highContrast": MessageLookupByLibrary.simpleMessage("High contrast"), "levelNumber": m0, "levels": MessageLookupByLibrary.simpleMessage("Levels"), "loseMessage": MessageLookupByLibrary.simpleMessage("You lost"), "maxStreak": MessageLookupByLibrary.simpleMessage("Max\nStreak"), - "message_new_word": MessageLookupByLibrary.simpleMessage( - "subject=Wordle%20-%20New%20word&body=Word%20-%0AMeaning%20-"), + "message_new_word": + MessageLookupByLibrary.simpleMessage("subject=Wordle%20-%20New%20word&body=Word%20-%0AMeaning%20-"), "nextLevel": MessageLookupByLibrary.simpleMessage("Next level"), "nextWord": MessageLookupByLibrary.simpleMessage("Next wordle in"), - "notPlayed": MessageLookupByLibrary.simpleMessage( - "You haven\'t played a single game"), + "notPlayed": MessageLookupByLibrary.simpleMessage("You haven\'t played a single game"), "other": MessageLookupByLibrary.simpleMessage("Other"), "played": MessageLookupByLibrary.simpleMessage("Played"), "ru": MessageLookupByLibrary.simpleMessage("Russian"), @@ -64,9 +62,7 @@ class MessageLookup extends MessageLookupByLibrary { "viewStatistic": MessageLookupByLibrary.simpleMessage("View statistic"), "winMessage": MessageLookupByLibrary.simpleMessage("You win!"), "winRate": MessageLookupByLibrary.simpleMessage("Win\nrate"), - "wordNotFound": MessageLookupByLibrary.simpleMessage( - "Word not found in dictionary"), - "wordTooShort": - MessageLookupByLibrary.simpleMessage("Word is not correct length") + "wordNotFound": MessageLookupByLibrary.simpleMessage("Word not found in dictionary"), + "wordTooShort": MessageLookupByLibrary.simpleMessage("Word is not correct length") }; } diff --git a/lib/src/core/localization/generated/intl/messages_ru.dart b/lib/src/core/localization/generated/intl/messages_ru.dart index 79869936..55a9d330 100644 --- a/lib/src/core/localization/generated/intl/messages_ru.dart +++ b/lib/src/core/localization/generated/intl/messages_ru.dart @@ -23,6 +23,7 @@ class MessageLookup extends MessageLookupByLibrary { static String m0(number) => "Уровень ${number}"; final messages = _notInlinedMessages(_notInlinedMessages); + static Map _notInlinedMessages(_) => { "about": MessageLookupByLibrary.simpleMessage("О приложении"), "appDictionary": MessageLookupByLibrary.simpleMessage("Язык словаря"), @@ -33,21 +34,17 @@ class MessageLookup extends MessageLookupByLibrary { "currentStreak": MessageLookupByLibrary.simpleMessage("Текущая\nСерия"), "daily": MessageLookupByLibrary.simpleMessage("Ежедневный"), "en": MessageLookupByLibrary.simpleMessage("Английский"), - "guessDistribution": - MessageLookupByLibrary.simpleMessage("Распределение догадок"), - "highContrast": - MessageLookupByLibrary.simpleMessage("Высокий контраст"), + "guessDistribution": MessageLookupByLibrary.simpleMessage("Распределение догадок"), + "highContrast": MessageLookupByLibrary.simpleMessage("Высокий контраст"), "levelNumber": m0, "levels": MessageLookupByLibrary.simpleMessage("Уровни"), "loseMessage": MessageLookupByLibrary.simpleMessage("Вы проиграли"), "maxStreak": MessageLookupByLibrary.simpleMessage("Макс.\nСерия"), - "message_new_word": MessageLookupByLibrary.simpleMessage( - "subject=Словень%20-%20Новое%20слово&body=Слово%20-%0AЗначение%20-"), + "message_new_word": + MessageLookupByLibrary.simpleMessage("subject=Словень%20-%20Новое%20слово&body=Слово%20-%0AЗначение%20-"), "nextLevel": MessageLookupByLibrary.simpleMessage("Следующий уровень"), - "nextWord": - MessageLookupByLibrary.simpleMessage("Следующее слово через"), - "notPlayed": - MessageLookupByLibrary.simpleMessage("Вы не сыграли ни одной игры"), + "nextWord": MessageLookupByLibrary.simpleMessage("Следующее слово через"), + "notPlayed": MessageLookupByLibrary.simpleMessage("Вы не сыграли ни одной игры"), "other": MessageLookupByLibrary.simpleMessage("Другой"), "played": MessageLookupByLibrary.simpleMessage("Сыграно"), "ru": MessageLookupByLibrary.simpleMessage("Русский"), @@ -62,13 +59,10 @@ class MessageLookup extends MessageLookupByLibrary { "themeSystem": MessageLookupByLibrary.simpleMessage("Системная"), "tutorial": MessageLookupByLibrary.simpleMessage("Как играть"), "viewLevels": MessageLookupByLibrary.simpleMessage("Посмотреть уровни"), - "viewStatistic": - MessageLookupByLibrary.simpleMessage("Посмотреть статистику"), + "viewStatistic": MessageLookupByLibrary.simpleMessage("Посмотреть статистику"), "winMessage": MessageLookupByLibrary.simpleMessage("Вы победили!"), "winRate": MessageLookupByLibrary.simpleMessage("Показатель\nпобед"), - "wordNotFound": - MessageLookupByLibrary.simpleMessage("Слово не найдено в словаре"), - "wordTooShort": - MessageLookupByLibrary.simpleMessage("Слово неправильной длины") + "wordNotFound": MessageLookupByLibrary.simpleMessage("Слово не найдено в словаре"), + "wordTooShort": MessageLookupByLibrary.simpleMessage("Слово неправильной длины") }; } diff --git a/lib/src/core/localization/generated/l10n.dart b/lib/src/core/localization/generated/l10n.dart index 1b3c8d6e..1bb0e348 100644 --- a/lib/src/core/localization/generated/l10n.dart +++ b/lib/src/core/localization/generated/l10n.dart @@ -1,6 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; + import 'intl/messages_all.dart'; // ************************************************************************** @@ -26,9 +27,7 @@ class GeneratedLocalization { static const AppLocalizationDelegate delegate = AppLocalizationDelegate(); static Future load(Locale locale) { - final name = (locale.countryCode?.isEmpty ?? false) - ? locale.languageCode - : locale.toString(); + final name = (locale.countryCode?.isEmpty ?? false) ? locale.languageCode : locale.toString(); final localeName = Intl.canonicalizedLocale(name); return initializeMessages(localeName).then((_) { Intl.defaultLocale = localeName; @@ -47,8 +46,7 @@ class GeneratedLocalization { } static GeneratedLocalization? maybeOf(BuildContext context) { - return Localizations.of( - context, GeneratedLocalization); + return Localizations.of(context, GeneratedLocalization); } /// `Wordly Plus` @@ -432,8 +430,7 @@ class GeneratedLocalization { } } -class AppLocalizationDelegate - extends LocalizationsDelegate { +class AppLocalizationDelegate extends LocalizationsDelegate { const AppLocalizationDelegate(); List get supportedLocales { @@ -445,9 +442,10 @@ class AppLocalizationDelegate @override bool isSupported(Locale locale) => _isSupported(locale); + @override - Future load(Locale locale) => - GeneratedLocalization.load(locale); + Future load(Locale locale) => GeneratedLocalization.load(locale); + @override bool shouldReload(AppLocalizationDelegate old) => false; diff --git a/lib/src/feature/about/widget/about_page.dart b/lib/src/feature/about/widget/about_page.dart index 084a7882..609fe2a6 100644 --- a/lib/src/feature/about/widget/about_page.dart +++ b/lib/src/feature/about/widget/about_page.dart @@ -1,10 +1,17 @@ import 'package:flutter/material.dart'; +import 'package:wordly/src/core/utils/extensions/extensions.dart'; class AboutPage extends StatelessWidget { const AboutPage({super.key}); @override Widget build(BuildContext context) { - return const Scaffold(); + return Title( + color: Colors.black, + title: context.r.about, + child: Scaffold( + appBar: AppBar(), + ), + ); } } diff --git a/lib/src/feature/game/widget/game_result_dialog.dart b/lib/src/feature/game/widget/game_result_dialog.dart index eefe76a7..97bff5c9 100644 --- a/lib/src/feature/game/widget/game_result_dialog.dart +++ b/lib/src/feature/game/widget/game_result_dialog.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:wordly/src/core/resources/resources.dart'; import 'package:wordly/src/core/utils/extensions/extensions.dart'; import 'package:wordly/src/feature/game/model/game_mode.dart'; import 'package:wordly/src/feature/game/widget/countdown_timer.dart'; @@ -48,7 +49,7 @@ class DialogContent extends StatelessWidget { final width = MediaQuery.sizeOf(context).width; final padding = width > 350 ? (width - 350) / 2 : 8; return Dialog( - backgroundColor: isWin ? Colors.green : Colors.red, + backgroundColor: isWin ? AppColors.green : AppColors.red, insetAnimationDuration: const Duration(milliseconds: 800), insetPadding: EdgeInsets.symmetric(horizontal: padding.toDouble()), child: Padding( @@ -114,7 +115,7 @@ class _DailyContent extends StatelessWidget { child: Text( context.r.share, style: context.theme.blb.copyWith( - color: isWin ? Colors.green : Colors.red, + color: isWin ? AppColors.green : AppColors.red, ), textAlign: TextAlign.center, ), @@ -149,7 +150,7 @@ class _LevelContent extends StatelessWidget { child: Text( context.r.nextLevel, style: context.theme.blb.copyWith( - color: isWin ? Colors.green : Colors.red, + color: isWin ? AppColors.green : AppColors.red, ), textAlign: TextAlign.center, ), diff --git a/lib/src/feature/game/widget/keyboard_by_language.dart b/lib/src/feature/game/widget/keyboard_by_language.dart index bbd26373..94669f1e 100644 --- a/lib/src/feature/game/widget/keyboard_by_language.dart +++ b/lib/src/feature/game/widget/keyboard_by_language.dart @@ -1,5 +1,3 @@ -import 'dart:math' as math show pi; - import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:wordly/src/feature/app/widget/dictionary_scope.dart'; diff --git a/lib/src/feature/level/widget/level_dialog.dart b/lib/src/feature/level/widget/level_dialog.dart index 23e496f9..4dc09c11 100644 --- a/lib/src/feature/level/widget/level_dialog.dart +++ b/lib/src/feature/level/widget/level_dialog.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:wordly/src/core/resources/resources.dart'; import 'package:wordly/src/core/utils/extensions/extensions.dart'; Future showLevelDialog( @@ -13,7 +14,7 @@ Future showLevelDialog( final width = MediaQuery.sizeOf(context).width; final padding = width > 350 ? (width - 350) / 2 : 8; return Dialog( - backgroundColor: isWin ? Colors.green : Colors.red, + backgroundColor: isWin ? AppColors.green : AppColors.red, insetAnimationDuration: const Duration(milliseconds: 800), insetPadding: EdgeInsets.symmetric(horizontal: padding.toDouble()), child: Padding( diff --git a/lib/src/feature/settings/widget/setting_page.dart b/lib/src/feature/settings/widget/setting_page.dart index 21183aea..afff06be 100644 --- a/lib/src/feature/settings/widget/setting_page.dart +++ b/lib/src/feature/settings/widget/setting_page.dart @@ -20,78 +20,82 @@ class SettingsPage extends StatefulWidget { class _SettingsPageState extends State { @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar(title: Text(context.r.settings)), - body: ConstraintScreen( - child: Column( - children: [ - ListItemSelector( - title: context.r.appDictionary, - currentValue: ( - DictionaryScope.of(context).dictionary, - _localeName(DictionaryScope.of(context).dictionary) + return Title( + color: Colors.black, + title: context.r.settings, + child: Scaffold( + appBar: AppBar(title: Text(context.r.settings)), + body: ConstraintScreen( + child: Column( + children: [ + ListItemSelector( + title: context.r.appDictionary, + currentValue: ( + DictionaryScope.of(context).dictionary, + _localeName(DictionaryScope.of(context).dictionary) + ), + items: [(const Locale('ru'), context.r.ru), (const Locale('en'), context.r.en)], + onChange: (d) { + DictionaryScope.of(context).setDictionary(d); + context.read().add(GameEvent.changeDictionary(d)); + }, + ), + ListItemSelector( + title: context.r.appLanguage, + currentValue: (LocaleScope.of(context).locale, _localeName(LocaleScope.of(context).locale)), + items: [(const Locale('ru'), context.r.ru), (const Locale('en'), context.r.en)], + onChange: (l) => LocaleScope.of(context).setLocale(l), ), - items: [(const Locale('ru'), context.r.ru), (const Locale('en'), context.r.en)], - onChange: (d) { - DictionaryScope.of(context).setDictionary(d); - context.read().add(GameEvent.changeDictionary(d)); - }, - ), - ListItemSelector( - title: context.r.appLanguage, - currentValue: (LocaleScope.of(context).locale, _localeName(LocaleScope.of(context).locale)), - items: [(const Locale('ru'), context.r.ru), (const Locale('en'), context.r.en)], - onChange: (l) => LocaleScope.of(context).setLocale(l), - ), - ListItemSelector( - title: context.r.themeMode, - currentValue: (ThemeScope.of(context).theme.mode, _themeName(ThemeScope.of(context).theme.mode)), - items: [ - (ThemeMode.system, context.r.themeSystem), - (ThemeMode.dark, context.r.themeDark), - (ThemeMode.light, context.r.themeLight), - ], - onChange: (mode) { - final themeScope = ThemeScope.of(context, listen: false); - final previousTheme = themeScope.theme; - themeScope.setTheme( - previousTheme.copyWith(themeMode: mode), - ); - }, - ), - MergeSemantics( - child: ListTileTheme.merge( - child: ListTile( - contentPadding: const EdgeInsets.symmetric(horizontal: 16), - title: Text(context.r.colorMode, style: context.theme.bl), - trailing: Text(ThemeScope.of(context).theme.colorMode.localized(context), style: context.theme.bl), - onTap: () async { - final themeScope = ThemeScope.of(context, listen: false); - final previousTheme = themeScope.theme; - final result = await Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => ChangeColorPage( - previousResult: ChangeColorResult( - colorMode: previousTheme.colorMode, - otherColors: previousTheme.otherColors, + ListItemSelector( + title: context.r.themeMode, + currentValue: (ThemeScope.of(context).theme.mode, _themeName(ThemeScope.of(context).theme.mode)), + items: [ + (ThemeMode.system, context.r.themeSystem), + (ThemeMode.dark, context.r.themeDark), + (ThemeMode.light, context.r.themeLight), + ], + onChange: (mode) { + final themeScope = ThemeScope.of(context, listen: false); + final previousTheme = themeScope.theme; + themeScope.setTheme( + previousTheme.copyWith(themeMode: mode), + ); + }, + ), + MergeSemantics( + child: ListTileTheme.merge( + child: ListTile( + contentPadding: const EdgeInsets.symmetric(horizontal: 16), + title: Text(context.r.colorMode, style: context.theme.bl), + trailing: Text(ThemeScope.of(context).theme.colorMode.localized(context), style: context.theme.bl), + onTap: () async { + final themeScope = ThemeScope.of(context, listen: false); + final previousTheme = themeScope.theme; + final result = await Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => ChangeColorPage( + previousResult: ChangeColorResult( + colorMode: previousTheme.colorMode, + otherColors: previousTheme.otherColors, + ), ), ), - ), - ); - if (result == null) { - return; - } - themeScope.setTheme( - previousTheme.copyWith( - colorMode: result.colorMode, - otherColors: result.otherColors, - ), - ); - }, + ); + if (result == null) { + return; + } + themeScope.setTheme( + previousTheme.copyWith( + colorMode: result.colorMode, + otherColors: result.otherColors, + ), + ); + }, + ), ), ), - ), - ], + ], + ), ), ), ); diff --git a/lib/src/feature/tutorial/widget/tutorial_page.dart b/lib/src/feature/tutorial/widget/tutorial_page.dart index 3f1eade9..bd57218e 100644 --- a/lib/src/feature/tutorial/widget/tutorial_page.dart +++ b/lib/src/feature/tutorial/widget/tutorial_page.dart @@ -1,12 +1,17 @@ import 'package:flutter/material.dart'; +import 'package:wordly/src/core/utils/extensions/extensions.dart'; class TutorialPage extends StatelessWidget { const TutorialPage({super.key}); @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar(), + return Title( + color: Colors.black, + title: context.r.tutorial, + child: Scaffold( + appBar: AppBar(), + ), ); } }