59 lines
2.0 KiB
Dart
Raw Permalink Normal View History

import 'package:flutter/material.dart';
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_entity.dart';
class SendEmailNotificationState {
SendEmailNotificationState() {
if (Get.arguments['receiver'] != null) {
getReceiver.value = Get.arguments['receiver'];
}
if (Get.arguments['keyId'] != null) {
getKeyId.value = Get.arguments['keyId'];
}
if (Get.arguments['unlockType'] != null) {
unlockType.value = Get.arguments['unlockType'];
}
if (Get.arguments['channelType'] != null) {
channelType.value = Get.arguments['channelType'];
updateNotifyTypeText();
}
}
RxString getReceiver = ''.obs;
final TextEditingController templateContentController =
TextEditingController();
final TextEditingController receiverController = TextEditingController();
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
RxInt countryCode = 86.obs;
RxString countryName = '中国'.obs;
late Contact contact;
final FlutterContactPicker contactPicker = FlutterContactPicker();
RxInt unlockType = 0.obs; //开锁方式 1:电子钥匙 2密码
Future<void> updateNotifyTypeText() async {
if (channelType.value == 1) {
if (notifyTypeSelect.value == 1) {
getNotifyTypeText.value = '系统短信'.tr;
} else {
getNotifyTypeText.value = '个人短信'.tr;
}
} else {
if (notifyTypeSelect.value == 1) {
getNotifyTypeText.value = '系统邮件'.tr;
} else {
getNotifyTypeText.value = '个人邮件'.tr;
}
}
}
}