更新扫一扫
This commit is contained in:
@@ -90,10 +90,40 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
|
||||
themeController.currentColor.sc16.withOpacity(0.1),
|
||||
borderRadius: 0.rpx,
|
||||
onTap: () {
|
||||
_hidePopup();
|
||||
_popupEntry?.remove();
|
||||
_popupEntry = null;
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: "待开发功能".tr,
|
||||
// );
|
||||
Get.toNamed("/qrView");
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'扫一扫.标题'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 35.rpx),
|
||||
ClickableContainer(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.rpx),
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor:
|
||||
themeController.currentColor.sc16.withOpacity(0.1),
|
||||
borderRadius: 0.rpx,
|
||||
onTap: () {
|
||||
_popupEntry?.remove();
|
||||
_popupEntry = null;
|
||||
BlueteethBindController blueteethBindController =
|
||||
Get.find();
|
||||
blueteethBindController.returnPage = 1;
|
||||
blueteethBindController.returnPage = 0;
|
||||
Get.toNamed("/deviceType");
|
||||
},
|
||||
child: Container(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:img_picker/img_picker.dart';
|
||||
import 'package:mobile_scanner/mobile_scanner.dart';
|
||||
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
||||
@@ -22,6 +23,7 @@ class _MobileScannerTestPageState extends State<MobileScannerTestPage>
|
||||
with TickerProviderStateMixin {
|
||||
String? scannedText;
|
||||
bool isScanning = true;
|
||||
bool isTorchOn = false;
|
||||
|
||||
late AnimationController _controller;
|
||||
late Animation<double> _animation;
|
||||
@@ -87,7 +89,6 @@ class _MobileScannerTestPageState extends State<MobileScannerTestPage>
|
||||
},
|
||||
onCancel: () {
|
||||
print('用户点击了取消');
|
||||
// 执行取消后的处理逻辑
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -101,15 +102,32 @@ class _MobileScannerTestPageState extends State<MobileScannerTestPage>
|
||||
}
|
||||
}
|
||||
|
||||
void _toggleTorch() async {
|
||||
await _scannerController.toggleTorch();
|
||||
setState(() {
|
||||
isTorchOn = !isTorchOn;
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _pickImageFromGallery() async {
|
||||
final picker = ImagePicker();
|
||||
final pickedFile = await picker.pickImage(source: ImageSource.gallery);
|
||||
if (pickedFile != null) {
|
||||
final bytes = await pickedFile.readAsBytes();
|
||||
final image = await decodeImageFromList(bytes);
|
||||
// 处理相册图片扫码逻辑
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: AppBar(
|
||||
systemOverlayStyle: SystemUiOverlayStyle(
|
||||
statusBarColor: Colors.transparent, // 状态栏背景色
|
||||
statusBarIconBrightness: Brightness.light, // 图标颜色(Android)
|
||||
statusBarBrightness: Brightness.light, // 图标颜色(iOS)
|
||||
statusBarColor: Colors.transparent,
|
||||
statusBarIconBrightness: Brightness.light,
|
||||
statusBarBrightness: Brightness.light,
|
||||
),
|
||||
backgroundColor: themeController.currentColor.sc17,
|
||||
automaticallyImplyLeading: false,
|
||||
@@ -139,122 +157,145 @@ class _MobileScannerTestPageState extends State<MobileScannerTestPage>
|
||||
),
|
||||
centerTitle: false,
|
||||
),
|
||||
body: Container(
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Stack(
|
||||
children: [
|
||||
MobileScanner(
|
||||
controller: _scannerController,
|
||||
onDetect: _onDetect,
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.topCenter, // 使扫描框位于顶部居中
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
body: Stack(
|
||||
children: [
|
||||
// 扫描区域(全屏)
|
||||
MobileScanner(
|
||||
controller: _scannerController,
|
||||
onDetect: _onDetect,
|
||||
),
|
||||
|
||||
// 扫描框和提示(顶部)- 使用 Positioned 更精确
|
||||
Positioned(
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 219.rpx),
|
||||
child: SizedBox(
|
||||
width: scanAreaSize,
|
||||
height: scanAreaSize,
|
||||
child: Stack(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 219.rpx), // 向上移动扫描框
|
||||
child: SizedBox(
|
||||
width: scanAreaSize,
|
||||
height: scanAreaSize,
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: themeController.currentColor.sc5,
|
||||
),
|
||||
),
|
||||
AnimatedBuilder(
|
||||
animation: _animation,
|
||||
builder: (context, child) {
|
||||
return Positioned(
|
||||
top: scanAreaSize * _animation.value,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
height: 2,
|
||||
color: themeController.currentColor.sc2,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: themeController.currentColor.sc5,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 31.rpx),
|
||||
Text(
|
||||
'扫一扫.提示'.tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc2,
|
||||
fontSize: 26.rpx,
|
||||
),
|
||||
AnimatedBuilder(
|
||||
animation: _animation,
|
||||
builder: (context, child) {
|
||||
return Positioned(
|
||||
top: scanAreaSize * _animation.value,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
height: 1.rpx,
|
||||
color: themeController.currentColor.sc2,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 31.rpx),
|
||||
Text(
|
||||
'扫一扫.提示'.tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc2,
|
||||
fontSize: 26.rpx,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 0, 0, 83.rpx),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
final picker = ImagePicker();
|
||||
final pickedFile =
|
||||
await picker.pickImage(source: ImageSource.gallery);
|
||||
if (pickedFile != null) {
|
||||
final bytes = await pickedFile.readAsBytes();
|
||||
final image = await decodeImageFromList(bytes);
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(Icons.photo,
|
||||
color: themeController.currentColor.sc2,
|
||||
size: 60.rpx),
|
||||
SizedBox(height: 10.rpx),
|
||||
Text(
|
||||
'扫一扫.相册'.tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc2,
|
||||
fontSize: 24.rpx,
|
||||
),
|
||||
|
||||
// 底部按钮区域 - 使用 Positioned 固定在底部
|
||||
Positioned(
|
||||
bottom: 83.rpx,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: _pickImageFromGallery,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 91.rpx,
|
||||
height: 91.rpx,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(50.rpx),
|
||||
color: stringToColor("#242835"),
|
||||
),
|
||||
child: Center(
|
||||
child: SvgPicture.asset(
|
||||
width: 34.rpx,
|
||||
height: 26.rpx,
|
||||
'assets/img/icon/album.svg',
|
||||
fit: BoxFit.cover,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10.rpx),
|
||||
Text(
|
||||
'扫一扫.相册'.tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize: 24.rpx,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 80.rpx),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
_scannerController.toggleTorch();
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(Icons.flashlight_on,
|
||||
color: themeController.currentColor.sc2,
|
||||
size: 60.rpx),
|
||||
SizedBox(height: 10.rpx),
|
||||
Text(
|
||||
'扫一扫.手电筒'.tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc2,
|
||||
fontSize: 24.rpx,
|
||||
),
|
||||
SizedBox(width: 170.rpx),
|
||||
GestureDetector(
|
||||
onTap: _toggleTorch,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 91.rpx,
|
||||
height: 91.rpx,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(50.rpx),
|
||||
color: isTorchOn
|
||||
? themeController.currentColor.sc3
|
||||
: stringToColor("#242835"),
|
||||
),
|
||||
child: Center(
|
||||
child: SvgPicture.asset(
|
||||
width: 26.rpx,
|
||||
height: 36.rpx,
|
||||
'assets/img/icon/light.svg',
|
||||
fit: BoxFit.cover,
|
||||
color: isTorchOn
|
||||
? stringToColor("#242835")
|
||||
: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10.rpx),
|
||||
Text(
|
||||
'扫一扫.手电筒'.tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize: 24.rpx,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -94,35 +94,35 @@ class _HomePageState extends State<HomePage> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: 11.rpx),
|
||||
// ClickableContainer(
|
||||
// padding: EdgeInsets.symmetric(vertical: 10.rpx),
|
||||
// backgroundColor: Colors.transparent,
|
||||
// highlightColor:
|
||||
// themeController.currentColor.sc16.withOpacity(0.1),
|
||||
// borderRadius: 0.rpx,
|
||||
// onTap: () {
|
||||
// _popupEntry?.remove();
|
||||
// _popupEntry = null;
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: "待开发功能".tr,
|
||||
// );
|
||||
// },
|
||||
// child: Container(
|
||||
// width: double.infinity,
|
||||
// child: Center(
|
||||
// child: Text(
|
||||
// '扫一扫.标题'.tr,
|
||||
// style: TextStyle(
|
||||
// fontSize: AppConstants().normal_text_fontSize,
|
||||
// color: themeController.currentColor.sc3,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(height: 35.rpx),
|
||||
|
||||
ClickableContainer(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.rpx),
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor:
|
||||
themeController.currentColor.sc16.withOpacity(0.1),
|
||||
borderRadius: 0.rpx,
|
||||
onTap: () {
|
||||
_popupEntry?.remove();
|
||||
_popupEntry = null;
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: "待开发功能".tr,
|
||||
// );
|
||||
Get.toNamed("/qrView");
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'扫一扫.标题'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 35.rpx),
|
||||
ClickableContainer(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.rpx),
|
||||
backgroundColor: Colors.transparent,
|
||||
@@ -151,6 +151,7 @@ class _HomePageState extends State<HomePage> {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 13.rpx),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user