2024-06-11 17:55:00 +08:00
|
|
|
|
import 'package:flutter/material.dart';
|
2024-07-08 18:18:20 +08:00
|
|
|
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
2024-06-11 17:55:00 +08:00
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_entity.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class SendEmailNotificationState {
|
|
|
|
|
|
SendEmailNotificationState() {
|
2024-06-12 13:53:59 +08:00
|
|
|
|
if (Get.arguments['receiver'] != null) {
|
|
|
|
|
|
getReceiver.value = Get.arguments['receiver'];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (Get.arguments['keyId'] != null) {
|
|
|
|
|
|
getKeyId.value = Get.arguments['keyId'];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-08 18:18:20 +08:00
|
|
|
|
if (Get.arguments['unlockType'] != null) {
|
|
|
|
|
|
unlockType.value = Get.arguments['unlockType'];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-12 16:49:39 +08:00
|
|
|
|
if (Get.arguments['channelType'] != null) {
|
|
|
|
|
|
channelType.value = Get.arguments['channelType'];
|
|
|
|
|
|
updateNotifyTypeText();
|
2024-06-11 17:55:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-12 13:53:59 +08:00
|
|
|
|
RxString getReceiver = ''.obs;
|
2024-06-12 16:49:39 +08:00
|
|
|
|
final TextEditingController templateContentController =
|
|
|
|
|
|
TextEditingController();
|
|
|
|
|
|
final TextEditingController receiverController = TextEditingController();
|
2024-06-12 13:53:59 +08:00
|
|
|
|
RxInt notifyTypeSelect = 1.obs; //1 代表系统,2 代表个人
|
|
|
|
|
|
RxInt channelType = 0.obs; //1 代表短信,2 代表邮件
|
|
|
|
|
|
RxString getNotifyTypeText = ''.obs;
|
|
|
|
|
|
RxList<EmailNotificationItem> emailTemplateList =
|
|
|
|
|
|
<EmailNotificationItem>[].obs;
|
|
|
|
|
|
Rx<EmailNotificationItem> currentNotifyItem = EmailNotificationItem().obs;
|
|
|
|
|
|
RxInt getKeyId = 0.obs; //获取钥匙成功得到的keyId
|
2024-07-08 18:18:20 +08:00
|
|
|
|
RxInt countryCode = 86.obs;
|
2024-06-12 16:49:39 +08:00
|
|
|
|
RxString countryName = '中国'.obs;
|
2024-07-08 18:18:20 +08:00
|
|
|
|
late Contact contact;
|
|
|
|
|
|
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
|
|
|
|
|
RxInt unlockType = 0.obs; //开锁方式 1:电子钥匙 2:密码
|
2024-06-12 16:49:39 +08:00
|
|
|
|
|
|
|
|
|
|
Future<void> updateNotifyTypeText() async {
|
|
|
|
|
|
if (channelType.value == 1) {
|
|
|
|
|
|
if (notifyTypeSelect.value == 1) {
|
2024-08-21 18:31:19 +08:00
|
|
|
|
getNotifyTypeText.value = '系统短信'.tr;
|
2024-06-12 16:49:39 +08:00
|
|
|
|
} else {
|
2024-08-21 18:31:19 +08:00
|
|
|
|
getNotifyTypeText.value = '个人短信'.tr;
|
2024-06-12 16:49:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (notifyTypeSelect.value == 1) {
|
2024-08-21 18:31:19 +08:00
|
|
|
|
getNotifyTypeText.value = '系统邮件'.tr;
|
2024-06-12 16:49:39 +08:00
|
|
|
|
} else {
|
2024-08-21 18:31:19 +08:00
|
|
|
|
getNotifyTypeText.value = '个人邮件'.tr;
|
2024-06-12 16:49:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-06-11 17:55:00 +08:00
|
|
|
|
}
|