From 664afd6781ced669a202c2ac66b9b7a4741e6ac1 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Mon, 29 Mar 2021 13:45:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E6=89=AB=E7=A0=81?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inspection_manage_details_page.dart | 6 ++- .../inspection_manage_page.dart | 6 +-- .../inspection_manage/qr_scanner_page.dart | 46 +++++++++++++++++++ 3 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 lib/ui/manage_pages/inspection_manage/qr_scanner_page.dart diff --git a/lib/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart b/lib/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart index 999460c..75ee982 100644 --- a/lib/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart +++ b/lib/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart @@ -2,6 +2,7 @@ import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/models/manager/inspection/inspection_detail_model.dart'; import 'package:aku_community_manager/models/manager/inspection/inspection_point_model.dart'; +import 'package:aku_community_manager/ui/manage_pages/inspection_manage/qr_scanner_page.dart'; import 'package:aku_community_manager/ui/sub_pages/manage_func.dart'; import 'package:aku_community_manager/utils/network/base_model.dart'; import 'package:aku_community_manager/utils/network/net_util.dart'; @@ -11,6 +12,7 @@ import 'package:common_utils/common_utils.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; import 'package:aku_community_manager/utils/extension/list_extension.dart'; import 'package:aku_community_manager/style/app_style.dart'; @@ -137,7 +139,9 @@ class _InspectionManageDetailsPageState BotToast.showText(text: _baseModel.message); } } - : () {}, + : () { + Get.to(() => QrScannerPage()); + }, padding: EdgeInsets.symmetric(vertical: 26.w), color: kPrimaryColor, child: (_detailModel.status == 1 ? '开始巡检' : '立即扫码') diff --git a/lib/ui/manage_pages/inspection_manage/inspection_manage_page.dart b/lib/ui/manage_pages/inspection_manage/inspection_manage_page.dart index 151d8b1..c20d207 100644 --- a/lib/ui/manage_pages/inspection_manage/inspection_manage_page.dart +++ b/lib/ui/manage_pages/inspection_manage/inspection_manage_page.dart @@ -31,9 +31,9 @@ class _InspectionManagePageState extends State UserProvider _userProvider = Provider.of(context, listen: false); if (_userProvider.infoModel.canOperation) { - return ['待巡检', '已巡检', '巡检中', '未巡检']; + return ['待巡检', '已巡检', '巡检中', '未巡检', '全部']; } else { - return ['待巡检', '已巡检', '巡检中', '未巡检']; + return ['待巡检', '已巡检', '巡检中', '未巡检', '全部']; } } @@ -63,7 +63,7 @@ class _InspectionManagePageState extends State children: List.generate( _tabs.length, (index) => InspectionMangeView( - inspectionStatus: index + 1, + inspectionStatus: (index + 1 < 5) ? (index + 1) : 0, ), ), ), diff --git a/lib/ui/manage_pages/inspection_manage/qr_scanner_page.dart b/lib/ui/manage_pages/inspection_manage/qr_scanner_page.dart new file mode 100644 index 0000000..3408163 --- /dev/null +++ b/lib/ui/manage_pages/inspection_manage/qr_scanner_page.dart @@ -0,0 +1,46 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:flutter/material.dart'; +import 'package:qr_code_scanner/qr_code_scanner.dart'; + +class QrScannerPage extends StatefulWidget { + QrScannerPage({Key key}) : super(key: key); + + @override + _QrScannerPageState createState() => _QrScannerPageState(); +} + +class _QrScannerPageState extends State { + GlobalKey _qrKey = GlobalKey(debugLabel: 'QR'); + QRViewController _qrViewController; + Barcode result; + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + _qrViewController?.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + body: QRView( + key: _qrKey, + overlay: QrScannerOverlayShape( + borderColor: kPrimaryColor, + ), + onQRViewCreated: (QRViewController viewController) { + _qrViewController = viewController; + viewController.scannedDataStream.listen((event) { + setState(() { + result = event; + }); + }); + }), + ); + } +}