Navigation between screens without previous states showing.
This commit is contained in:
@@ -28,13 +28,28 @@ class SplashScreen extends BaseScreen {
|
||||
class _SplashScreenState extends BaseState<SplashScreen> {
|
||||
|
||||
_SplashScreenState(SqliteHelper helper, String app) : super(helper, app);
|
||||
bool a = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
||||
print('init state!');
|
||||
|
||||
new Future.delayed(const Duration(milliseconds: 1000), () {
|
||||
showNextScreen();
|
||||
a = true;
|
||||
});
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext ctx) {
|
||||
new Future.delayed(const Duration(milliseconds: 1000), () {
|
||||
showNextScreen();
|
||||
});
|
||||
return getScreenContent();
|
||||
return a ? new Container(
|
||||
decoration: new BoxDecoration(
|
||||
image: new DecorationImage(
|
||||
image: new ExactAssetImage(Resources.getSplash(nullq)),
|
||||
fit: BoxFit.cover))) : getScreenContent();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -151,6 +166,7 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
||||
// Канал ловит вызовы методов из "нативной" части приложения.
|
||||
// Могут быть вызваны либо exit либо faq, либо purchase.
|
||||
platform.setMethodCallHandler((MethodCall call) {
|
||||
print(this.toString());
|
||||
if (call.method == 'findUser') {
|
||||
String cardPhone = call.arguments[0];
|
||||
var userResponse = getUser(call.arguments[1], cardPhone, token);
|
||||
@@ -190,18 +206,7 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
||||
String card = call.arguments[1];
|
||||
print('$userString, $card');
|
||||
|
||||
new Future.delayed(const Duration(milliseconds: 200), () {
|
||||
var route = new MaterialPageRoute<bool>(
|
||||
builder: (BuildContext context) => new PurchaseScreen(helper, app, userString, card),
|
||||
fullscreenDialog: true);
|
||||
Navigator.of(context).push(route).then((b) {
|
||||
if (b) {
|
||||
setState(() {
|
||||
print('restart scanner!');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
startScanner(token, userString, card);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -221,6 +226,17 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
||||
});
|
||||
}
|
||||
|
||||
startScanner(String token, String userString, String card) {
|
||||
new Future.delayed(const Duration(milliseconds: 200), () {
|
||||
var route = new MaterialPageRoute<bool>(
|
||||
builder: (BuildContext context) => new PurchaseScreen(helper, app, userString, card), fullscreenDialog: true);
|
||||
Navigator.of(context).push(route).then((b) {
|
||||
print('purchase closed: $b');
|
||||
_initAndStartScanner(context, app, token, helper);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Future<Response> getUser(String type, String cardPhone, String token) {
|
||||
try {
|
||||
switch (type) {
|
||||
|
||||
Reference in New Issue
Block a user