Локализация экрана настроек, удалил лишние конфигурации сборки
This commit is contained in:
@@ -14,15 +14,19 @@ import 'strings.dart';
|
||||
const platform = const MethodChannel('com.dinect.checker/instance_id');
|
||||
|
||||
// Метод обеспечивает замену текущего объекта route новым.
|
||||
pushRoute(BuildContext context, Widget widget) {
|
||||
pushRouteReplacement(BuildContext context, Widget widget) {
|
||||
var route = new MaterialPageRoute<Null>(builder: (BuildContext context) => widget);
|
||||
Navigator.of(context).pushReplacement(route);
|
||||
}
|
||||
|
||||
pushRoute(BuildContext context, Widget widget) {
|
||||
var route = new MaterialPageRoute<Null>(builder: (BuildContext context) => widget);
|
||||
Navigator.of(context).push(route);
|
||||
}
|
||||
|
||||
// Добавление route, с возможностью вернуться к предыдущему экрану.
|
||||
faq(BuildContext context, bool returnToScanner) {
|
||||
var route = new MaterialPageRoute<Null>(builder: (BuildContext context) => new FAQScreen(returnToScanner));
|
||||
Navigator.of(context).push(route);
|
||||
pushRoute(context, new FAQScreen(returnToScanner));
|
||||
}
|
||||
|
||||
// В методе отправляется запрос на удаление токена кассы, очищаются SharedPreferences приложения.
|
||||
@@ -32,14 +36,14 @@ logout(BuildContext context) async {
|
||||
await helper.open();
|
||||
String token = await helper.getToken();
|
||||
|
||||
VoidCallback positiveCalback = () {
|
||||
VoidCallback positiveCallback = () {
|
||||
if (token != null) {
|
||||
deleteToken(token).then((response) {
|
||||
print(response.body);
|
||||
platform.invokeMethod('removeKeys').then((result) {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
pushRoute(context, new RegistrationScreen()); // Запускаем регистрацию
|
||||
pushRouteReplacement(context, new RegistrationScreen()); // Запускаем регистрацию
|
||||
});
|
||||
}).catchError((error) {
|
||||
print(error.toString());
|
||||
@@ -50,7 +54,7 @@ logout(BuildContext context) async {
|
||||
}
|
||||
};
|
||||
|
||||
showYesNoDialog(context, StringsLocalization.confirmation(), StringsLocalization.askChangeStore(), positiveCalback);
|
||||
showYesNoDialog(context, StringsLocalization.confirmation(), StringsLocalization.askChangeStore(), positiveCallback);
|
||||
}
|
||||
|
||||
forceLogout(String token , BuildContext context) async {
|
||||
@@ -62,7 +66,7 @@ forceLogout(String token , BuildContext context) async {
|
||||
helper.clear().then((_) {
|
||||
helper.close().then((_) {
|
||||
Navigator.of(context).pop();
|
||||
pushRoute(context, new RegistrationScreen()); // Запускаем регистрацию
|
||||
pushRouteReplacement(context, new RegistrationScreen()); // Запускаем регистрацию
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -122,3 +126,19 @@ showYesNoDialog(BuildContext context, String title, String content, VoidCallback
|
||||
child: new Text(StringsLocalization.yes()),
|
||||
onPressed: positiveCallback)]));
|
||||
}
|
||||
|
||||
getCurrencyTitle(int code) {
|
||||
switch(code) {
|
||||
case 643: return StringsLocalization.ruble();
|
||||
case 840: return StringsLocalization.dollar();
|
||||
case 980: return StringsLocalization.hryvna();
|
||||
}
|
||||
}
|
||||
|
||||
getLocaleTitle(String code) {
|
||||
switch(code) {
|
||||
case 'ru': return StringsLocalization.russian();
|
||||
case 'en': return StringsLocalization.english();
|
||||
case 'ua': return StringsLocalization.ukrainian();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user