Название приложения в шапке не null, необходимо проверить исправление падений при возвращении на экран сканнера с экрана настроек

This commit is contained in:
Ivan Murashov
2017-09-25 19:16:26 +03:00
parent 8c07485061
commit 9f2bf14199
3 changed files with 26 additions and 16 deletions

View File

@@ -86,7 +86,6 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
}); });
} else { } else {
String token = await helper.getToken(); String token = await helper.getToken();
helper.close();
// Канал ловит вызовы методов из "нативной" части приложения. // Канал ловит вызовы методов из "нативной" части приложения.
// Могут быть вызваны либо logout либо faq, либо purchase. // Могут быть вызваны либо logout либо faq, либо purchase.
if (token != null) { if (token != null) {
@@ -96,10 +95,14 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
} else if (call.method == 'faq') { } else if (call.method == 'faq') {
faq(context, true); faq(context, true);
} else if(call.method == 'settings') { } else if(call.method == 'settings') {
if (helper == null) {
helper = new SqliteHelper(); helper = new SqliteHelper();
helper.open().then((_) { helper.open().then((_) {
pushRoute(context, new SettingsScreen(helper, app, true)); pushRoute(context, new SettingsScreen(helper, app, true));
}); });
} else {
pushRoute(context, new SettingsScreen(helper, app, true));
}
} else { } else {
String userString = call.arguments[0]; String userString = call.arguments[0];
String card = call.arguments[1]; String card = call.arguments[1];
@@ -114,6 +117,8 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
} }
}); });
helper.close().then((_){
helper = null;
platform.invokeMethod('getEndpoint').then((endpoint) { platform.invokeMethod('getEndpoint').then((endpoint) {
platform.invokeMethod('getAppToken').then((appToken) async { platform.invokeMethod('getAppToken').then((appToken) async {
platform.invokeMethod('startScanner', { platform.invokeMethod('startScanner', {
@@ -127,7 +132,7 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
}); });
}); });
}); });
});
} }
} }
} }

View File

@@ -1,5 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
const String appName = "Autobonus";
// Assets // Assets
const String logout_png = 'assets/logout.png'; const String logout_png = 'assets/logout.png';
const String help_png = 'assets/help.png'; const String help_png = 'assets/help.png';

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:checker/screens/splash.dart'; import 'package:checker/screens/splash.dart';
import 'package:checker/consts.dart';
/// Точка входа в приложение. /// Точка входа в приложение.
void main() { void main() {
@@ -9,6 +10,8 @@ void main() {
class Checker extends StatelessWidget { class Checker extends StatelessWidget {
@override Widget build(BuildContext context) { @override Widget build(BuildContext context) {
return new MaterialApp(home: new SplashScreen()); return new MaterialApp(
title: appName,
home: new SplashScreen());
} }
} }