app-starlock/lib/tools/emailNotifyTypeSelectAlert.dart
“DaisyWu” 7f1642b09f 1,修复星锁点分享界面少了发送密码到、分享
2,修复星锁类型选择的文字,少了句号。系统短信多了那字,是软件里。
3,修复接收者少了通讯录的头像。及选择通讯录相关逻辑操作
4,修复建议限制50位。接收者如是汉字或位数不够,英文弹框,通通锁提示操作失败。
5,星星锁电子钥匙、密码模块发送成功后,发送短信、邮箱接入最新API,解决发送不成功问题
2024-07-08 18:18:20 +08:00

141 lines
5.4 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
class EmailNotifyTypeSelectAlert extends StatelessWidget {
const EmailNotifyTypeSelectAlert({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
// 不需要实现,因为这个组件只是为了显示静态方法的对话框
throw UnimplementedError();
}
static void showEmailNotifyTypeSelectAlert(
{required bool isEmail, required Function(int) onSelected}) {
bool isSystemEmailSelected = true; // 默认选中系统邮件
showCupertinoDialog(
context: Get.context!,
builder: (BuildContext context) {
return StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return CupertinoAlertDialog(
title: const Text('类型选择'),
content: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.only(
left: 10.w, top: 8.h, bottom: 16.h, right: 10.w),
child: Align(
alignment: Alignment.centerLeft,
child:
Text('请选择要使用哪种类型', style: TextStyle(fontSize: 20.sp)),
),
),
GestureDetector(
onTap: () {
setState(() {
isSystemEmailSelected = true;
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset(
isSystemEmailSelected
? 'images/icon_round_select.png'
: 'images/icon_round_unSelect.png',
width: 30.w,
height: 30.w,
),
Padding(
padding: EdgeInsets.only(left: 10.w),
child: Text(
isEmail ? '系统邮件(推荐)' : '系统短信(推荐)',
style: TextStyle(
fontSize: 22.sp, fontWeight: FontWeight.bold),
),
),
],
),
),
Padding(
padding: EdgeInsets.only(top: 6.h, left: 10.w, bottom: 10.h),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
isEmail
? '邮件将从软件平台直接发给用户,请根据需要在软件里购买邮件数量。'
: '短信将从软件平台直接发给用户,请根据需要在软件里购买短信数量。',
style: TextStyle(fontSize: 18.sp),
textAlign: TextAlign.left,
),
),
),
GestureDetector(
onTap: () {
setState(() {
isSystemEmailSelected = false;
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset(
!isSystemEmailSelected
? 'images/icon_round_select.png'
: 'images/icon_round_unSelect.png',
width: 30.w,
height: 30.w,
),
Padding(
padding: EdgeInsets.only(left: 10.w),
child: Text(
isEmail ? '个人邮件' : '个人短信',
style: TextStyle(
fontSize: 22.sp, fontWeight: FontWeight.bold),
),
),
],
),
),
Padding(
padding: EdgeInsets.only(top: 6.h, left: 10.w),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
isEmail
? '邮件将从你的个人邮箱发给用户'
: '短信将从你的个人手机号发给用户,费用由运营商从你的手机号扣除',
style: TextStyle(fontSize: 18.sp),
textAlign: TextAlign.left,
),
),
),
],
),
actions: <Widget>[
CupertinoDialogAction(
onPressed: () {
final int selectedType =
isSystemEmailSelected ? 1 : 2; // 1 代表系统邮件2 代表个人邮件
onSelected(selectedType);
Get.back();
},
child: Text(
'确定'.tr,
style: TextStyle(color: AppColors.mainColor),
),
),
],
);
});
},
);
}
}