fmk
3 years ago
12 changed files with 906 additions and 737 deletions
@ -0,0 +1,53 @@
|
||||
|
||||
|
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/view_widget/request_permission.dart'; |
||||
import 'package:permission_handler/permission_handler.dart'; |
||||
|
||||
class Scan { |
||||
|
||||
static toScan(context, id, tenantCode, storeName) async { |
||||
if (await Permission.camera.isPermanentlyDenied) { |
||||
showCupertinoDialog( |
||||
context: context, |
||||
builder: (context) { |
||||
return RequestPermission( |
||||
"assets/image/icon_camera_permission_tips.png", |
||||
S.of(context).ninxiangjiquanxianweikaiqi, |
||||
S.of(context).weilekaipaizhaoxuanzhetouxiang, |
||||
S.of(context).kaiqiquanxian, |
||||
(result) async { |
||||
if (result) { |
||||
await openAppSettings(); |
||||
} |
||||
}, |
||||
heightRatioWithWidth: 0.82, |
||||
); |
||||
}); |
||||
} else if (await Permission.camera.isGranted) { |
||||
var result = await Navigator.of(context).pushNamed('/router/qr_scan'); |
||||
|
||||
if (result != null && result != "") { |
||||
Uri uri = Uri.parse(result); |
||||
String table = uri.queryParameters["tableId"]; |
||||
if (table != null && table != "") { |
||||
int tableId = int.tryParse(table); |
||||
Navigator.of(context).pushNamed( |
||||
'/router/store_order', |
||||
arguments: { |
||||
"id": id, |
||||
"tenant": tenantCode, |
||||
"storeName": storeName, |
||||
"tableId": tableId, |
||||
}, |
||||
); |
||||
} |
||||
} |
||||
} else { |
||||
await Permission.camera.request(); |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue