ios added phone/card switch

This commit is contained in:
Semyon Babushkin
2017-11-23 16:46:40 +03:00
parent 1f6fe22b82
commit 857154faf8
21 changed files with 168 additions and 89 deletions

View File

@@ -104,8 +104,18 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
} else if (call.method == 'findUserAndPurchase') {
var userResponse;
print(call.arguments[1]);
try {
userResponse = await getUserByCard(call.arguments[0],token);
switch (call.arguments[1]) {
case 'card':
userResponse = await getUserByCard(call.arguments[0],token);
break;
case 'phone':
userResponse = await getUserByPhone(call.arguments[0],token);
break;
}
} catch (error) {
print(error.toString());
}
@@ -127,13 +137,8 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
print(userString);
print(card);
pushRoute(context, new PurchaseScreen(helper, app, JSON.encode(users[0]), card));
// var route = new MaterialPageRoute<Null>(
// builder: (BuildContext context) =>
// new PurchaseScreen(helper, app,));
// while (Navigator.of(context).canPop()) {
// Navigator.of(context).pop();
// }
// Navigator.of(context).pushReplacement(route);
} else {
throw new FlutterError("Users not found");
}