2023-07-21 19:31:01 +08:00
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import '../../../../app_settings/app_colors.dart';
|
|
|
|
|
|
import '../../../../tools/commonItem.dart';
|
|
|
|
|
|
import '../../../../tools/showBottomSheetTool.dart';
|
|
|
|
|
|
import '../../../../tools/submitBtn.dart';
|
|
|
|
|
|
import '../../../../tools/titleAppBar.dart';
|
|
|
|
|
|
import '../../../../translations/trans_lib.dart';
|
|
|
|
|
|
|
|
|
|
|
|
//高亮样式
|
2023-07-28 17:14:11 +08:00
|
|
|
|
final TextStyle highStyle =
|
|
|
|
|
|
TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp);
|
2023-07-21 19:31:01 +08:00
|
|
|
|
|
|
|
|
|
|
//默认样式
|
2023-07-28 17:14:11 +08:00
|
|
|
|
final TextStyle defaultStyle = TextStyle(color: Colors.black, fontSize: 20.sp);
|
2023-07-21 19:31:01 +08:00
|
|
|
|
|
|
|
|
|
|
//预览样式封装-密码
|
|
|
|
|
|
InlineSpan emailPasswardSpan = TextSpan(children: [
|
2023-07-28 17:14:11 +08:00
|
|
|
|
TextSpan(
|
|
|
|
|
|
text:
|
|
|
|
|
|
'${TranslationLoader.lanKeys!.hello!.tr},${TranslationLoader.lanKeys!.yourRoomIs!.tr}:',
|
|
|
|
|
|
style: defaultStyle),
|
|
|
|
|
|
TextSpan(
|
|
|
|
|
|
text: '{${TranslationLoader.lanKeys!.roomName!.tr}', style: highStyle),
|
|
|
|
|
|
TextSpan(
|
|
|
|
|
|
text: ',${TranslationLoader.lanKeys!.theCodeToOpenTheDoorIs!.tr}:',
|
|
|
|
|
|
style: defaultStyle),
|
|
|
|
|
|
TextSpan(
|
|
|
|
|
|
text: '{${TranslationLoader.lanKeys!.password!.tr}}', style: highStyle),
|
|
|
|
|
|
TextSpan(
|
|
|
|
|
|
text: '。${TranslationLoader.lanKeys!.periodValidity!.tr}:',
|
|
|
|
|
|
style: defaultStyle),
|
|
|
|
|
|
TextSpan(
|
|
|
|
|
|
text: '{${TranslationLoader.lanKeys!.periodValidity!.tr}}',
|
|
|
|
|
|
style: highStyle),
|
|
|
|
|
|
TextSpan(
|
|
|
|
|
|
text: '。${TranslationLoader.lanKeys!.templateTip1!.tr}。',
|
|
|
|
|
|
style: defaultStyle),
|
2023-07-21 19:31:01 +08:00
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
//预览样式封装-密码提示
|
|
|
|
|
|
InlineSpan emailPasswardTipSpan = TextSpan(children: [
|
2023-07-28 17:14:11 +08:00
|
|
|
|
TextSpan(
|
|
|
|
|
|
text: TranslationLoader.lanKeys!.templateTip4!.tr, style: defaultStyle),
|
|
|
|
|
|
TextSpan(
|
|
|
|
|
|
text: '{${TranslationLoader.lanKeys!.roomName!.tr}}', style: highStyle),
|
2023-07-21 19:31:01 +08:00
|
|
|
|
TextSpan(text: '、', style: defaultStyle),
|
2023-07-28 17:14:11 +08:00
|
|
|
|
TextSpan(
|
|
|
|
|
|
text: '{${TranslationLoader.lanKeys!.password!.tr}}', style: highStyle),
|
|
|
|
|
|
TextSpan(text: TranslationLoader.lanKeys!.and!.tr, style: defaultStyle),
|
|
|
|
|
|
TextSpan(
|
|
|
|
|
|
text: '{${TranslationLoader.lanKeys!.periodValidity!.tr}}',
|
|
|
|
|
|
style: highStyle),
|
|
|
|
|
|
TextSpan(
|
|
|
|
|
|
text: TranslationLoader.lanKeys!.willBeReplacedWithTheActualValue!.tr,
|
|
|
|
|
|
style: defaultStyle),
|
2023-07-21 19:31:01 +08:00
|
|
|
|
]);
|
|
|
|
|
|
|
2023-07-28 17:14:11 +08:00
|
|
|
|
String emaiPasswardStr =
|
|
|
|
|
|
"${TranslationLoader.lanKeys!.hello!.tr},${TranslationLoader.lanKeys!.yourRoomIs!.tr}:{${TranslationLoader.lanKeys!.roomName!.tr}},${TranslationLoader.lanKeys!.theCodeToOpenTheDoorIs!.tr}:{${TranslationLoader.lanKeys!.password!.tr}}。${TranslationLoader.lanKeys!.periodValidity!.tr}:{${TranslationLoader.lanKeys!.periodValidity!.tr}}。${TranslationLoader.lanKeys!.templateTip1!.tr}";
|
2023-07-21 19:31:01 +08:00
|
|
|
|
|
|
|
|
|
|
//预览样式封装-电子钥匙
|
|
|
|
|
|
InlineSpan emailElectronicKeySpan = TextSpan(children: [
|
2023-07-28 17:14:11 +08:00
|
|
|
|
TextSpan(
|
|
|
|
|
|
text: TranslationLoader.lanKeys!.templateTip2!.tr, style: defaultStyle),
|
2023-07-21 19:31:01 +08:00
|
|
|
|
TextSpan(text: 'https://abc.com/bcd', style: highStyle)
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
//预览样式封装-电子钥匙提示
|
|
|
|
|
|
InlineSpan emailElectronicKeyTipSpan = TextSpan(children: [
|
2023-07-28 17:14:11 +08:00
|
|
|
|
TextSpan(
|
|
|
|
|
|
text: TranslationLoader.lanKeys!.templateTip4!.tr, style: defaultStyle),
|
|
|
|
|
|
TextSpan(
|
|
|
|
|
|
text: '{${TranslationLoader.lanKeys!.downloadLink!.tr}',
|
|
|
|
|
|
style: highStyle),
|
|
|
|
|
|
TextSpan(
|
|
|
|
|
|
text: TranslationLoader.lanKeys!.willBeReplacedWithTheActualValue!.tr,
|
|
|
|
|
|
style: defaultStyle),
|
2023-07-21 19:31:01 +08:00
|
|
|
|
]);
|
|
|
|
|
|
|
2023-07-28 17:14:11 +08:00
|
|
|
|
String emailElectronicKeyStr =
|
|
|
|
|
|
"${TranslationLoader.lanKeys!.templateTip2!.tr}\n{${TranslationLoader.lanKeys!.downloadLink!.tr}}";
|
2023-07-21 19:31:01 +08:00
|
|
|
|
|
|
|
|
|
|
class ValueAddedServicesAddEmailTemplatePage extends StatefulWidget {
|
|
|
|
|
|
const ValueAddedServicesAddEmailTemplatePage({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
2023-07-28 17:14:11 +08:00
|
|
|
|
State<ValueAddedServicesAddEmailTemplatePage> createState() =>
|
|
|
|
|
|
_ValueAddedServicesAddEmailTemplatePageState();
|
2023-07-21 19:31:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-07-28 17:14:11 +08:00
|
|
|
|
class _ValueAddedServicesAddEmailTemplatePageState
|
|
|
|
|
|
extends State<ValueAddedServicesAddEmailTemplatePage> {
|
2023-07-21 19:31:01 +08:00
|
|
|
|
final _templateOneTf = TextEditingController();
|
|
|
|
|
|
final _templateNameTf = TextEditingController();
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
void initState() {
|
|
|
|
|
|
super.initState();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
_templateOneTf.text = emailElectronicKeyStr;
|
|
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
|
|
backgroundColor: AppColors.mainBackgroundColor,
|
2023-07-28 17:14:11 +08:00
|
|
|
|
appBar: TitleAppBar(
|
|
|
|
|
|
barTitle: TranslationLoader.lanKeys!.customMailTemplate!.tr,
|
|
|
|
|
|
haveBack: true,
|
|
|
|
|
|
backgroundColor: AppColors.mainColor),
|
2023-07-21 19:31:01 +08:00
|
|
|
|
body: ListView(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
_buildEditTopInfo(),
|
2023-07-28 17:14:11 +08:00
|
|
|
|
SizedBox(
|
|
|
|
|
|
height: 10.h,
|
|
|
|
|
|
),
|
2023-07-21 19:31:01 +08:00
|
|
|
|
_buildEditTemplate(),
|
2023-07-28 17:14:11 +08:00
|
|
|
|
SizedBox(
|
|
|
|
|
|
height: 10.h,
|
|
|
|
|
|
),
|
2023-07-21 19:31:01 +08:00
|
|
|
|
_buildpreview(),
|
|
|
|
|
|
SizedBox(height: 42.h),
|
|
|
|
|
|
SubmitBtn(
|
|
|
|
|
|
btnName: TranslationLoader.lanKeys!.save!.tr,
|
|
|
|
|
|
borderRadius: 10.w,
|
2023-07-28 17:14:11 +08:00
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
|
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
2023-07-21 19:31:01 +08:00
|
|
|
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
2023-07-28 17:14:11 +08:00
|
|
|
|
onClick: () {
|
2023-07-21 19:31:01 +08:00
|
|
|
|
// Navigator.pushNamed(context, Routers.sendElectronicKeyManagePage);
|
2023-07-28 17:14:11 +08:00
|
|
|
|
}),
|
2023-07-21 19:31:01 +08:00
|
|
|
|
],
|
|
|
|
|
|
));
|
|
|
|
|
|
}
|
2023-07-28 17:14:11 +08:00
|
|
|
|
|
2023-07-21 19:31:01 +08:00
|
|
|
|
Widget _buildEditTopInfo() {
|
|
|
|
|
|
return Column(
|
|
|
|
|
|
children: [
|
2023-07-28 17:14:11 +08:00
|
|
|
|
CommonItem(
|
|
|
|
|
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
|
|
|
|
|
rightTitle: "",
|
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveRightWidget: true,
|
|
|
|
|
|
rightWidget: getTFWidget(
|
|
|
|
|
|
_templateNameTf, TranslationLoader.lanKeys!.pleaseEnter!.tr)),
|
|
|
|
|
|
CommonItem(
|
|
|
|
|
|
leftTitel: TranslationLoader.lanKeys!.type!.tr,
|
|
|
|
|
|
rightTitle: TranslationLoader.lanKeys!.password!.tr,
|
|
|
|
|
|
isHaveLine: false,
|
|
|
|
|
|
action: () {
|
2024-01-23 17:29:18 +08:00
|
|
|
|
_showSelectTemplateType();
|
2023-07-28 17:14:11 +08:00
|
|
|
|
}),
|
2023-07-21 19:31:01 +08:00
|
|
|
|
],
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Widget _buildEditTemplate() {
|
|
|
|
|
|
return Container(
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Row(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Padding(
|
2023-07-28 17:14:11 +08:00
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
|
left: 25.w, top: 25.h, bottom: 25.h, right: 25.w),
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
TranslationLoader.lanKeys!.templateContent!.tr,
|
|
|
|
|
|
style:
|
|
|
|
|
|
TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w600),
|
2023-07-21 19:31:01 +08:00
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
Container(
|
|
|
|
|
|
margin: EdgeInsets.only(left: 25.w, right: 25.w, bottom: 25.h),
|
|
|
|
|
|
height: 100,
|
|
|
|
|
|
child: TextField(
|
2023-07-28 17:14:11 +08:00
|
|
|
|
maxLines: 8,
|
2023-07-21 19:31:01 +08:00
|
|
|
|
// maxLength:1000,
|
|
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
|
|
controller: _templateOneTf,
|
2023-07-28 17:14:11 +08:00
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
|
fontSize: 28.sp,
|
|
|
|
|
|
),
|
2023-07-21 19:31:01 +08:00
|
|
|
|
decoration: InputDecoration(
|
2023-07-28 17:14:11 +08:00
|
|
|
|
contentPadding: EdgeInsets.only(
|
|
|
|
|
|
top: 20.h, left: 20.w, right: 20.w, bottom: 20.h),
|
2023-07-21 19:31:01 +08:00
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
|
|
///设置边框四个角的弧度
|
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(20.h)),
|
2023-07-28 17:14:11 +08:00
|
|
|
|
|
2023-07-21 19:31:01 +08:00
|
|
|
|
///用来配置边框的样式
|
|
|
|
|
|
borderSide: const BorderSide(
|
|
|
|
|
|
///设置边框的颜色
|
|
|
|
|
|
color: Color(0xffB2B2B2),
|
2023-07-28 17:14:11 +08:00
|
|
|
|
|
2023-07-21 19:31:01 +08:00
|
|
|
|
///设置边框的粗细
|
|
|
|
|
|
width: 0.5,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
2023-07-28 17:14:11 +08:00
|
|
|
|
|
2023-07-21 19:31:01 +08:00
|
|
|
|
///用来配置输入框获取焦点时的颜色
|
|
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
|
|
///设置边框四个角的弧度
|
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(20.h)),
|
2023-07-28 17:14:11 +08:00
|
|
|
|
|
2023-07-21 19:31:01 +08:00
|
|
|
|
///用来配置边框的样式
|
|
|
|
|
|
borderSide: const BorderSide(
|
|
|
|
|
|
///设置边框的颜色
|
|
|
|
|
|
color: Color(0xffB2B2B2),
|
2023-07-28 17:14:11 +08:00
|
|
|
|
|
2023-07-21 19:31:01 +08:00
|
|
|
|
///设置边框的粗细
|
|
|
|
|
|
width: 1,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
Container(
|
2023-07-28 17:14:11 +08:00
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
|
top: 20.h, left: 20.w, right: 20.w, bottom: 20.h),
|
|
|
|
|
|
margin: EdgeInsets.only(left: 15.w, right: 15.w, bottom: 15.h),
|
2023-07-21 19:31:01 +08:00
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
color: const Color(0xFFFbF9EC),
|
|
|
|
|
|
borderRadius: BorderRadius.circular(10.h)),
|
2023-07-28 17:14:11 +08:00
|
|
|
|
child: RichText(text: emailElectronicKeyTipSpan),
|
2023-07-21 19:31:01 +08:00
|
|
|
|
)
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Widget _buildpreview() {
|
|
|
|
|
|
return Column(
|
2023-07-28 17:14:11 +08:00
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.start,
|
2023-07-21 19:31:01 +08:00
|
|
|
|
children: [
|
|
|
|
|
|
Container(
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
margin: EdgeInsets.only(bottom: 20.h),
|
2023-07-28 17:14:11 +08:00
|
|
|
|
child: Column(
|
2023-07-21 19:31:01 +08:00
|
|
|
|
children: [
|
|
|
|
|
|
Column(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Row(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Padding(
|
2023-07-28 17:14:11 +08:00
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
|
left: 25.w,
|
|
|
|
|
|
top: 25.h,
|
|
|
|
|
|
bottom: 25.h,
|
|
|
|
|
|
right: 25.w),
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
TranslationLoader.lanKeys!.preview!.tr,
|
|
|
|
|
|
style: TextStyle(fontSize: 20.sp),
|
2023-07-21 19:31:01 +08:00
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
Container(
|
2023-07-28 17:14:11 +08:00
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
|
left: 25.w, right: 25.w, bottom: 20.h),
|
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
|
left: 20.w, top: 20.h, right: 20.w, bottom: 20.h),
|
2023-07-21 19:31:01 +08:00
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
color: const Color(0xFFF5F5F5),
|
|
|
|
|
|
borderRadius: BorderRadius.circular(10.h),
|
|
|
|
|
|
),
|
|
|
|
|
|
child: RichText(text: emailElectronicKeySpan),
|
|
|
|
|
|
)
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
2023-07-28 17:14:11 +08:00
|
|
|
|
))
|
|
|
|
|
|
]);
|
2023-07-21 19:31:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-07-28 17:14:11 +08:00
|
|
|
|
Widget getTFWidget(TextEditingController tfController, String tfStr) {
|
2023-07-21 19:31:01 +08:00
|
|
|
|
return Container(
|
|
|
|
|
|
height: 50.h,
|
|
|
|
|
|
width: 500.w,
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
child: TextField(
|
|
|
|
|
|
//输入框一行
|
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
|
controller: tfController,
|
|
|
|
|
|
autofocus: false,
|
2023-07-28 17:14:11 +08:00
|
|
|
|
textAlign: TextAlign.end,
|
2023-07-21 19:31:01 +08:00
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
|
//输入里面输入文字内边距设置
|
|
|
|
|
|
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
|
|
|
|
|
hintText: tfStr,
|
|
|
|
|
|
//不需要输入框下划线
|
|
|
|
|
|
border: InputBorder.none,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-23 17:29:18 +08:00
|
|
|
|
void _showSelectTemplateType() {
|
2023-07-28 17:14:11 +08:00
|
|
|
|
var list = [
|
|
|
|
|
|
TranslationLoader.lanKeys!.electronicKey!.tr,
|
|
|
|
|
|
TranslationLoader.lanKeys!.password!.tr
|
|
|
|
|
|
];
|
2023-07-21 19:31:01 +08:00
|
|
|
|
ShowBottomSheetTool().showSingleRowPicker(
|
2023-07-28 17:14:11 +08:00
|
|
|
|
//上下文
|
2023-07-21 19:31:01 +08:00
|
|
|
|
context,
|
|
|
|
|
|
//默认的索引
|
|
|
|
|
|
normalIndex: 0,
|
|
|
|
|
|
title: TranslationLoader.lanKeys!.type!.tr,
|
|
|
|
|
|
cancelTitle: TranslationLoader.lanKeys!.cancel!.tr,
|
|
|
|
|
|
sureTitle: TranslationLoader.lanKeys!.sure!.tr,
|
|
|
|
|
|
//要显示的列表
|
|
|
|
|
|
//可自定义数据适配器
|
|
|
|
|
|
//adapter: PickerAdapter(),
|
|
|
|
|
|
data: list,
|
|
|
|
|
|
//选择事件的回调
|
2023-07-28 17:14:11 +08:00
|
|
|
|
clickCallBack: (int index, var str) {});
|
2023-07-21 19:31:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|