diff --git a/lib/tools/showCupertinoAlertView.dart b/lib/tools/showCupertinoAlertView.dart index 9b303167..d973cc78 100755 --- a/lib/tools/showCupertinoAlertView.dart +++ b/lib/tools/showCupertinoAlertView.dart @@ -2,6 +2,7 @@ import 'dart:typed_data'; import 'dart:ui'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; @@ -54,7 +55,7 @@ class ShowCupertinoAlertView { child: Text( '${"开启微信接收报警消息需要先关注".tr}$qrCodeText${"微信公众号,请保存二维码并使用微信扫一扫设置".tr}', style: - TextStyle(fontSize: 24.sp, color: Colors.black), + TextStyle(fontSize: 24.sp, color: Colors.black), )), SizedBox( height: 60.h, @@ -159,8 +160,8 @@ class ShowCupertinoAlertView { //发送需要实名认证的电子钥匙时身份信息确认框 void realNameIDCardInfoComfirmAlert( {required String getNameStr, - required String getIDCardStr, - required VoidCallback onConfirm}) { + required String getIDCardStr, + required VoidCallback onConfirm}) { showCupertinoDialog( context: Get.context!, builder: (context) { @@ -340,7 +341,7 @@ class ShowCupertinoAlertView { ), CupertinoDialogAction( child: - Text('购买'.tr, style: TextStyle(color: AppColors.mainColor)), + Text('购买'.tr, style: TextStyle(color: AppColors.mainColor)), onPressed: () { Get.back(); sureClick(); @@ -391,7 +392,7 @@ class ShowCupertinoAlertView { ), CupertinoDialogAction( child: - Text('删除'.tr, style: TextStyle(color: AppColors.mainColor)), + Text('删除'.tr, style: TextStyle(color: AppColors.mainColor)), onPressed: () { Get.back(); clearClick(); @@ -406,8 +407,8 @@ class ShowCupertinoAlertView { //可视门铃二维码弹窗 void showVisualDoorbellCodeAlert( {required BuildContext widgetContext, - required String qrCodeUrl, - required String qrCodeText}) { + required String qrCodeUrl, + required String qrCodeText}) { showCupertinoModalPopup( context: widgetContext, builder: (BuildContext context) { @@ -447,7 +448,7 @@ class ShowCupertinoAlertView { child: Text( qrCodeText, style: - TextStyle(fontSize: 24.sp, color: Colors.black), + TextStyle(fontSize: 24.sp, color: Colors.black), )), Container( margin: EdgeInsets.only(left: 60.w, right: 60.w), @@ -456,29 +457,33 @@ class ShowCupertinoAlertView { onClick: () async { // 截图并保存到相册 try { + final Color qrcodeStyleColor = + defaultTargetPlatform == TargetPlatform.iOS + ? const Color(0xFF000000) + : Colors.white; final QrPainter painter = QrPainter( data: qrCodeUrl, version: QrVersions.auto, gapless: false, errorCorrectionLevel: QrErrorCorrectLevel.L, - eyeStyle: const QrEyeStyle( + eyeStyle: QrEyeStyle( eyeShape: QrEyeShape.square, - color: Colors.white, + color: qrcodeStyleColor, ), - dataModuleStyle: const QrDataModuleStyle( + dataModuleStyle: QrDataModuleStyle( dataModuleShape: QrDataModuleShape.square, - color: Colors.white, + color: qrcodeStyleColor, )); final ByteData? byteData = - await painter.toImageData(600.0, - format: ImageByteFormat.png); + await painter.toImageData(600.0, + format: ImageByteFormat.png); final Uint8List pngBytes = - byteData!.buffer.asUint8List(); + byteData!.buffer.asUint8List(); final result = - await ImageGallerySaver.saveImage( - Uint8List.fromList(pngBytes), - quality: 100, - name: 'qr_code'); + await ImageGallerySaver.saveImage( + Uint8List.fromList(pngBytes), + quality: 100, + name: 'qr_code'); if (result['isSuccess']) { EasyLoading.showToast('保存成功'.tr); } else {