更新扫一扫

This commit is contained in:
wyf
2026-04-07 16:29:34 +08:00
parent 30d7764a10
commit c392cd8c90
5 changed files with 210 additions and 136 deletions

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32.98 25.68"><defs><style>.cls-1{fill:#161b28;}</style></defs><title>资源 407 </title><g id="图层_2" data-name="图层 2"><g id="图层_1-2" data-name="图层 1"><path class="cls-1" d="M30.16,0H2.68C1.19,0,0,.92,0,2.05V23.53a2.49,2.49,0,0,0,2.72,2.13H30.37A2.39,2.39,0,0,0,33,23.53V2.05c0-1.13-1.27-2-2.84-2ZM10.86,4.79A2.72,2.72,0,1,1,8.15,7.51h0A2.72,2.72,0,0,1,10.86,4.79Zm16.81,17.8H5.36c-.87,0-1-.5-.46-1.09l4.79-5A1.82,1.82,0,0,1,12,16.24l3.52,2.49a1.68,1.68,0,0,0,2.23-.29l8.16-9.9c.54-.65,1.07-.5,1.19.31L29,21.14a1.26,1.26,0,0,1-1.06,1.44.79.79,0,0,1-.22,0Z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 640 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25.29 34.59"><defs><style>.cls-1{fill:#161b28;}</style></defs><title>资源 406 </title><g id="图层_2" data-name="图层 2"><g id="图层_1-2" data-name="图层 1"><path class="cls-1" d="M18.81,13.19H6.49L.26,4.78A1.26,1.26,0,0,1,0,4V1.29A1.29,1.29,0,0,1,1.29,0H24a1.29,1.29,0,0,1,1.29,1.29V4a1.25,1.25,0,0,1-.25.77l-6.23,8.42ZM6.49,15.35v18a1.25,1.25,0,0,0,1.25,1.25h9.82a1.25,1.25,0,0,0,1.25-1.25v-18Zm6.16,8a1.19,1.19,0,0,1-1.19-1.19V18.49a1.19,1.19,0,0,1,2.38,0v3.67A1.19,1.19,0,0,1,12.65,23.35Z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 571 B

View File

@@ -90,10 +90,40 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
themeController.currentColor.sc16.withOpacity(0.1), themeController.currentColor.sc16.withOpacity(0.1),
borderRadius: 0.rpx, borderRadius: 0.rpx,
onTap: () { 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 = BlueteethBindController blueteethBindController =
Get.find(); Get.find();
blueteethBindController.returnPage = 1; blueteethBindController.returnPage = 0;
Get.toNamed("/deviceType"); Get.toNamed("/deviceType");
}, },
child: Container( child: Container(

View File

@@ -1,5 +1,6 @@
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:img_picker/img_picker.dart'; import 'package:img_picker/img_picker.dart';
import 'package:mobile_scanner/mobile_scanner.dart'; import 'package:mobile_scanner/mobile_scanner.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart'; import 'package:vbvs_app/common/color/app_uri_status.dart';
@@ -22,6 +23,7 @@ class _MobileScannerTestPageState extends State<MobileScannerTestPage>
with TickerProviderStateMixin { with TickerProviderStateMixin {
String? scannedText; String? scannedText;
bool isScanning = true; bool isScanning = true;
bool isTorchOn = false;
late AnimationController _controller; late AnimationController _controller;
late Animation<double> _animation; late Animation<double> _animation;
@@ -87,7 +89,6 @@ class _MobileScannerTestPageState extends State<MobileScannerTestPage>
}, },
onCancel: () { onCancel: () {
print('用户点击了取消'); 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
appBar: AppBar( appBar: AppBar(
systemOverlayStyle: SystemUiOverlayStyle( systemOverlayStyle: SystemUiOverlayStyle(
statusBarColor: Colors.transparent, // 状态栏背景色 statusBarColor: Colors.transparent,
statusBarIconBrightness: Brightness.light, // 图标颜色Android statusBarIconBrightness: Brightness.light,
statusBarBrightness: Brightness.light, // 图标颜色iOS statusBarBrightness: Brightness.light,
), ),
backgroundColor: themeController.currentColor.sc17, backgroundColor: themeController.currentColor.sc17,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
@@ -139,23 +157,24 @@ class _MobileScannerTestPageState extends State<MobileScannerTestPage>
), ),
centerTitle: false, centerTitle: false,
), ),
body: Container( body: Stack(
child: Column(
children: [
Expanded(
child: Stack(
children: [ children: [
// 扫描区域(全屏)
MobileScanner( MobileScanner(
controller: _scannerController, controller: _scannerController,
onDetect: _onDetect, onDetect: _onDetect,
), ),
Align(
alignment: Alignment.topCenter, // 使扫描框位于顶部居中 // 扫描框和提示(顶部)- 使用 Positioned 更精确
Positioned(
top: 0,
left: 0,
right: 0,
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only(top: 219.rpx), // 向上移动扫描框 padding: EdgeInsets.only(top: 219.rpx),
child: SizedBox( child: SizedBox(
width: scanAreaSize, width: scanAreaSize,
height: scanAreaSize, height: scanAreaSize,
@@ -174,7 +193,7 @@ class _MobileScannerTestPageState extends State<MobileScannerTestPage>
left: 0, left: 0,
right: 0, right: 0,
child: Container( child: Container(
height: 2, height: 1.rpx,
color: themeController.currentColor.sc2, color: themeController.currentColor.sc2,
), ),
); );
@@ -195,55 +214,78 @@ class _MobileScannerTestPageState extends State<MobileScannerTestPage>
], ],
), ),
), ),
],
), // 底部按钮区域 - 使用 Positioned 固定在底部
), Positioned(
Padding( bottom: 83.rpx,
padding: EdgeInsets.fromLTRB(0, 0, 0, 83.rpx), left: 0,
right: 0,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
GestureDetector( GestureDetector(
onTap: () async { onTap: _pickImageFromGallery,
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( child: Column(
children: [ children: [
Icon(Icons.photo, Container(
color: themeController.currentColor.sc2, width: 91.rpx,
size: 60.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), SizedBox(height: 10.rpx),
Text( Text(
'扫一扫.相册'.tr, '扫一扫.相册'.tr,
style: TextStyle( style: TextStyle(
color: themeController.currentColor.sc2, color: themeController.currentColor.sc3,
fontSize: 24.rpx, fontSize: 24.rpx,
), ),
), ),
], ],
), ),
), ),
SizedBox(width: 80.rpx), SizedBox(width: 170.rpx),
GestureDetector( GestureDetector(
onTap: () { onTap: _toggleTorch,
_scannerController.toggleTorch();
},
child: Column( child: Column(
children: [ children: [
Icon(Icons.flashlight_on, Container(
color: themeController.currentColor.sc2, width: 91.rpx,
size: 60.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), SizedBox(height: 10.rpx),
Text( Text(
'扫一扫.手电筒'.tr, '扫一扫.手电筒'.tr,
style: TextStyle( style: TextStyle(
color: themeController.currentColor.sc2, color: themeController.currentColor.sc3,
fontSize: 24.rpx, fontSize: 24.rpx,
), ),
), ),
@@ -255,7 +297,6 @@ class _MobileScannerTestPageState extends State<MobileScannerTestPage>
), ),
], ],
), ),
),
); );
} }
} }

View File

@@ -94,35 +94,35 @@ class _HomePageState extends State<HomePage> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
SizedBox(height: 11.rpx), SizedBox(height: 11.rpx),
// ClickableContainer( ClickableContainer(
// padding: EdgeInsets.symmetric(vertical: 10.rpx), padding: EdgeInsets.symmetric(vertical: 10.rpx),
// backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
// highlightColor: highlightColor:
// themeController.currentColor.sc16.withOpacity(0.1), themeController.currentColor.sc16.withOpacity(0.1),
// borderRadius: 0.rpx, borderRadius: 0.rpx,
// onTap: () { onTap: () {
// _popupEntry?.remove(); _popupEntry?.remove();
// _popupEntry = null; _popupEntry = null;
// TopSlideNotification.show( // TopSlideNotification.show(
// context, // context,
// text: "待开发功能".tr, // text: "待开发功能".tr,
// ); // );
// }, Get.toNamed("/qrView");
// child: Container( },
// width: double.infinity, child: Container(
// child: Center( width: double.infinity,
// child: Text( child: Center(
// '扫一扫.标题'.tr, child: Text(
// style: TextStyle( '扫一扫.标题'.tr,
// fontSize: AppConstants().normal_text_fontSize, style: TextStyle(
// color: themeController.currentColor.sc3, fontSize: AppConstants().normal_text_fontSize,
// ), color: themeController.currentColor.sc3,
// ), ),
// ), ),
// ), ),
// ), ),
// SizedBox(height: 35.rpx), ),
SizedBox(height: 35.rpx),
ClickableContainer( ClickableContainer(
padding: EdgeInsets.symmetric(vertical: 10.rpx), padding: EdgeInsets.symmetric(vertical: 10.rpx),
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
@@ -151,6 +151,7 @@ class _HomePageState extends State<HomePage> {
), ),
), ),
SizedBox(height: 13.rpx), SizedBox(height: 13.rpx),
], ],
), ),
), ),