|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
...
|
...
|
@@ -14,9 +16,11 @@ import 'package:one_key/widgets/h_empty_view.dart'; |
|
|
|
import 'package:one_key/widgets/round_button.dart';
|
|
|
|
import 'package:one_key/widgets/system_app_bar.dart';
|
|
|
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:barcode_scan2/barcode_scan2.dart';
|
|
|
|
|
|
|
|
import '../../app.dart';
|
|
|
|
import '../../provider/marketing_center_provider.dart';
|
|
|
|
import '../../utils/dialog_util.dart';
|
|
|
|
import '../../utils/misc.dart';
|
|
...
|
...
|
@@ -124,6 +128,18 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { |
|
|
|
|
|
|
|
Future<void> _scan() async {
|
|
|
|
try {
|
|
|
|
//全局提示权限使用目的
|
|
|
|
if (Platform.isAndroid) {
|
|
|
|
PermissionStatus permissionStatus = await Permission.camera.status;
|
|
|
|
|
|
|
|
if (permissionStatus != PermissionStatus.permanentlyDenied) {
|
|
|
|
//全局提示权限使用目的
|
|
|
|
BuildContext context = App.navigatorKey.currentState.overlay.context;
|
|
|
|
DialogUtil.showAuthorityDestination(
|
|
|
|
context, 'h_camera', '相机权限使用说明', '用于扫描二维码进行优惠券核销');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
final result = await BarcodeScanner.scan(
|
|
|
|
options: ScanOptions(
|
|
|
|
strings: {'cancel': '退出', 'flash_on': '开闪光灯', 'flash_off': '关闪光灯'},
|
...
|
...
|
|