diff --git a/lib/pages/message_center_page/announce/announce_view.dart b/lib/pages/message_center_page/announce/announce_view.dart index 418209c3..4ee74e18 100644 --- a/lib/pages/message_center_page/announce/announce_view.dart +++ b/lib/pages/message_center_page/announce/announce_view.dart @@ -107,13 +107,14 @@ class _AnnounceViewState extends State { header: MaterialHeader(), footer: MaterialFooter(), scrollController: _autoScrollController, + controller: _refreshController, onRefresh: () async { _page = 1; _modelLists.clear(); _innerModelList.clear(); var base = await NetUtil().getList(SAASAPI.announce.list, params: { - 'page': _page, + 'pageNum': _page, 'size': _size, }); _innerModelList = @@ -129,13 +130,19 @@ class _AnnounceViewState extends State { _page++; var base = await NetUtil().getList(SAASAPI.announce.list, params: { - 'page': _page, + 'pageNum': _page, 'size': _size, }); - if (base.total > _innerModelList.length) {} - _innerModelList = - base.rows.map((e) => HomeAnnounceModel.fromJson(e)).toList(); - monthListDepart(_innerModelList); + if (base.total > _modelLists.length) { + _innerModelList = base.rows + .map((e) => HomeAnnounceModel.fromJson(e)) + .toList(); + monthListDepart(_innerModelList); + setState(() {}); + } else { + print('1111111'); + _refreshController.finishLoadCallBack!(noMore: true); + } }, child: _modelLists.isEmpty ? Container() diff --git a/lib/pages/opening_code_page/opening_code_page.dart b/lib/pages/opening_code_page/opening_code_page.dart index d8568dce..7837c110 100644 --- a/lib/pages/opening_code_page/opening_code_page.dart +++ b/lib/pages/opening_code_page/opening_code_page.dart @@ -237,7 +237,7 @@ class _OpeningCodePageState extends State { ? Get.off(() => CertificationPage()) : BotToast.showText(text: '已实名认证'); }, - text: '开门记录', + text: '住户认证', suffix: UserTool.userProvider.userInfoModel! .idCard == null diff --git a/lib/pages/personal/personal_page.dart b/lib/pages/personal/personal_page.dart index ecb2f6c5..c75d5d2a 100644 --- a/lib/pages/personal/personal_page.dart +++ b/lib/pages/personal/personal_page.dart @@ -422,10 +422,7 @@ class _PersonalIndexState extends State // () => HouseOwnersPage( // identify: 4, // ), - '${UserTool.userProvider.defaultHouse?.communityName ?? ''} ' - '${UserTool.userProvider.defaultHouse?.buildingName ?? ''}' - '${UserTool.userProvider.defaultHouse?.unitName ?? ''}' - '${UserTool.userProvider.defaultHouse?.estateName ?? ''}', + '${UserTool.userProvider.defaultHouseString}', ), _function('我的家庭', Assets.newIcon.icWdjt.path, () { Get.to(() => MyFamilyPage()); diff --git a/lib/ui/community/activity/activity_card.dart b/lib/ui/community/activity/activity_card.dart index b2e72ea8..1ae6b365 100644 --- a/lib/ui/community/activity/activity_card.dart +++ b/lib/ui/community/activity/activity_card.dart @@ -9,7 +9,7 @@ import 'package:get/get.dart'; import 'activity_detail_page.dart'; class ActivityCard extends StatelessWidget { - final bool? home; + final bool home; final HomeActivityModel? model; const ActivityCard({ @@ -22,10 +22,9 @@ class ActivityCard extends StatelessWidget { Widget build(BuildContext context) { return ConstrainedBox( - constraints: BoxConstraints(maxHeight: home! ? 450.w : 540.w), + constraints: BoxConstraints(maxHeight: home ? 450.w : 540.w), child: MaterialButton( clipBehavior: Clip.antiAlias, - color: Colors.white, padding: EdgeInsets.zero, onPressed: () => Get.to(() => ActivityDetailPage(id: model!.id)), elevation: 0, @@ -46,7 +45,7 @@ class ActivityCard extends StatelessWidget { child: BeeImageNetwork( imgs: model!.imgList ?? [], width: double.infinity, - height: home! ? 250.w : 340.w, + height: home ? 250.w : 340.w, ), ), ), @@ -78,54 +77,46 @@ class ActivityCard extends StatelessWidget { ], ), 24.hb, - Padding( - padding: EdgeInsets.symmetric(horizontal: 32.w), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - constraints: BoxConstraints(maxWidth: 340.w), - child: Text( - model == null ? '' : model!.title, - maxLines: 2, - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Color(0xD9000000), - fontSize: 28.sp, - fontWeight: FontWeight.bold), - ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + constraints: BoxConstraints(maxWidth: 340.w), + child: Text( + model == null ? '' : model!.title, + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xD9000000), + fontSize: 28.sp, + fontWeight: FontWeight.bold), ), - Spacer(), - ], - ), + ), + Spacer(), + ], ), - Spacer(), - - Padding( - padding: home!?EdgeInsets.only(left: 32.w,right: 32.w,): EdgeInsets.only(left: 32.w,right: 32.w,bottom: 32.w), - child: Row( - children: [ - Flexible( - child: AvatarsParticipate( - avatars: - (model?.avatarImgList?.map((e) => e.url).toList() ?? []), - pNum: model?.registrationNum ?? 0, - hasIcon: false, - - ), + 24.hb, + Row( + children: [ + Flexible( + child: AvatarsParticipate( + avatars: + (model?.avatarImgList?.map((e) => e.url).toList() ?? + []), + pNum: model?.registrationNum ?? 0, + hasIcon: false, ), - // Spacer(), - Offstage( - offstage: ActivityFunc.dateCheck(model!.end) == '已结束', - child: ActivityFunc.dateCheck(model!.end) - .text - .size(24.sp) - .black - .make()), - ], - ), + ), + // Spacer(), + Offstage( + offstage: ActivityFunc.dateCheck(model!.end) == '已结束', + child: ActivityFunc.dateCheck(model!.end) + .text + .size(24.sp) + .black + .make()), + ], ) - ], ), ), diff --git a/lib/ui/community/activity/activity_list_page.dart b/lib/ui/community/activity/activity_list_page.dart index 36a9c46a..60a270e1 100644 --- a/lib/ui/community/activity/activity_list_page.dart +++ b/lib/ui/community/activity/activity_list_page.dart @@ -8,7 +8,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; class ActivityListPage extends StatefulWidget { - ActivityListPage({Key? key}) : super(key: key); + ActivityListPage({Key? key}) : super(key: key); @override _ActivityListPageState createState() => _ActivityListPageState(); @@ -44,9 +44,15 @@ class _ActivityListPageState extends State { padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 20.w), itemBuilder: (context, index) { final HomeActivityModel model = items[index]; - return ActivityCard(model: model); + return Container( + padding: + EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16.w)), + child: ActivityCard(model: model)); }, - separatorBuilder: (_, __) => 20.hb, + separatorBuilder: (_, __) => 32.hb, itemCount: items.length, ); }, diff --git a/lib/ui/function_and_service/work_order/all_order/all_order_view.dart b/lib/ui/function_and_service/work_order/all_order/all_order_view.dart index 3fa79438..db3259d4 100644 --- a/lib/ui/function_and_service/work_order/all_order/all_order_view.dart +++ b/lib/ui/function_and_service/work_order/all_order/all_order_view.dart @@ -1,15 +1,81 @@ +import 'package:aku_new_community/constants/saas_api.dart'; +import 'package:aku_new_community/saas_model/work_order/work_order_list_model.dart'; +import 'package:aku_new_community/utils/network/net_util.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:power_logger/power_logger.dart'; +import 'package:velocity_x/src/extensions/num_ext.dart'; + +import '../work_order_card.dart'; class AllOrderView extends StatefulWidget { - const AllOrderView({Key? key}) : super(key: key); + final EasyRefreshController refreshController; + final int index; + const AllOrderView( + {Key? key, required this.refreshController, required this.index}) + : super(key: key); @override _AllOrderViewState createState() => _AllOrderViewState(); } -class _AllOrderViewState extends State { +class _AllOrderViewState extends State + with SingleTickerProviderStateMixin { + int _page = 1; + int _size = 10; + List _models = []; @override Widget build(BuildContext context) { - return Container(); + return EasyRefresh( + firstRefresh: true, + controller: widget.refreshController, + header: MaterialHeader(), + footer: MaterialFooter(), + onRefresh: () async { + _page = 1; + try { + var base = await NetUtil().getList(SAASAPI.workOrder.list, params: { + 'pageNum': _page, + 'size': _size, + 'status': widget.index == 0 ? null : widget.index, + }); + _models = + base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList(); + } catch (e) { + LoggerData.addData(e.toString()); + } + setState(() {}); + }, + onLoad: () async { + _page++; + var base = await NetUtil().getList(SAASAPI.workOrder.list, params: { + 'pageNum': _page, + 'size': _size, + 'status': widget.index == 0 ? null : widget.index, + }); + if (_models.length < base.total) { + _models.addAll( + base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList()); + setState(() {}); + } else { + widget.refreshController.finishLoad(noMore: true); + } + }, + child: _models.isEmpty + ? Container() + : ListView.separated( + padding: EdgeInsets.all(24.w), + itemBuilder: (context, index) { + return WorkOrderCard( + model: _models[index], + refresh: widget.refreshController.callRefresh, + ); + }, + separatorBuilder: (context, index) { + return 24.w.heightBox; + }, + itemCount: _models.length)); + ; } } diff --git a/lib/ui/function_and_service/work_order/work_order_page.dart b/lib/ui/function_and_service/work_order/work_order_page.dart index ce08179c..e525e28b 100644 --- a/lib/ui/function_and_service/work_order/work_order_page.dart +++ b/lib/ui/function_and_service/work_order/work_order_page.dart @@ -1,8 +1,6 @@ -import 'package:aku_new_community/constants/saas_api.dart'; import 'package:aku_new_community/saas_model/work_order/work_order_list_model.dart'; import 'package:aku_new_community/ui/function_and_service/work_order/publish_work_order_page.dart'; -import 'package:aku_new_community/ui/function_and_service/work_order/work_order_card.dart'; -import 'package:aku_new_community/utils/network/net_util.dart'; +import 'package:aku_new_community/ui/function_and_service/work_order/work_order_view.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/tab_bar/bee_tab_bar.dart'; import 'package:flutter/cupertino.dart'; @@ -10,7 +8,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:power_logger/power_logger.dart'; import 'package:velocity_x/velocity_x.dart'; class WorkOrderPage extends StatefulWidget { @@ -62,68 +59,16 @@ class _WorkOrderPageState extends State ], appBarBottom: BeeTabBar( tabs: _tabs, - onTap: (index) { - _models.clear(); - setState(() {}); - }, controller: _tabController, ), body: TabBarView( controller: _tabController, - children: - _tabs.mapIndexed((e, index) => _getOrderView(index)).toList()), + children: _tabs + .mapIndexed((e, index) => WorkOrderView( + refreshController: _refreshControllers[index], + index: index, + )) + .toList()), ); } - - Widget _getOrderView(int index) { - return EasyRefresh( - firstRefresh: true, - controller: _refreshControllers[index], - header: MaterialHeader(), - footer: MaterialFooter(), - onRefresh: () async { - _page = 1; - try { - var base = await NetUtil().getList(SAASAPI.workOrder.list, params: { - 'pageNum': _page, - 'size': _size, - 'status': index == 0 ? null : index, - }); - _models = - base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList(); - } catch (e) { - LoggerData.addData(e.toString()); - } - setState(() {}); - }, - onLoad: () async { - _page++; - var base = await NetUtil().getList(SAASAPI.workOrder.list, params: { - 'pageNum': _page, - 'size': _size, - 'status': index == 0 ? null : index, - }); - if (_models.length < base.total) { - _models.addAll( - base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList()); - setState(() {}); - } else { - _refreshControllers[index].finishLoad(noMore: true); - } - }, - child: _models.isEmpty - ? Container() - : ListView.separated( - padding: EdgeInsets.all(24.w), - itemBuilder: (context, index) { - return WorkOrderCard( - model: _models[index], - refresh: _refreshControllers[index].callRefresh, - ); - }, - separatorBuilder: (context, index) { - return 24.w.heightBox; - }, - itemCount: _models.length)); - } } diff --git a/lib/ui/function_and_service/work_order/work_order_view.dart b/lib/ui/function_and_service/work_order/work_order_view.dart new file mode 100644 index 00000000..c41c4ec7 --- /dev/null +++ b/lib/ui/function_and_service/work_order/work_order_view.dart @@ -0,0 +1,79 @@ +import 'package:aku_new_community/constants/saas_api.dart'; +import 'package:aku_new_community/saas_model/work_order/work_order_list_model.dart'; +import 'package:aku_new_community/ui/function_and_service/work_order/work_order_card.dart'; +import 'package:aku_new_community/utils/network/net_util.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:power_logger/power_logger.dart'; +import 'package:velocity_x/src/extensions/num_ext.dart'; + +class WorkOrderView extends StatefulWidget { + final EasyRefreshController refreshController; + final int index; + const WorkOrderView( + {Key? key, required this.refreshController, required this.index}) + : super(key: key); + + @override + _WorkOrderViewState createState() => _WorkOrderViewState(); +} + +class _WorkOrderViewState extends State { + int _page = 1; + int _size = 10; + List _models = []; + @override + Widget build(BuildContext context) { + return EasyRefresh( + firstRefresh: true, + controller: widget.refreshController, + header: MaterialHeader(), + footer: MaterialFooter(), + onRefresh: () async { + _page = 1; + try { + var base = await NetUtil().getList(SAASAPI.workOrder.list, params: { + 'pageNum': _page, + 'size': _size, + 'status': widget.index == 0 ? null : widget.index, + }); + _models = + base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList(); + } catch (e) { + LoggerData.addData(e.toString()); + } + setState(() {}); + }, + onLoad: () async { + _page++; + var base = await NetUtil().getList(SAASAPI.workOrder.list, params: { + 'pageNum': _page, + 'size': _size, + 'status': widget.index == 0 ? null : widget.index, + }); + if (_models.length < base.total) { + _models.addAll( + base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList()); + setState(() {}); + } else { + widget.refreshController.finishLoad(noMore: true); + } + }, + child: _models.isEmpty + ? Container() + : ListView.separated( + padding: EdgeInsets.all(24.w), + itemBuilder: (context, index) { + return WorkOrderCard( + model: _models[index], + refresh: widget.refreshController.callRefresh, + ); + }, + separatorBuilder: (context, index) { + return 24.w.heightBox; + }, + itemCount: _models.length)); + ; + } +}