添加 扫码页面

hmxc
张萌 4 years ago
parent 496e0edee4
commit 664afd6781

@ -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 ? '开始巡检' : '立即扫码')

@ -31,9 +31,9 @@ class _InspectionManagePageState extends State<InspectionManagePage>
UserProvider _userProvider =
Provider.of<UserProvider>(context, listen: false);
if (_userProvider.infoModel.canOperation) {
return ['待巡检', '已巡检', '巡检中', '未巡检'];
return ['待巡检', '已巡检', '巡检中', '未巡检', '全部'];
} else {
return ['待巡检', '已巡检', '巡检中', '未巡检'];
return ['待巡检', '已巡检', '巡检中', '未巡检', '全部'];
}
}
@ -63,7 +63,7 @@ class _InspectionManagePageState extends State<InspectionManagePage>
children: List.generate(
_tabs.length,
(index) => InspectionMangeView(
inspectionStatus: index + 1,
inspectionStatus: (index + 1 < 5) ? (index + 1) : 0,
),
),
),

@ -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<QrScannerPage> {
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;
});
});
}),
);
}
}
Loading…
Cancel
Save