Daisy caf62a7413 1,新增自定义短信模版列表接口对接
2,新增获取默认短信模版接口对接及相应逻辑处理
3,新增电子钥匙、密码模版相关逻辑及布局处理
4,新增添加短信模版(电子钥匙、密码)接口对接
5,修复新建短信模版点击报错不能展示问题
2024-06-04 14:44:04 +08:00

198 lines
7.4 KiB
Dart
Executable File
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/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_state.dart';
import 'package:star_lock/tools/noData.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
class CustomSMSTemplateListPage extends StatefulWidget {
const CustomSMSTemplateListPage({Key? key}) : super(key: key);
@override
State<CustomSMSTemplateListPage> createState() =>
_CustomSMSTemplateListPageState();
}
class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
final CustomSMSTemplateListLogic logic =
Get.put(CustomSMSTemplateListLogic());
final CustomSMSTemplateListState state =
Get.find<CustomSMSTemplateListLogic>().state;
@override
void initState() {
super.initState();
logic.getSMSTemplateListRequest();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '自定义短信模版'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: <Widget>[
Obx(() => Visibility(
child: _topTipWidget(),
visible: !state.isVip.value,
)),
Expanded(child: Obx(buildMainUI)),
SubmitBtn(
btnName: TranslationLoader.lanKeys!.creatingANewTemplate!.tr,
borderRadius: 20.w,
margin: EdgeInsets.only(
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {
Navigator.pushNamed(
context, Routers.valueAddedServicesAddSMSTemplatePage);
}),
SizedBox(
height: 40.h,
)
],
),
);
}
Widget _topTipWidget() {
return Container(
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 20.w),
padding:
EdgeInsets.only(top: 20.h, left: 20.w, right: 20.w, bottom: 20.h),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(5)),
child: Column(
children: <Widget>[
Text(
TranslationLoader.lanKeys!.customTemplatesTip!.tr,
style: TextStyle(
fontSize: 22.sp,
color: AppColors.blackColor,
fontWeight: FontWeight.w600),
),
SizedBox(
height: 15.h,
),
Container(
padding: EdgeInsets.only(
top: 15.h, left: 15.w, right: 15.w, bottom: 15.h),
decoration: BoxDecoration(
color: const Color(0xFFFbF9EC),
borderRadius: BorderRadius.circular(10.h)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
SizedBox(
width: 1.sw - 15.w * 2 - 40.w * 2 - 140.w,
// margin: EdgeInsets.only(top:15.h, left: 15.w, right: 15.w, bottom: 15.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'${TranslationLoader.lanKeys!.currentState!.tr}${TranslationLoader.lanKeys!.onTrial!.tr}',
style: TextStyle(
fontSize: 20.sp, fontWeight: FontWeight.w600),
),
Text(TranslationLoader.lanKeys!.unHaveOpenedTip2!.tr,
style: TextStyle(
fontSize: 20.sp, fontWeight: FontWeight.w600))
],
),
),
GestureDetector(
onTap: () {
Navigator.pushNamed(
context, Routers.valueAddedServicesHighFunctionPage);
},
child: Container(
width: 100.w,
height: 50.h,
decoration: BoxDecoration(
color: const Color(0xFFCAB68D),
borderRadius: BorderRadius.circular(35.h)),
child: Center(
child: Text(
TranslationLoader.lanKeys!.goToTheOpen!.tr,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white, fontSize: 20.sp)))),
),
],
),
)
],
));
}
Widget buildMainUI() {
return state.smsTemplateList.isNotEmpty
? ListView.builder(
itemCount: state.smsTemplateList.length,
itemBuilder: (BuildContext c, int index) {
final CustomSMSTemplateItem itemData =
state.smsTemplateList[index];
return _valueAddedServicesListSMSTemplateItem(itemData);
})
: NoData();
}
Widget _valueAddedServicesListSMSTemplateItem(
CustomSMSTemplateItem itemData) {
return GestureDetector(
onTap: () {
Navigator.pushNamed(
context, Routers.valueAddedServicesAddSMSTemplatePage);
},
child: Container(
// height: 100.h,
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10.w),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(left: 30.h, top: 30.h, bottom: 20.h),
child: Text(
itemData.name ?? '',
style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600),
),
),
Container(
width: 1.sw - 20.w * 2 - 30.w * 2,
margin: EdgeInsets.only(left: 25.w, right: 25.w, bottom: 25.h),
decoration: BoxDecoration(
color: const Color(0xFFF5F5F5),
borderRadius: BorderRadius.circular(10.h),
),
child: Padding(
padding: EdgeInsets.only(left: 20.w, top: 20.h, bottom: 20.h),
child: RichText(
text: TextSpan(
children: itemData.contentType == 1
? logic.buildElectronicKeySpan(templateData: itemData)
: logic.buildPasswordSpan(templateData: itemData),
),
),
),
),
],
),
),
);
}
}