Локализация экрана настроек, удалил лишние конфигурации сборки

This commit is contained in:
Ivan Murashov
2017-09-11 11:41:20 +03:00
parent 0dc8ab5da0
commit 0dde204dcd
12 changed files with 131 additions and 57 deletions

View File

@@ -1,3 +1,4 @@
import 'package:checker/strings.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:intl/intl.dart';
@@ -26,7 +27,6 @@ class _SplashScreenState extends BaseState<SplashScreen> {
helper.getSettings().then((info) {
if (info == null) {
platform.invokeMethod('getLocale').then((locale) {
Intl.defaultLocale = locale;
platform.invokeMethod('getCurrency').then((currency) {
helper.createAppInfo(locale, currency).then((_) {
showNext();
@@ -34,7 +34,12 @@ class _SplashScreenState extends BaseState<SplashScreen> {
});
});
} else {
showNext();
helper.getLocale().then((locale) {
Intl.defaultLocale = locale;
StringsLocalization.load(locale).then((l) {
showNext();
});
});
}
});
}
@@ -90,7 +95,7 @@ class _SplashScreenState extends BaseState<SplashScreen> {
// необходимо запустить регистрацию кассы.
if (token == null) {
await helper.close();
pushRoute(context, new RegistrationScreen());
pushRouteReplacement(context, new RegistrationScreen());
} else {
if (await platform.invokeMethod('isOnline')) {
checkTokenStatus(token).then((statusResponse) {
@@ -115,7 +120,7 @@ class _SplashScreenState extends BaseState<SplashScreen> {
if (code == 404) {
helper.clear().then((result) {
helper.close().then((_) {
pushRoute(context, new RegistrationScreen());
pushRouteReplacement(context, new RegistrationScreen());
});
});
} else {
@@ -148,7 +153,7 @@ class _SplashScreenState extends BaseState<SplashScreen> {
createToken(merchantID, posID).then((response) {
if (response.statusCode == 409) {
helper.close();
pushRoute(context, new FinishRegistrationScreen());
pushRouteReplacement(context, new FinishRegistrationScreen());
} else if (response.statusCode == 201) {
clearToken(response, helper);
}
@@ -163,7 +168,7 @@ class _SplashScreenState extends BaseState<SplashScreen> {
deleteToken(parsedMap['token']).then((_) {
helper.close();
Navigator.of(context).pop(); // Убираем текущий route
pushRoute(context, new RegistrationScreen()); // Запускаем регистрацию
pushRouteReplacement(context, new RegistrationScreen()); // Запускаем регистрацию
}).catchError((error) {
helper.close();
print(error.toString());