147 lines
5.2 KiB
Dart
Executable File
147 lines
5.2 KiB
Dart
Executable File
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/SendEmailNotification_logic.dart';
|
|
import 'package:star_lock/main/lockDetail/electronicKey/sendEmailNotification/sendEmailNotification_state.dart';
|
|
import 'package:star_lock/tools/emailNotifyTypeSelectAlert.dart';
|
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
|
import 'package:star_lock/tools/pickers/style/default_style.dart';
|
|
import 'package:star_lock/translations/trans_lib.dart';
|
|
|
|
import '../../../../app_settings/app_colors.dart';
|
|
import '../../../../tools/commonItem.dart';
|
|
import '../../../../tools/submitBtn.dart';
|
|
import '../../../../tools/titleAppBar.dart';
|
|
|
|
class SendEmailNotificationPage extends StatefulWidget {
|
|
const SendEmailNotificationPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<SendEmailNotificationPage> createState() =>
|
|
_SendEmailNotificationPageState();
|
|
}
|
|
|
|
class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
|
final SendEmailNotificationLogic logic =
|
|
Get.put(SendEmailNotificationLogic());
|
|
final SendEmailNotificationState state =
|
|
Get.find<SendEmailNotificationLogic>().state;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
logic.getKeyNoticeTemplate();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: AppColors.mainBackgroundColor,
|
|
appBar: TitleAppBar(
|
|
barTitle: '邮件通知',
|
|
haveBack: true,
|
|
backgroundColor: AppColors.mainColor),
|
|
body: SingleChildScrollView(
|
|
child: Column(
|
|
children: <Widget>[
|
|
Obx(() => CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
|
rightTitle: state.getEmail.value,
|
|
isHaveLine: true,
|
|
)),
|
|
Obx(() => CommonItem(
|
|
leftTitel: '类型',
|
|
rightTitle:
|
|
state.emailNotifyType.value == 1 ? '系统邮件' : '个人邮件',
|
|
isHaveDirection: true,
|
|
action: () {
|
|
EmailNotifyTypeSelectAlert.showEmailNotifyTypeSelectAlert(
|
|
context, (int value) {
|
|
state.emailNotifyType.value = value;
|
|
});
|
|
},
|
|
)),
|
|
Container(height: 10.h),
|
|
Obx(() => CommonItem(
|
|
leftTitel: '模板',
|
|
rightTitle: state.selectEmailTemplate.value,
|
|
isHaveDirection: true,
|
|
isHaveLine: true,
|
|
action: () {
|
|
openBottomItemSheet(context);
|
|
},
|
|
)),
|
|
Container(
|
|
height: 360.h,
|
|
color: Colors.white,
|
|
padding: EdgeInsets.only(
|
|
left: 20.w, right: 20.w, top: 20.h, bottom: 20.h),
|
|
child: TextField(
|
|
maxLines: 8,
|
|
maxLength: 1000,
|
|
textAlign: TextAlign.start,
|
|
controller: state.emailController,
|
|
style: TextStyle(
|
|
color: Colors.black,
|
|
fontSize: 22.sp,
|
|
),
|
|
decoration: InputDecoration(
|
|
border: OutlineInputBorder(
|
|
///设置边框四个角的弧度
|
|
borderRadius: BorderRadius.all(Radius.circular(20.h)),
|
|
|
|
///用来配置边框的样式
|
|
borderSide: const BorderSide(
|
|
///设置边框的颜色
|
|
color: Color(0xffB2B2B2),
|
|
|
|
///设置边框的粗细
|
|
width: 0.5,
|
|
),
|
|
),
|
|
|
|
///用来配置输入框获取焦点时的颜色
|
|
focusedBorder: OutlineInputBorder(
|
|
///设置边框四个角的弧度
|
|
borderRadius: BorderRadius.all(Radius.circular(20.h)),
|
|
|
|
///用来配置边框的样式
|
|
borderSide: const BorderSide(
|
|
///设置边框的颜色
|
|
color: Color(0xffB2B2B2),
|
|
|
|
///设置边框的粗细
|
|
width: 1,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Container(height: 40.h),
|
|
SubmitBtn(
|
|
btnName: '发送'.tr,
|
|
fontSize: 28.sp,
|
|
borderRadius: 20.w,
|
|
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
|
onClick: () {}),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
// 底部选择pickerView
|
|
void openBottomItemSheet(BuildContext context) {
|
|
final List nameList =
|
|
state.emailTemplateList.map((item) => item.name!).toList();
|
|
|
|
Pickers.showSinglePicker(context,
|
|
data: nameList,
|
|
pickerStyle: DefaultPickerStyle(), onConfirm: (p, int position) {
|
|
state.selectEmailTemplate.value = nameList[position];
|
|
});
|
|
}
|
|
}
|