From 4e7bbfa139a5b3efd532e236bc90bdd8f7e46c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CDaisyWu=E2=80=9D?= <“18682150237@163.com”> Date: Wed, 10 Jul 2024 13:56:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E4=B8=8B=E6=8B=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../value_added_services_record_logic.dart | 23 +++-- .../value_added_services_record_page.dart | 5 +- .../newSMSTemplate_page.dart | 90 ++++++++++--------- .../customSMSTemplateList_logic.dart | 13 ++- 4 files changed, 78 insertions(+), 53 deletions(-) diff --git a/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart b/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart index 2fe278ae..6577c025 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart @@ -29,6 +29,7 @@ class ValueAddedServicesRecordLogic extends BaseGetXController { Future loadBuyRecordList(bool load) async { if (!load) { buyPageNo = 1; + state.buyRecordList.clear(); } final UseRecordListEntity entity = await ApiRepository.to.getBuyRecordList( type: type, @@ -36,11 +37,16 @@ class ValueAddedServicesRecordLogic extends BaseGetXController { pageNo: buyPageNo, ); if (entity.errorCode!.codeIsSuccessful) { - if (load) { - state.buyRecordList.addAll(entity.data!.recordList!); - } else { + if (pageNo == 1) { state.buyRecordList.value = entity.data!.recordList!; + pageNo++; + } else { + if (entity.data!.recordList!.isNotEmpty) { + state.buyRecordList.value.addAll(entity.data!.recordList!); + pageNo++; + } } + state.buyRecordList.refresh(); } @@ -51,16 +57,21 @@ class ValueAddedServicesRecordLogic extends BaseGetXController { Future loadUseRecordList(bool load) async { if (!load) { usePageNo = 1; + state.useRecordList.clear(); } final UseRecordListEntity entity = await ApiRepository.to.getUseRecordList( type: type, pageNo: buyPageNo, ); if (entity.errorCode!.codeIsSuccessful) { - if (load) { - state.useRecordList.addAll(entity.data!.recordList!); - } else { + if (pageNo == 1) { state.useRecordList.value = entity.data!.recordList!; + pageNo++; + } else { + if (entity.data!.recordList!.isNotEmpty) { + state.useRecordList.value.addAll(entity.data!.recordList!); + pageNo++; + } } state.useRecordList.refresh(); } diff --git a/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_page.dart b/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_page.dart index 629bcc3f..f8fd16ca 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_page.dart @@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/value_added_services_record_logic.dart'; +import 'package:star_lock/tools/EasyRefreshTool.dart'; import 'package:star_lock/tools/noData.dart'; import '../../../app_settings/app_colors.dart'; import '../../../tools/titleAppBar.dart'; @@ -75,7 +76,7 @@ class _PurchaseRecords extends StatelessWidget { @override Widget build(BuildContext context) { - return EasyRefresh( + return EasyRefreshTool( onRefresh: () async { logic.loadBuyRecordList(false); }, @@ -138,7 +139,7 @@ class _UseRecordsTable extends StatelessWidget { @override Widget build(BuildContext context) { - return EasyRefresh( + return EasyRefreshTool( onRefresh: () async { logic.loadUseRecordList(false); }, diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart index 6d6fa748..03a2fc38 100755 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/newSMSTemplate_page.dart @@ -23,49 +23,54 @@ class NewSMSTemplatePage extends StatefulWidget { class _NewSMSTemplatePageState extends State { final NewSMSTemplateLogic logic = Get.put(NewSMSTemplateLogic()); final NewSMSTemplateState state = Get.find().state; + final FocusNode focusNode = FocusNode(); @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: AppColors.mainBackgroundColor, - appBar: TitleAppBar( - barTitle: state.isUpdate.value == false - ? state.channelType.value == 1 - ? '新建短信模版'.tr - : '新建邮件模版'.tr - : state.channelType.value == 1 - ? '编辑短信模版'.tr - : '编辑邮件模版'.tr, - haveBack: true, - backgroundColor: AppColors.mainColor, - ), - body: SingleChildScrollView( - child: Column( - children: [ - _buildEditTopInfo(), - SizedBox(height: 10.h), - _buildEditTemplate(), - SizedBox(height: 10.h), - _buildPreView(), - SizedBox(height: 42.h), - Container( - margin: EdgeInsets.symmetric(horizontal: 20.w), - child: SubmitBtn( - btnName: TranslationLoader.lanKeys!.save!.tr, - onClick: () { - if (state.currentTemplate.value.isUpdate == true) { - logic.updateTemplateInfo(); - } else { - logic.addSMSTemplate(); - } - }, - ), - ), - SizedBox(height: 40.h), - ], + resizeToAvoidBottomInset: false, + backgroundColor: AppColors.mainBackgroundColor, + appBar: TitleAppBar( + barTitle: state.isUpdate.value == false + ? state.channelType.value == 1 + ? '新建短信模版'.tr + : '新建邮件模版'.tr + : state.channelType.value == 1 + ? '编辑短信模版'.tr + : '编辑邮件模版'.tr, + haveBack: true, + backgroundColor: AppColors.mainColor, ), - ), - ); + body: GestureDetector( + onTap: () { + FocusScope.of(context).unfocus(); + }, + child: SingleChildScrollView( + child: Column( + children: [ + _buildEditTopInfo(), + SizedBox(height: 10.h), + _buildEditTemplate(), + SizedBox(height: 10.h), + _buildPreView(), + SizedBox(height: 42.h), + Container( + margin: EdgeInsets.symmetric(horizontal: 20.w), + child: SubmitBtn( + btnName: TranslationLoader.lanKeys!.save!.tr, + onClick: () { + if (state.currentTemplate.value.isUpdate == true) { + logic.updateTemplateInfo(); + } else { + logic.addSMSTemplate(); + } + }, + ), + ), + SizedBox(height: 40.h), + ], + ), + ))); } Widget _buildEditTopInfo() { @@ -123,7 +128,7 @@ class _NewSMSTemplatePageState extends State { Container( margin: EdgeInsets.symmetric(horizontal: 25.w, vertical: 25.h), height: 100, - child: _buildTextField(state.templateOneTf), + child: _buildContentTF(state.templateOneTf), ), Obx(() => Container( width: 1.sw - 50.w, @@ -138,7 +143,7 @@ class _NewSMSTemplatePageState extends State { child: Stack( alignment: Alignment.bottomRight, children: [ - _buildTextField(state.templateTwoTf), + _buildContentTF(state.templateTwoTf), ], ), ) @@ -166,8 +171,6 @@ class _NewSMSTemplatePageState extends State { ), Obx(() => Container( width: 1.sw - 50.w, - // margin: EdgeInsets.only(left: 25.w, right: 25.w, bottom: 20.h), - // padding: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 20.h), margin: EdgeInsets.only(left: 25.w, right: 25.w), padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h), decoration: BoxDecoration( @@ -216,12 +219,13 @@ class _NewSMSTemplatePageState extends State { } } - Widget _buildTextField(TextEditingController controller) { + Widget _buildContentTF(TextEditingController controller) { return TextField( maxLines: 8, textAlign: TextAlign.start, controller: controller, style: state.defaultStyle, + autofocus: false, decoration: InputDecoration( contentPadding: EdgeInsets.all(20.w), border: OutlineInputBorder( diff --git a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart index 2d6ba6d1..d92a0778 100644 --- a/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart +++ b/lib/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_logic.dart @@ -24,8 +24,17 @@ class CustomSMSTemplateListLogic extends BaseGetXController { pageNo: pageNo, pageSize: int.parse(pageSize)); if (entity.errorCode!.codeIsSuccessful) { - state.smsTemplateList.value = - entity.data?.list ?? []; + if (pageNo == 1) { + state.smsTemplateList.value = + entity.data?.list ?? []; + pageNo++; + } else { + if (state.smsTemplateList.isNotEmpty) { + state.smsTemplateList + .addAll(entity.data?.list ?? []); + pageNo++; + } + } state.smsTemplateList.refresh(); } }