migrate l10n
Restyled by shellharden Restyled by shfmt Restyled by whitespace fix ci
This commit is contained in:
parent
150fd7215a
commit
399250df9d
|
@ -12,9 +12,7 @@ flutter config --no-analytics
|
|||
|
||||
flutter pub get
|
||||
|
||||
flutter pub global activate intl_utils
|
||||
flutter --no-color pub global run intl_utils:generate
|
||||
|
||||
flutter gen-l10n
|
||||
|
||||
flutter pub run flutter_oss_licenses:generate.dart
|
||||
mv lib/oss_licenses.dart lib/generated
|
||||
|
|
|
@ -1,4 +1,20 @@
|
|||
# see https://flutter.dev/go/i18n-user-guide
|
||||
# https://docs.google.com/document/d/10e0saTfAv32OZLRmONy866vnaw0I2jwL8zukykpgWBc/edit#
|
||||
#
|
||||
# WARNING: DO NOT translate app_XX.arb files directly here. For translations please see:
|
||||
# https://weblate.rimikis.de/projects/bierverkostung/
|
||||
# (only the source language, app_en.arb is edited manually here).
|
||||
#
|
||||
# We are now using synthetic packages, so to use `AppLocalizations` inside the code
|
||||
# you have to add the following import:
|
||||
# import 'package:yahtzee_counter/l10n/app_localizations.g.dart';
|
||||
|
||||
arb-dir: lib/l10n
|
||||
template-arb-file: intl_en.arb
|
||||
output-localization-file: app_localizations.dart
|
||||
untranslated-messages-file: untranslated-messages-file.txt
|
||||
output-dir: lib/generated/intl/
|
||||
output-localization-file: l10n.dart
|
||||
output-class: S
|
||||
untranslated-messages-file: untranslated-messages-file.txt
|
||||
# use-deferred-loading: true #enable for web support
|
||||
synthetic-package: false
|
||||
nullable-getter: false
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "أجوف",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "عربى",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Куха",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "български",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "ফাঁপা",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "বাংলা",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Dutý",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Čeština",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Hul",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Dansk",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Hohle",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Deutsch",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Hohle",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Schweizerdeutsch",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Κοίλος",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Ελληνικά",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Hollow",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "English",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Hueco",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Español",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Õõnes",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Eestlane",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "توخالی",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "فارسی",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Ontto",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Suomalainen",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Creux",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Français",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "હોલો",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "ગુજરાતી",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "खोखला",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "हिंदी",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Šuplje",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Hrvatski",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Üreges",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Magyar",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Kosong",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Indonesia",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Vuoto",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Italiano",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "中空円",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "日本語",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "ಟೊಳ್ಳು",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "ಕನ್ನಡ",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "구멍",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "한국어",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Tuščiaviduriai",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Lietuvis",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Dobis",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Latvietis",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Шупливи",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Македонски",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Berongga",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Melayu",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Hol",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Nederlands",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Hul",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Norsk",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Dziurawy",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Polskie",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Oco",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Português",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Gol",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Română",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Пустой",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Pусский",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Dutý",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Slovák",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Votlo",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Slovenščina",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Zgavër",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Shqiptare",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Холлов",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Српски",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Ihålig",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Svenska",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "బోలు",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "తెలుగు",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "กลวง",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "ไทย",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Oyuk",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Türk",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Ichi bo'sh",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "O'zbek",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "Rỗng",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "Tiếng Việt",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "空心圆",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "简体中文",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1248,5 +1248,9 @@
|
|||
"hollow": "空心圓",
|
||||
"@hollow": {
|
||||
"description": "Hollow"
|
||||
},
|
||||
"languageName": "繁體中文",
|
||||
"@languageName": {
|
||||
"description": "The name of the current language"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,598 +0,0 @@
|
|||
/*
|
||||
This file is part of Sanmill.
|
||||
Copyright (C) 2019-2021 The Sanmill developers (see AUTHORS file)
|
||||
|
||||
Sanmill is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Sanmill is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sanmill/generated/l10n.dart';
|
||||
import 'package:sanmill/services/storage/storage.dart';
|
||||
import 'package:sanmill/shared/constants.dart';
|
||||
import 'package:sanmill/shared/list_item_divider.dart';
|
||||
import 'package:sanmill/shared/theme/app_theme.dart';
|
||||
|
||||
Map<Locale, Strings> languageCodeToStrings = {
|
||||
const Locale("ar"): ArabicStrings(),
|
||||
const Locale("bg"): BulgarianStrings(),
|
||||
const Locale("bn"): BengaliStrings(),
|
||||
const Locale("cs"): CzechStrings(),
|
||||
const Locale("da"): DanishStrings(),
|
||||
const Locale("de"): GermanStrings(),
|
||||
const Locale("de_CH"): SwissGermanStrings(),
|
||||
const Locale("el"): GreekStrings(),
|
||||
const Locale("en"): EnglishStrings(),
|
||||
const Locale("es"): SpanishStrings(),
|
||||
const Locale("et"): EstonianStrings(),
|
||||
const Locale("fa"): FarsiStrings(),
|
||||
const Locale("fi"): FinnishStrings(),
|
||||
const Locale("fr"): FrenchStrings(),
|
||||
const Locale("gu"): GujaratiStrings(),
|
||||
const Locale("hi"): HindiStrings(),
|
||||
const Locale("hr"): CroatianStrings(),
|
||||
const Locale("hu"): HungarianStrings(),
|
||||
const Locale("id"): IndonesianStrings(),
|
||||
const Locale("it"): ItalianStrings(),
|
||||
const Locale("ja"): JapaneseStrings(),
|
||||
const Locale("kn"): KannadaStrings(),
|
||||
const Locale("ko"): KoreanStrings(),
|
||||
const Locale("lt"): LithuanianStrings(),
|
||||
const Locale("lv"): LatvianStrings(),
|
||||
const Locale("mk"): MacedonianStrings(),
|
||||
const Locale("ms"): MalayStrings(),
|
||||
const Locale("nl"): DutchStrings(),
|
||||
const Locale("nn"): NorwegianStrings(),
|
||||
const Locale("pl"): PolishStrings(),
|
||||
const Locale("pt"): PortugueseStrings(),
|
||||
const Locale("ro"): RomanianStrings(),
|
||||
const Locale("ru"): RussianStrings(),
|
||||
const Locale("sk"): SlovakStrings(),
|
||||
const Locale("sl"): SlovenianStrings(),
|
||||
const Locale("sq"): AlbanianStrings(),
|
||||
const Locale("sr"): SerbianStrings(),
|
||||
const Locale("sv"): SwedishStrings(),
|
||||
const Locale("te"): TeluguStrings(),
|
||||
const Locale("th"): ThaiStrings(),
|
||||
const Locale("tr"): TurkishStrings(),
|
||||
const Locale("uz"): UzbekStrings(),
|
||||
const Locale("vi"): VietnameseStrings(),
|
||||
const Locale("zh"): ChineseStrings(),
|
||||
const Locale("zh_Hant"): TraditionalChineseStrings(),
|
||||
};
|
||||
|
||||
/// Interface strings
|
||||
abstract class Strings {
|
||||
String get languageName;
|
||||
String get tapBackAgainToLeave;
|
||||
}
|
||||
|
||||
/// ar
|
||||
class ArabicStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'عربى';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'انقر مرة أخرى للمغادرة.';
|
||||
}
|
||||
|
||||
/// bg
|
||||
class BulgarianStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'български';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Докоснете отново назад, за да излезете.';
|
||||
}
|
||||
|
||||
/// bn
|
||||
class BengaliStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'বাংলা';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'ছেড়ে যেতে আবার আলতো চাপুন।';
|
||||
}
|
||||
|
||||
/// cs
|
||||
class CzechStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Čeština';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Opětovným klepnutím zpět odejdete.';
|
||||
}
|
||||
|
||||
/// da
|
||||
class DanishStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Dansk';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Tryk tilbage igen for at gå.';
|
||||
}
|
||||
|
||||
/// de
|
||||
class GermanStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Deutsch';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Nochmal drücken um zu Beenden.';
|
||||
}
|
||||
|
||||
/// de-ch
|
||||
class SwissGermanStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Schweizerdeutsch';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Nochmal drücken um zu Beenden.';
|
||||
}
|
||||
|
||||
/// el
|
||||
class GreekStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Ελληνικά';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Πατήστε ξανά πίσω για να φύγετε.';
|
||||
}
|
||||
|
||||
/// en
|
||||
class EnglishStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'English';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Tap back again to leave.';
|
||||
}
|
||||
|
||||
/// es
|
||||
class SpanishStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Español';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Vuelva a tocar para salir.';
|
||||
}
|
||||
|
||||
/// et
|
||||
class EstonianStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Eestlane';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Koputage uuesti tagasi, et lahkuda.';
|
||||
}
|
||||
|
||||
/// fa
|
||||
class FarsiStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'فارسی';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave =>
|
||||
'برای خروج از برنامه ، دوباره روی دکمه برگشت ضربه بزنید.';
|
||||
}
|
||||
|
||||
/// fi
|
||||
class FinnishStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Suomalainen';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Poistu napauttamalla uudelleen takaisin.';
|
||||
}
|
||||
|
||||
/// fr
|
||||
class FrenchStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Français';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Tapez à nouveau pour quitter.';
|
||||
}
|
||||
|
||||
/// gu
|
||||
class GujaratiStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'ગુજરાતી';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'જવા માટે ફરીથી ટેપ કરો.';
|
||||
}
|
||||
|
||||
/// hi
|
||||
class HindiStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'हिंदी';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'जाने के लिए फिर से टैप करें।';
|
||||
}
|
||||
|
||||
/// hr
|
||||
class CroatianStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Hrvatski';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Ponovno dodirnite za napuštanje.';
|
||||
}
|
||||
|
||||
/// hu
|
||||
class HungarianStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Magyar';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave =>
|
||||
'A kilépéshez kattintson ismételten a Vissza gombra.';
|
||||
}
|
||||
|
||||
/// id
|
||||
class IndonesianStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Indonesia';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Ketuk kembali lagi untuk pergi.';
|
||||
}
|
||||
|
||||
/// it
|
||||
class ItalianStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Italiano';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Tocca di nuovo per uscire.';
|
||||
}
|
||||
|
||||
/// ja
|
||||
class JapaneseStrings extends Strings {
|
||||
@override
|
||||
String get languageName => '日本語';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'もう一度returnを押してアプリケーションを終了する';
|
||||
}
|
||||
|
||||
/// kn
|
||||
class KannadaStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'ಕನ್ನಡ';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'ಬಿಡಲು ಮತ್ತೆ ಟ್ಯಾಪ್ ಮಾಡಿ.';
|
||||
}
|
||||
|
||||
/// ko
|
||||
class KoreanStrings extends Strings {
|
||||
@override
|
||||
String get languageName => '한국어';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => '애플리케이션을 종료하려면 리턴 키를 다시 누르십시오.';
|
||||
}
|
||||
|
||||
/// lt
|
||||
class LithuanianStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Lietuvis';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave =>
|
||||
'Dar kartą bakstelėkite atgal, kad išeitumėte.';
|
||||
}
|
||||
|
||||
/// lv
|
||||
class LatvianStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Latvietis';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Pieskarieties atpakaļ, lai izietu.';
|
||||
}
|
||||
|
||||
/// mk
|
||||
class MacedonianStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Македонски';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Допрете назад за да заминете.';
|
||||
}
|
||||
|
||||
/// ms
|
||||
class MalayStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Melayu';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Ketik kembali sekali lagi untuk pergi.';
|
||||
}
|
||||
|
||||
/// nl
|
||||
class DutchStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Nederlands';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Tik opnieuw om te vertrekken.';
|
||||
}
|
||||
|
||||
/// nn
|
||||
class NorwegianStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Norsk';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Trykk tilbake for å dra.';
|
||||
}
|
||||
|
||||
/// pl
|
||||
class PolishStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Polskie';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Stuknij ponownie w tył, aby wyjść.';
|
||||
}
|
||||
|
||||
/// pt
|
||||
class PortugueseStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Português';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Toque novamente para sair.';
|
||||
}
|
||||
|
||||
/// ro
|
||||
class RomanianStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Română';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Atingeți din nou pentru a putea muta.';
|
||||
}
|
||||
|
||||
/// ru
|
||||
class RussianStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Pусский';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Нажмите назад еще раз, чтобы выйти.';
|
||||
}
|
||||
|
||||
/// sk
|
||||
class SlovakStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Slovák';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Ťuknutím na tlačidlo späť znova odíďte.';
|
||||
}
|
||||
|
||||
/// sl
|
||||
class SlovenianStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Slovenščina';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave =>
|
||||
'Ponovno se dotaknite nazaj, če želite oditi.';
|
||||
}
|
||||
|
||||
/// sq
|
||||
class AlbanianStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Shqiptare';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Trokit përsëri përsëri për t\'u larguar.';
|
||||
}
|
||||
|
||||
/// sr
|
||||
class SerbianStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Српски';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Додирните поново да бисте изашли.';
|
||||
}
|
||||
|
||||
/// sv
|
||||
class SwedishStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Svenska';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Tryck tillbaka igen för att gå vidare.';
|
||||
}
|
||||
|
||||
/// te
|
||||
class TeluguStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'తెలుగు';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'బయలుదేరడానికి మళ్ళీ నొక్కండి.';
|
||||
}
|
||||
|
||||
/// th
|
||||
class ThaiStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'ไทย';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'แตะกลับอีกครั้งเพื่อออก';
|
||||
}
|
||||
|
||||
/// tr
|
||||
class TurkishStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Türk';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Tocca di nuovo per uscire.';
|
||||
}
|
||||
|
||||
/// uz
|
||||
class UzbekStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'O\'zbek';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => 'Ketish uchun yana bir marta bosing.';
|
||||
}
|
||||
|
||||
/// vi
|
||||
class VietnameseStrings extends Strings {
|
||||
@override
|
||||
String get languageName => 'Tiếng Việt';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave =>
|
||||
'Nhấn phím quay lại một lần nữa để thoát ứng dụng.';
|
||||
}
|
||||
|
||||
/// zh
|
||||
class ChineseStrings extends Strings {
|
||||
@override
|
||||
String get languageName => '简体中文';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => '再次按返回键退出应用';
|
||||
}
|
||||
|
||||
/// zh-Hant
|
||||
class TraditionalChineseStrings extends Strings {
|
||||
@override
|
||||
String get languageName => '繁體中文';
|
||||
|
||||
@override
|
||||
String get tapBackAgainToLeave => '再次按 Back 鍵退出';
|
||||
}
|
||||
|
||||
final List<Locale> supportedLocales = [
|
||||
...languageCodeToStrings.keys,
|
||||
];
|
||||
|
||||
class Resources {
|
||||
Resources();
|
||||
|
||||
String get languageCode {
|
||||
if (LocalDatabaseService.display.languageCode == Constants.defaultLocale) {
|
||||
return Platform.localeName.substring(0, 2);
|
||||
}
|
||||
|
||||
return LocalDatabaseService.display.languageCode.languageCode;
|
||||
}
|
||||
|
||||
Strings get strings {
|
||||
final Strings? ret = languageCodeToStrings[languageCode];
|
||||
|
||||
if (ret == null) {
|
||||
return EnglishStrings();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static Resources of() {
|
||||
return Resources();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> setLanguage(
|
||||
BuildContext context,
|
||||
Function(Locale?)? callback,
|
||||
) async {
|
||||
final languageColumn = Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
RadioListTile<Locale>(
|
||||
activeColor: AppTheme.switchListTileActiveColor,
|
||||
title: Text(S.of(context).defaultLanguage),
|
||||
groupValue: LocalDatabaseService.display.languageCode,
|
||||
value: Constants.defaultLocale,
|
||||
onChanged: callback,
|
||||
),
|
||||
const ListItemDivider(),
|
||||
for (var i in languageCodeToStrings.keys)
|
||||
RadioListTile<Locale>(
|
||||
activeColor: AppTheme.switchListTileActiveColor,
|
||||
title: Text(languageCodeToStrings[i]!.languageName),
|
||||
groupValue: LocalDatabaseService.display.languageCode,
|
||||
value: i,
|
||||
onChanged: callback,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
scrollable: true,
|
||||
content: StatefulBuilder(
|
||||
builder: (BuildContext context, StateSetter setState) {
|
||||
return languageColumn;
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
enum Bidirectionality {
|
||||
leftToRight,
|
||||
rightToLeft,
|
||||
}
|
||||
|
||||
Bidirectionality getBidirectionality(BuildContext context) {
|
||||
final Locale currentLocale = Localizations.localeOf(context);
|
||||
if (currentLocale.languageCode == "ar" ||
|
||||
currentLocale.languageCode == "fa" ||
|
||||
currentLocale.languageCode == "he" ||
|
||||
currentLocale.languageCode == "ps" ||
|
||||
currentLocale.languageCode == "ur") {
|
||||
debugPrint("bidirectionality: RTL");
|
||||
return Bidirectionality.rightToLeft;
|
||||
} else {
|
||||
return Bidirectionality.leftToRight;
|
||||
}
|
||||
}
|
||||
|
||||
String specialCountryAndRegion = "";
|
||||
|
||||
void setSpecialCountryAndRegion(BuildContext context) {
|
||||
final Locale currentLocale = Localizations.localeOf(context);
|
||||
|
||||
switch (currentLocale.countryCode) {
|
||||
case "IR":
|
||||
specialCountryAndRegion = "Iran";
|
||||
break;
|
||||
default:
|
||||
specialCountryAndRegion = "";
|
||||
break;
|
||||
}
|
||||
|
||||
debugPrint("Set Special Country and Region to $specialCountryAndRegion.");
|
||||
}
|
|
@ -24,12 +24,13 @@ import 'package:double_back_to_close_app/double_back_to_close_app.dart';
|
|||
import 'package:feedback/feedback.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart' show Box;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:sanmill/generated/l10n.dart';
|
||||
import 'package:sanmill/l10n/resources.dart';
|
||||
import 'package:sanmill/generated/intl/l10n.dart';
|
||||
import 'package:sanmill/models/display.dart';
|
||||
import 'package:sanmill/screens/navigation_home_screen.dart';
|
||||
import 'package:sanmill/services/audios.dart';
|
||||
import 'package:sanmill/services/language_info.dart';
|
||||
import 'package:sanmill/services/storage/storage.dart';
|
||||
import 'package:sanmill/services/storage/storage_v1.dart';
|
||||
import 'package:sanmill/shared/constants.dart';
|
||||
|
@ -84,38 +85,44 @@ class SanmillApp extends StatelessWidget {
|
|||
|
||||
setSpecialCountryAndRegion(context);
|
||||
|
||||
return MaterialApp(
|
||||
/// Add navigator key from Catcher.
|
||||
/// It will be used to navigate user to report page or to show dialog.
|
||||
navigatorKey: Catcher.navigatorKey,
|
||||
key: globalScaffoldKey,
|
||||
navigatorObservers: [routeObserver],
|
||||
localizationsDelegates: const [
|
||||
// ... app-specific localization delegate[s] here
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: supportedLocales,
|
||||
theme: AppTheme.lightThemeData,
|
||||
darkTheme: AppTheme.darkThemeData,
|
||||
debugShowCheckedModeBanner: false,
|
||||
home: Scaffold(
|
||||
body: DoubleBackToCloseApp(
|
||||
snackBar: SnackBar(
|
||||
content: Text(Resources.of().strings.tapBackAgainToLeave),
|
||||
),
|
||||
child: NavigationHomeScreen(),
|
||||
),
|
||||
),
|
||||
/*
|
||||
WillPopScope(
|
||||
onWillPop: () async {
|
||||
Audios.disposePool();
|
||||
return true;
|
||||
},
|
||||
*/
|
||||
return ValueListenableBuilder(
|
||||
valueListenable: LocalDatabaseService.listenDisplay,
|
||||
builder: (BuildContext context, Box<Display> displayBox, _) {
|
||||
final Display _display = displayBox.get(
|
||||
LocalDatabaseService.displayKey,
|
||||
defaultValue: Display(),
|
||||
)!;
|
||||
return MaterialApp(
|
||||
/// Add navigator key from Catcher.
|
||||
/// It will be used to navigate user to report page or to show dialog.
|
||||
navigatorKey: Catcher.navigatorKey,
|
||||
key: globalScaffoldKey,
|
||||
navigatorObservers: [routeObserver],
|
||||
localizationsDelegates: S.localizationsDelegates,
|
||||
supportedLocales: S.supportedLocales,
|
||||
locale: _display.languageCode,
|
||||
theme: AppTheme.lightThemeData,
|
||||
darkTheme: AppTheme.darkThemeData,
|
||||
debugShowCheckedModeBanner: false,
|
||||
home: const _Home(),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _Home extends StatelessWidget {
|
||||
const _Home({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: DoubleBackToCloseApp(
|
||||
snackBar: SnackBar(
|
||||
content: Text(S.of(context).tapBackAgainToLeave),
|
||||
),
|
||||
child: const NavigationHomeScreen(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:sanmill/l10n/resources.dart';
|
||||
import 'package:sanmill/services/language_info.dart';
|
||||
|
||||
// TODO: deprecate this thingy. No reason to keep it
|
||||
class Rule {
|
||||
|
|
|
@ -30,7 +30,7 @@ part 'display.g.dart';
|
|||
/// holds the data needed for the Display Settings
|
||||
@HiveType(typeId: 1)
|
||||
@JsonSerializable()
|
||||
@CopyWith()
|
||||
@CopyWith(generateCopyWithNull: true)
|
||||
@immutable
|
||||
class Display {
|
||||
Display({
|
||||
|
@ -57,7 +57,7 @@ class Display {
|
|||
fromJson: LocaleAdapter.colorFromJson,
|
||||
toJson: LocaleAdapter.colorToJson,
|
||||
)
|
||||
final Locale languageCode;
|
||||
final Locale? languageCode;
|
||||
|
||||
@HiveField(1)
|
||||
final bool standardNotationEnabled;
|
||||
|
|
|
@ -20,7 +20,7 @@ import 'package:copy_with_extension/copy_with_extension.dart';
|
|||
import 'package:flutter/foundation.dart' show immutable;
|
||||
import 'package:hive_flutter/adapters.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:sanmill/l10n/resources.dart';
|
||||
import 'package:sanmill/services/language_info.dart';
|
||||
|
||||
part 'rules.g.dart';
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import 'package:flutter/foundation.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:sanmill/generated/flutter_version.dart';
|
||||
import 'package:sanmill/generated/l10n.dart';
|
||||
import 'package:sanmill/generated/intl/l10n.dart';
|
||||
import 'package:sanmill/screens/license_page.dart';
|
||||
import 'package:sanmill/screens/oss_license_page.dart';
|
||||
import 'package:sanmill/shared/constants.dart';
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' show rootBundle;
|
||||
import 'package:sanmill/generated/l10n.dart';
|
||||
import 'package:sanmill/generated/intl/l10n.dart';
|
||||
import 'package:sanmill/shared/constants.dart';
|
||||
|
||||
class EnvironmentVariablesPage extends StatelessWidget {
|
||||
|
|
|
@ -240,8 +240,8 @@ class Board extends StatelessWidget {
|
|||
1
|
||||
];
|
||||
|
||||
final bool ltr =
|
||||
getBidirectionality(context) == Bidirectionality.leftToRight;
|
||||
final bool ltr = Directionality.of(context) == TextDirection.ltr;
|
||||
|
||||
|
||||
if (ltr) {
|
||||
for (final file in ['a', 'b', 'c', 'd', 'e', 'f', 'g']) {
|
||||
|
|
|
@ -23,8 +23,7 @@ import 'dart:async';
|
|||
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:sanmill/generated/l10n.dart';
|
||||
import 'package:sanmill/l10n/resources.dart';
|
||||
import 'package:sanmill/generated/intl/l10n.dart';
|
||||
import 'package:sanmill/main.dart';
|
||||
import 'package:sanmill/mill/game.dart';
|
||||
import 'package:sanmill/mill/position.dart';
|
||||
|
@ -36,7 +35,6 @@ import 'package:sanmill/services/audios.dart';
|
|||
import 'package:sanmill/services/engine/engine.dart';
|
||||
import 'package:sanmill/services/engine/native_engine.dart';
|
||||
import 'package:sanmill/services/storage/storage.dart';
|
||||
import 'package:sanmill/shared/constants.dart';
|
||||
import 'package:sanmill/shared/dialog.dart';
|
||||
import 'package:sanmill/shared/picker.dart';
|
||||
import 'package:sanmill/shared/snack_bar.dart';
|
||||
|
@ -1793,10 +1791,12 @@ class _GamePageState extends State<GamePage>
|
|||
|
||||
_initAnimation();
|
||||
|
||||
LocalDatabaseService.listenPreferences.addListener(() async {
|
||||
await _engine.setOptions();
|
||||
debugPrint("$tag reloaded engine options");
|
||||
});
|
||||
LocalDatabaseService.listenPreferences.addListener(_refeshEngine);
|
||||
}
|
||||
|
||||
Future<void> _refeshEngine() async {
|
||||
await _engine.setOptions();
|
||||
debugPrint("$tag reloaded engine options");
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -1807,7 +1807,7 @@ class _GamePageState extends State<GamePage>
|
|||
ModalRoute.of(context)! as PageRoute<dynamic>,
|
||||
);
|
||||
screenPaddingH = _screenPaddingH;
|
||||
ltr = getBidirectionality(context) == Bidirectionality.leftToRight;
|
||||
ltr = Directionality.of(context) == TextDirection.ltr;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -1851,39 +1851,27 @@ class _GamePageState extends State<GamePage>
|
|||
disposed = true;
|
||||
_engine.shutdown();
|
||||
_animationController.dispose();
|
||||
super.dispose();
|
||||
routeObserver.unsubscribe(this);
|
||||
LocalDatabaseService.listenPreferences.removeListener(_refeshEngine);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> didPush() async {
|
||||
void didPush() {
|
||||
final route = ModalRoute.of(context)!.settings.name;
|
||||
debugPrint('$tag Game Page didPush route: $route');
|
||||
await _engine.setOptions();
|
||||
if (LocalDatabaseService.display.languageCode != Constants.defaultLocale) {
|
||||
S.load(LocalDatabaseService.display.languageCode);
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> didPopNext() async {
|
||||
void didPopNext() {
|
||||
final route = ModalRoute.of(context)!.settings.name;
|
||||
debugPrint('$tag Game Page didPopNext route: $route');
|
||||
await _engine.setOptions();
|
||||
if (LocalDatabaseService.display.languageCode != Constants.defaultLocale) {
|
||||
S.load(LocalDatabaseService.display.languageCode);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> didPushNext() async {
|
||||
void didPushNext() {
|
||||
final route = ModalRoute.of(context)!.settings.name;
|
||||
debugPrint('$tag Game Page didPushNext route: $route');
|
||||
await _engine.setOptions();
|
||||
if (LocalDatabaseService.display.languageCode != Constants.defaultLocale) {
|
||||
S.load(LocalDatabaseService.display.languageCode);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -21,7 +21,7 @@ import 'dart:io';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart' show Box;
|
||||
import 'package:sanmill/generated/l10n.dart';
|
||||
import 'package:sanmill/generated/intl/l10n.dart';
|
||||
import 'package:sanmill/models/preferences.dart';
|
||||
import 'package:sanmill/models/temporary.dart';
|
||||
import 'package:sanmill/screens/env_page.dart';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:sanmill/generated/l10n.dart';
|
||||
import 'package:sanmill/generated/intl/l10n.dart';
|
||||
import 'package:sanmill/services/storage/storage.dart';
|
||||
import 'package:sanmill/shared/theme/app_theme.dart';
|
||||
|
||||
|
|
|
@ -88,8 +88,7 @@ class HomeDrawer extends StatelessWidget {
|
|||
final listItem = items[index];
|
||||
final bool isSelected = screenIndex == listItem.index;
|
||||
|
||||
final bool ltr =
|
||||
getBidirectionality(context) == Bidirectionality.leftToRight;
|
||||
final bool ltr = Directionality.of(context) == TextDirection.ltr;
|
||||
const double radius = 28.0;
|
||||
final animatedBuilder = AnimatedBuilder(
|
||||
animation: iconAnimationController,
|
||||
|
@ -109,11 +108,9 @@ class HomeDrawer extends StatelessWidget {
|
|||
height: 46,
|
||||
decoration: BoxDecoration(
|
||||
color: LocalDatabaseService.colorSettings.drawerHighlightItemColor,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(ltr ? 0 : radius),
|
||||
topRight: Radius.circular(ltr ? radius : 0),
|
||||
bottomLeft: Radius.circular(ltr ? 0 : radius),
|
||||
bottomRight: Radius.circular(ltr ? radius : 0),
|
||||
borderRadius: BorderRadius.horizontal(
|
||||
right: ltr ? const Radius.circular(radius) : Radius.zero,
|
||||
left: !ltr ? const Radius.circular(radius) : Radius.zero,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' show rootBundle;
|
||||
import 'package:sanmill/generated/l10n.dart';
|
||||
import 'package:sanmill/generated/intl/l10n.dart';
|
||||
import 'package:sanmill/shared/constants.dart';
|
||||
|
||||
class LicenseAgreementPage extends StatelessWidget {
|
||||
|
|
|
@ -26,8 +26,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_email_sender/flutter_email_sender.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:sanmill/generated/l10n.dart';
|
||||
import 'package:sanmill/l10n/resources.dart';
|
||||
import 'package:sanmill/generated/intl/l10n.dart';
|
||||
import 'package:sanmill/mill/game.dart';
|
||||
import 'package:sanmill/models/temporary.dart';
|
||||
import 'package:sanmill/screens/about_page.dart';
|
||||
|
@ -45,6 +44,7 @@ part 'package:sanmill/screens/home_drawer.dart';
|
|||
part 'package:sanmill/shared/drawer_controller.dart';
|
||||
|
||||
class NavigationHomeScreen extends StatefulWidget {
|
||||
const NavigationHomeScreen({Key? key}) : super(key: key);
|
||||
@override
|
||||
_NavigationHomeScreenState createState() => _NavigationHomeScreenState();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sanmill/generated/l10n.dart';
|
||||
import 'package:sanmill/generated/intl/l10n.dart';
|
||||
import 'package:sanmill/generated/oss_licenses.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
This file is part of Sanmill.
|
||||
Copyright (C) 2019-2021 The Sanmill developers (see AUTHORS file)
|
||||
|
||||
Sanmill is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Sanmill is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
part of 'package:sanmill/screens/personalization_settings/personalization_settings_page.dart';
|
||||
|
||||
class _LanguagePicker extends StatelessWidget {
|
||||
const _LanguagePicker({
|
||||
Key? key,
|
||||
required this.currentLocale,
|
||||
required this.onChanged,
|
||||
}) : super(key: key);
|
||||
|
||||
final Locale? currentLocale;
|
||||
final Function(Locale?) onChanged;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final languageColumn = Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
RadioListTile<Locale?>(
|
||||
activeColor: AppTheme.switchListTileActiveColor,
|
||||
title: Text(S.of(context).defaultLanguage),
|
||||
groupValue: currentLocale,
|
||||
value: null,
|
||||
onChanged: onChanged,
|
||||
),
|
||||
const ListItemDivider(),
|
||||
for (var i in languageCodeToStrings.keys)
|
||||
RadioListTile<Locale>(
|
||||
activeColor: AppTheme.switchListTileActiveColor,
|
||||
title: Text(languageCodeToStrings[i]!),
|
||||
groupValue: currentLocale,
|
||||
value: Locale(i),
|
||||
onChanged: onChanged,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
return AlertDialog(
|
||||
scrollable: true,
|
||||
content: languageColumn,
|
||||
);
|
||||
}
|
||||
}
|
|
@ -19,26 +19,28 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart' show Box;
|
||||
import 'package:sanmill/generated/l10n.dart';
|
||||
import 'package:sanmill/l10n/resources.dart';
|
||||
import 'package:sanmill/generated/intl/l10n.dart';
|
||||
import 'package:sanmill/models/color.dart';
|
||||
import 'package:sanmill/models/display.dart';
|
||||
import 'package:sanmill/services/language_info.dart';
|
||||
import 'package:sanmill/services/storage/storage.dart';
|
||||
import 'package:sanmill/shared/constants.dart';
|
||||
import 'package:sanmill/shared/list_item_divider.dart';
|
||||
import 'package:sanmill/shared/settings/settings_card.dart';
|
||||
import 'package:sanmill/shared/settings/settings_list_tile.dart';
|
||||
import 'package:sanmill/shared/settings/settings_switch_list_tile.dart';
|
||||
import 'package:sanmill/shared/theme/app_theme.dart';
|
||||
|
||||
part 'package:sanmill/screens/personalization_settings/color_selector_list_tile.dart';
|
||||
part 'package:sanmill/screens/personalization_settings/animation_duration_slider.dart';
|
||||
part 'package:sanmill/screens/personalization_settings/board_top_slider.dart';
|
||||
part 'package:sanmill/screens/personalization_settings/board_boarder_line_width_slider.dart';
|
||||
part 'package:sanmill/screens/personalization_settings/board_inner_line_width_slider.dart';
|
||||
part 'package:sanmill/screens/personalization_settings/board_top_slider.dart';
|
||||
part 'package:sanmill/screens/personalization_settings/color_selector_list_tile.dart';
|
||||
part 'package:sanmill/screens/personalization_settings/font_size_slider.dart';
|
||||
part 'package:sanmill/screens/personalization_settings/point_width_slider.dart';
|
||||
part 'package:sanmill/screens/personalization_settings/piece_width_slider.dart';
|
||||
part 'package:sanmill/screens/personalization_settings/point_style_modal.dart';
|
||||
part 'package:sanmill/screens/personalization_settings/point_width_slider.dart';
|
||||
part 'package:sanmill/screens/personalization_settings/language_picker.dart';
|
||||
|
||||
class PersonalizationSettingsPage extends StatelessWidget {
|
||||
void setBoardBorderLineWidth(BuildContext context) => showModalBottomSheet(
|
||||
|
@ -97,7 +99,11 @@ class PersonalizationSettingsPage extends StatelessWidget {
|
|||
void langCallback(BuildContext context, Display _display, [Locale? locale]) {
|
||||
Navigator.pop(context);
|
||||
|
||||
LocalDatabaseService.display = _display.copyWith(languageCode: locale);
|
||||
if (locale == null) {
|
||||
LocalDatabaseService.display = _display.copyWithNull(languageCode: true);
|
||||
} else {
|
||||
LocalDatabaseService.display = _display.copyWith(languageCode: locale);
|
||||
}
|
||||
|
||||
debugPrint("[config] languageCode = $locale");
|
||||
}
|
||||
|
@ -223,11 +229,14 @@ class PersonalizationSettingsPage extends StatelessWidget {
|
|||
titleString: S.of(context).language,
|
||||
trailingString: LocalDatabaseService.display.languageCode !=
|
||||
Constants.defaultLocale
|
||||
? languageCodeToStrings[_display.languageCode]!.languageName
|
||||
? languageCodeToStrings[_display.languageCode]
|
||||
: '',
|
||||
onTap: () => setLanguage(
|
||||
context,
|
||||
(locale) => langCallback(context, _display, locale),
|
||||
onTap: () => showDialog(
|
||||
context: context,
|
||||
builder: (_) => _LanguagePicker(
|
||||
currentLocale: _display.languageCode,
|
||||
onChanged: (locale) => langCallback(context, _display, locale),
|
||||
),
|
||||
),
|
||||
),
|
||||
SettingsSwitchListTile(
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart' show Box;
|
||||
import 'package:sanmill/generated/l10n.dart';
|
||||
import 'package:sanmill/generated/intl/l10n.dart';
|
||||
import 'package:sanmill/models/rules.dart';
|
||||
import 'package:sanmill/services/storage/storage.dart';
|
||||
import 'package:sanmill/shared/settings/settings_card.dart';
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
This file is part of Sanmill.
|
||||
Copyright (C) 2019-2021 The Sanmill developers (see AUTHORS file)
|
||||
|
||||
Sanmill is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Sanmill is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_ar.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_bg.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_bn.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_cs.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_da.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_de.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_el.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_en.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_es.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_et.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_fa.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_fi.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_fr.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_gu.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_hi.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_hr.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_hu.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_id.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_it.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_ja.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_kn.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_ko.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_lt.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_lv.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_mk.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_ms.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_nl.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_nn.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_pl.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_pt.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_ro.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_ru.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_sk.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_sl.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_sq.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_sr.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_sv.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_te.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_th.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_tr.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_uz.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_vi.dart';
|
||||
import 'package:sanmill/generated/intl/l10n_zh.dart';
|
||||
|
||||
Map<String, String> languageCodeToStrings = {
|
||||
'ar': SAr().languageName,
|
||||
'bg': SBg().languageName,
|
||||
'bn': SBn().languageName,
|
||||
'cs': SCs().languageName,
|
||||
'da': SDa().languageName,
|
||||
'de': SDe().languageName,
|
||||
'de_CH': SDeCh().languageName,
|
||||
'el': SEl().languageName,
|
||||
'en': SEn().languageName,
|
||||
'es': SEs().languageName,
|
||||
'et': SEt().languageName,
|
||||
'fa': SFa().languageName,
|
||||
'fi': SFi().languageName,
|
||||
'fr': SFr().languageName,
|
||||
'gu': SGu().languageName,
|
||||
'hi': SHi().languageName,
|
||||
'hr': SHr().languageName,
|
||||
'hu': SHu().languageName,
|
||||
'id': SId().languageName,
|
||||
'it': SIt().languageName,
|
||||
'ja': SJa().languageName,
|
||||
'kn': SKn().languageName,
|
||||
'ko': SKo().languageName,
|
||||
'lt': SLt().languageName,
|
||||
'lv': SLv().languageName,
|
||||
'mk': SMk().languageName,
|
||||
'ms': SMs().languageName,
|
||||
'nl': SNl().languageName,
|
||||
'nn': SNn().languageName,
|
||||
'pl': SPl().languageName,
|
||||
'pt': SPt().languageName,
|
||||
'ro': SRo().languageName,
|
||||
'ru': SRu().languageName,
|
||||
'sk': SSk().languageName,
|
||||
'sl': SSl().languageName,
|
||||
'sq': SSq().languageName,
|
||||
'sr': SSr().languageName,
|
||||
'sv': SSv().languageName,
|
||||
'te': STe().languageName,
|
||||
'th': STh().languageName,
|
||||
'tr': STr().languageName,
|
||||
'uz': SUz().languageName,
|
||||
'vi': SVi().languageName,
|
||||
'zh': SZh().languageName,
|
||||
'zh_Hant': SZhHant().languageName,
|
||||
};
|
||||
|
||||
String specialCountryAndRegion = "";
|
||||
|
||||
void setSpecialCountryAndRegion(BuildContext context) {
|
||||
final Locale currentLocale = Localizations.localeOf(context);
|
||||
|
||||
switch (currentLocale.countryCode) {
|
||||
case "IR":
|
||||
specialCountryAndRegion = "Iran";
|
||||
break;
|
||||
default:
|
||||
specialCountryAndRegion = "";
|
||||
break;
|
||||
}
|
||||
|
||||
debugPrint("Set Special Country and Region to $specialCountryAndRegion.");
|
||||
}
|
|
@ -24,7 +24,7 @@ import 'package:json_annotation/json_annotation.dart' show JsonSerializable;
|
|||
///
|
||||
/// This adapter provides helper functions to be used with [JsonSerializable]
|
||||
/// and is a general [TypeAdapter] to be used with Hive [Box]ses
|
||||
class LocaleAdapter extends TypeAdapter<Locale> {
|
||||
class LocaleAdapter extends TypeAdapter<Locale?> {
|
||||
@override
|
||||
final typeId = 7;
|
||||
|
||||
|
@ -35,10 +35,16 @@ class LocaleAdapter extends TypeAdapter<Locale> {
|
|||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, Locale obj) {
|
||||
writer.writeString(obj.languageCode);
|
||||
void write(BinaryWriter writer, Locale? obj) {
|
||||
if (obj != null) {
|
||||
writer.writeString(obj.languageCode);
|
||||
}
|
||||
}
|
||||
|
||||
static String colorToJson(Locale locale) => locale.languageCode;
|
||||
static Locale colorFromJson(String value) => Locale(value);
|
||||
static String? colorToJson(Locale? locale) => locale?.languageCode;
|
||||
static Locale? colorFromJson(String? value) {
|
||||
if (value != null) {
|
||||
return Locale(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ class LocalDatabaseService {
|
|||
|
||||
/// initilizes the [Display] reference
|
||||
static Future<void> _initDisplay() async {
|
||||
Hive.registerAdapter<Locale>(LocaleAdapter());
|
||||
Hive.registerAdapter<Locale?>(LocaleAdapter());
|
||||
Hive.registerAdapter<Display>(DisplayAdapter());
|
||||
_displayBox = await Hive.openBox<Display>(_displayBoxName);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class Constants {
|
|||
"assets/files/environment_variables.txt";
|
||||
static const String gplLicenseFilename = "assets/licenses/GPL-3.0.txt";
|
||||
|
||||
static const Locale defaultLocale = Locale("Default");
|
||||
static const Locale? defaultLocale = null;
|
||||
|
||||
static const String feedbackSubjectPrefix = "[$appName] $projectName ";
|
||||
static const String feedbackSubjectSuffix = " Feedback";
|
||||
|
|
|
@ -23,7 +23,7 @@ import 'package:devicelocale/devicelocale.dart';
|
|||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:sanmill/generated/l10n.dart';
|
||||
import 'package:sanmill/generated/intl/l10n.dart';
|
||||
import 'package:sanmill/services/storage/storage.dart';
|
||||
import 'package:sanmill/shared/constants.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
|
|
@ -120,8 +120,7 @@ class _DrawerControllerState extends State<DrawerController>
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bool ltr =
|
||||
getBidirectionality(context) == Bidirectionality.leftToRight;
|
||||
final bool ltr = Directionality.of(context) == TextDirection.ltr;
|
||||
|
||||
// this just menu and arrow icon animation
|
||||
final inkWell = InkWell(
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_picker/flutter_picker.dart';
|
||||
import 'package:sanmill/generated/l10n.dart';
|
||||
import 'package:sanmill/generated/intl/l10n.dart';
|
||||
import 'package:sanmill/services/storage/storage.dart';
|
||||
import 'package:sanmill/shared/theme/app_theme.dart';
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sanmill/l10n/resources.dart';
|
||||
import 'package:sanmill/services/storage/storage.dart';
|
||||
import 'package:sanmill/shared/theme/app_theme.dart';
|
||||
|
||||
|
@ -40,8 +39,8 @@ class SettingsListTile extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bool ltr =
|
||||
getBidirectionality(context) == Bidirectionality.leftToRight;
|
||||
final bool ltr = Directionality.of(context) == TextDirection.ltr;
|
||||
|
||||
return ListTile(
|
||||
title: Text(
|
||||
titleString,
|
||||
|
|
|
@ -47,6 +47,7 @@ dependencies:
|
|||
dev_dependencies:
|
||||
build_runner: ^2.1.4
|
||||
copy_with_extension_gen: ^2.0.3
|
||||
flutter_gen_runner: ^4.0.0
|
||||
flutter_oss_licenses: ^1.0.1
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
|
|
@ -17,35 +17,29 @@
|
|||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:sanmill/generated/l10n.dart';
|
||||
import 'package:sanmill/generated/intl/l10n.dart';
|
||||
import 'package:sanmill/screens/navigation_home_screen.dart';
|
||||
|
||||
void main() {
|
||||
Widget makeTestableWidget({required Widget child, required Locale locale}) {
|
||||
return MaterialApp(
|
||||
localizationsDelegates: const <LocalizationsDelegate<dynamic>>[
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
localizationsDelegates: S.localizationsDelegates,
|
||||
supportedLocales: S.supportedLocales,
|
||||
locale: locale,
|
||||
home: child,
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('Widget', (WidgetTester tester) async {
|
||||
final NavigationHomeScreen screen = NavigationHomeScreen();
|
||||
const _screen = NavigationHomeScreen();
|
||||
await tester.pumpWidget(
|
||||
makeTestableWidget(
|
||||
child: screen,
|
||||
child: _screen,
|
||||
locale: const Locale('en'),
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
expect(find.text(S.current.appName), findsOneWidget);
|
||||
expect(find.text('Mill'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue