Небольшие исправления
This commit is contained in:
@@ -12,28 +12,23 @@ class SplashScreen extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
// Splash скрин зависает мимнимум на 1 секунду.
|
||||
// После этого начинается проверка токена.
|
||||
|
||||
new Future.delayed(const Duration(milliseconds: 1000), () {
|
||||
pushRoute(context, new PurchaseScreen());
|
||||
// _showNextScreen(context);
|
||||
// Появляется splash screen, проверяется токен.
|
||||
new Future.delayed(const Duration(milliseconds: 500), () {
|
||||
showNextScreen(context);
|
||||
});
|
||||
|
||||
return new Image.asset(splash_png, fit: BoxFit.cover);
|
||||
}
|
||||
|
||||
/// Запуск следующего экрана приложения.
|
||||
_showNextScreen(BuildContext context) async {
|
||||
showNextScreen(BuildContext context) async {
|
||||
|
||||
const platform = const MethodChannel('com.dinect.checker/instance_id');
|
||||
token = await platform.invokeMethod('getToken');
|
||||
print('token: $token');
|
||||
|
||||
// В случае, если в приложении отсутствует токен,
|
||||
// необходимо запустить регистрацию кассы.
|
||||
|
||||
if (token == null) {
|
||||
pushRoute(context, new RegistrationScreen());
|
||||
} else {
|
||||
@@ -41,6 +36,7 @@ class SplashScreen extends StatelessWidget {
|
||||
checkToken(context).then((response) {
|
||||
|
||||
print(response.body);
|
||||
|
||||
Map parsedMap = JSON.decode(response.body);
|
||||
bool active = parsedMap['active'];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user