更新扫一扫

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,122 +157,145 @@ class _MobileScannerTestPageState extends State<MobileScannerTestPage>
), ),
centerTitle: false, centerTitle: false,
), ),
body: Container( body: Stack(
child: Column( children: [
children: [ // 扫描区域(全屏)
Expanded( MobileScanner(
child: Stack( controller: _scannerController,
children: [ onDetect: _onDetect,
MobileScanner( ),
controller: _scannerController,
onDetect: _onDetect, // 扫描框和提示(顶部)- 使用 Positioned 更精确
), Positioned(
Align( top: 0,
alignment: Alignment.topCenter, // 使扫描框位于顶部居中 left: 0,
child: Column( right: 0,
mainAxisSize: MainAxisSize.min, child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: EdgeInsets.only(top: 219.rpx),
child: SizedBox(
width: scanAreaSize,
height: scanAreaSize,
child: Stack(
children: [ children: [
Padding( Container(
padding: EdgeInsets.only(top: 219.rpx), // 向上移动扫描框 decoration: BoxDecoration(
child: SizedBox( color: themeController.currentColor.sc5,
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,
),
);
},
),
],
),
), ),
), ),
SizedBox(height: 31.rpx), AnimatedBuilder(
Text( animation: _animation,
'扫一扫.提示'.tr, builder: (context, child) {
style: TextStyle( return Positioned(
color: themeController.currentColor.sc2, top: scanAreaSize * _animation.value,
fontSize: 26.rpx, 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( // 底部按钮区域 - 使用 Positioned 固定在底部
mainAxisAlignment: MainAxisAlignment.center, Positioned(
children: [ bottom: 83.rpx,
GestureDetector( left: 0,
onTap: () async { right: 0,
final picker = ImagePicker(); child: Row(
final pickedFile = mainAxisAlignment: MainAxisAlignment.center,
await picker.pickImage(source: ImageSource.gallery); children: [
if (pickedFile != null) { GestureDetector(
final bytes = await pickedFile.readAsBytes(); onTap: _pickImageFromGallery,
final image = await decodeImageFromList(bytes); child: Column(
} children: [
}, Container(
child: Column( width: 91.rpx,
children: [ height: 91.rpx,
Icon(Icons.photo, decoration: BoxDecoration(
color: themeController.currentColor.sc2, borderRadius: BorderRadius.circular(50.rpx),
size: 60.rpx), color: stringToColor("#242835"),
SizedBox(height: 10.rpx), ),
Text( child: Center(
'扫一扫.相册'.tr, child: SvgPicture.asset(
style: TextStyle( width: 34.rpx,
color: themeController.currentColor.sc2, height: 26.rpx,
fontSize: 24.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( SizedBox(width: 170.rpx),
onTap: () { GestureDetector(
_scannerController.toggleTorch(); onTap: _toggleTorch,
}, child: Column(
child: Column( children: [
children: [ Container(
Icon(Icons.flashlight_on, width: 91.rpx,
color: themeController.currentColor.sc2, height: 91.rpx,
size: 60.rpx), decoration: BoxDecoration(
SizedBox(height: 10.rpx), borderRadius: BorderRadius.circular(50.rpx),
Text( color: isTorchOn
'扫一扫.手电筒'.tr, ? themeController.currentColor.sc3
style: TextStyle( : stringToColor("#242835"),
color: themeController.currentColor.sc2, ),
fontSize: 24.rpx, 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,
),
),
],
), ),
], ),
), ],
), ),
], ),
), ],
), ),
); );
} }

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),
], ],
), ),
), ),