From 222fea947350d22808738136aaef261a3a725405 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Fri, 28 May 2021 16:54:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E6=96=B0=E7=89=88?= =?UTF-8?q?=E8=A3=85=E4=BF=AE=E7=AE=A1=E7=90=86=20=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=E5=85=B6=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/api.dart | 10 + lib/constants/application_objects.dart | 4 +- .../new_renovation_list_model.dart | 197 +++++++++++++++ .../new_renovation_list_model.g.dart | 45 ++++ .../new_renovation_add_page.dart | 198 ++++++++++++++++ .../new_renovation/new_renovation_card.dart | 169 +++++++++++++ .../new_renovation_detail_page.dart | 224 ++++++++++++++++++ .../new_renovation/new_renovation_page.dart | 81 +++++++ .../new_renovation/new_renovation_view.dart | 65 +++++ lib/widget/others/bee_input_row.dart | 58 +++++ lib/widget/others/user_tool.dart | 10 + 11 files changed, 1059 insertions(+), 2 deletions(-) create mode 100644 lib/models/new_renovation/new_renovation_list_model.dart create mode 100644 lib/models/new_renovation/new_renovation_list_model.g.dart create mode 100644 lib/pages/renovation_manage/new_renovation/new_renovation_add_page.dart create mode 100644 lib/pages/renovation_manage/new_renovation/new_renovation_card.dart create mode 100644 lib/pages/renovation_manage/new_renovation/new_renovation_detail_page.dart create mode 100644 lib/pages/renovation_manage/new_renovation/new_renovation_page.dart create mode 100644 lib/pages/renovation_manage/new_renovation/new_renovation_view.dart create mode 100644 lib/widget/others/bee_input_row.dart create mode 100644 lib/widget/others/user_tool.dart diff --git a/lib/constants/api.dart b/lib/constants/api.dart index ec627053..c91e86a3 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -258,6 +258,16 @@ class _Manager { ///设施预约:查询当前设施当前时间之后的预约时段 String get facilityOrderDateList => '/user/facilitiesAppointment/findFacilitiesAppointmentDate'; + + ///新版装修管理:查询所有的新版装修信息 + String get newRenovationList => '/user/userDecorationNew/list'; + + ///新版装修管理:添加新版装修信息(申请装修) + String get insertNewRenovation => '/user/userDecorationNew/insert'; + + ///app 新版装修:申请完工检查 + String get applyCompleteRenovation => + '/user/userDecorationNew/applicationCompletion'; } class _Community { diff --git a/lib/constants/application_objects.dart b/lib/constants/application_objects.dart index 7e32a7c2..4150d408 100644 --- a/lib/constants/application_objects.dart +++ b/lib/constants/application_objects.dart @@ -1,5 +1,6 @@ // import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:aku_community/pages/renovation_manage/new_renovation/new_renovation_page.dart'; import 'package:flutter/material.dart'; import 'package:aku_community/const/resource.dart'; @@ -13,7 +14,6 @@ import 'package:aku_community/pages/goods_manage_page/select_borrow_return_page. import 'package:aku_community/pages/industry_committee/industry_committee_page.dart'; import 'package:aku_community/pages/life_pay/life_pay_page.dart'; import 'package:aku_community/pages/one_alarm/widget/alarm_page.dart'; -import 'package:aku_community/pages/renovation_manage/renovation_manage_page.dart'; import 'package:aku_community/pages/service_browse/service_browse_page.dart'; import 'package:aku_community/pages/setting_page/settings_page.dart'; import 'package:aku_community/pages/things_page/fixed_submit_page.dart'; @@ -81,7 +81,7 @@ List appObjects = [ () => AdvicePage(type: AdviceType.COMPLAIN)), AO('问卷调查', R.ASSETS_APPLICATIONS_QUESTION_PNG, () => QuestionnairePage()), AO('装修管理', R.ASSETS_APPLICATIONS_DECORATION_PNG, - () => RenovationManagePage()), + () => NewRenovationPage()), AO('借还管理', R.ASSETS_APPLICATIONS_BORROW_PNG, () => SelectBorrowReturnPage()), AO('一键报警', R.ASSETS_APPLICATIONS_POLICE_PNG, () => AlarmPage()), AO('设施预约', R.ASSETS_ICONS_TOOL_FACILITY_PNG, () => FacilityAppointmentPage()), diff --git a/lib/models/new_renovation/new_renovation_list_model.dart b/lib/models/new_renovation/new_renovation_list_model.dart new file mode 100644 index 00000000..778d5587 --- /dev/null +++ b/lib/models/new_renovation/new_renovation_list_model.dart @@ -0,0 +1,197 @@ +import 'package:equatable/equatable.dart'; +import 'package:flustars/flustars.dart'; +import 'package:flutter/material.dart'; +import 'package:json_annotation/json_annotation.dart'; + +import 'package:aku_community/base/base_style.dart'; + +part 'new_renovation_list_model.g.dart'; + +@JsonSerializable() +class NewRenovationListModel extends Equatable { + final int id; + final String roomName; + final int status; + final String constructionUnit; + final String director; + final String directorTel; + final String expectedBegin; + final String expectedEnd; + final String? actualBegin; + final String? actualEnd; + final String? rejectReason; + final String? reviewerName; + final String? auditDate; + final String? trackerName; + final String? applicationCheckDate; + final int? isQualified; + final String createName; + final String createDate; + final List checkVoList; + NewRenovationListModel({ + required this.id, + required this.roomName, + required this.status, + required this.constructionUnit, + required this.director, + required this.directorTel, + required this.expectedBegin, + required this.expectedEnd, + this.actualBegin, + this.actualEnd, + this.rejectReason, + this.reviewerName, + this.auditDate, + this.trackerName, + this.applicationCheckDate, + this.isQualified, + required this.createName, + required this.createDate, + required this.checkVoList, + }); + + @override + List get props { + return [ + id, + roomName, + status, + constructionUnit, + director, + directorTel, + expectedBegin, + expectedEnd, + actualBegin, + actualEnd, + rejectReason, + reviewerName, + auditDate, + trackerName, + applicationCheckDate, + isQualified, + createName, + createDate, + checkVoList, + ]; + } + + factory NewRenovationListModel.fromJson(Map json) => + _$NewRenovationListModelFromJson(json); + + String get statusString { + switch (this.status) { + case 1: + return '申请中'; + case 2: + return '装修中'; + case 3: + return '申请驳回'; + // case 4: + // return '装修中'; + case 5: + return '申请完工检查'; + case 6: + return '完工检查中'; + case 7: + return '检查通过'; + case 8: + return '检查不通过'; + default: + return '未知'; + } + } + + Color get statusColor { + switch (this.status) { + case 1: + return kPrimaryColor; + case 2: + return Colors.green; + case 3: + return Colors.red; + // case 4: + // return ktextPrimary; + case 5: + return kPrimaryColor; + case 6: + return ktextSubColor; + + case 7: + return Colors.green; + case 8: + return Colors.red; + default: + return ktextPrimary; + } + } + + String get expectBginString => + DateUtil.formatDateStr(this.expectedBegin, format: 'yyyy-MM-dd HH:mm'); + + String get expectEndString => + DateUtil.formatDateStr(this.expectedEnd, format: 'yyyy-MM-dd HH:mm'); + + String get actualBginString => DateUtil.formatDateStr(this.actualBegin ?? '', + format: 'yyyy-MM-dd HH:mm'); + + String get actualEndString => + DateUtil.formatDateStr(this.actualEnd ?? '', format: 'yyyy-MM-dd HH:mm'); + String get expectSlot => + '${expectBginString}-${DateUtil.formatDateStr(this.expectedEnd, format: 'HH:mm')}'; + String get actualSlot => + '${actualBginString}-${DateUtil.formatDateStr(this.actualEnd ?? '', format: 'HH:mm')}'; + + String get qualitfied { + switch (this.isQualified) { + case 1: + return '合格'; + case 2: + return '不合格'; + default: + return '未知'; + } + } +} + +@JsonSerializable() +class CheckVoList extends Equatable { + final int id; + final int decorationNewId; + final String detail; + final int isQualified; + final String createName; + final String createDate; + CheckVoList({ + required this.id, + required this.decorationNewId, + required this.detail, + required this.isQualified, + required this.createName, + required this.createDate, + }); + + @override + List get props { + return [ + id, + decorationNewId, + detail, + isQualified, + createName, + createDate, + ]; + } + + factory CheckVoList.fromJson(Map json) => + _$CheckVoListFromJson(json); + String get qualitfied { + switch (this.isQualified) { + case 1: + return '合格'; + case 2: + return '不合格'; + default: + return '未知'; + } + } +} diff --git a/lib/models/new_renovation/new_renovation_list_model.g.dart b/lib/models/new_renovation/new_renovation_list_model.g.dart new file mode 100644 index 00000000..2532e6e7 --- /dev/null +++ b/lib/models/new_renovation/new_renovation_list_model.g.dart @@ -0,0 +1,45 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'new_renovation_list_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +NewRenovationListModel _$NewRenovationListModelFromJson( + Map json) { + return NewRenovationListModel( + id: json['id'] as int, + roomName: json['roomName'] as String, + status: json['status'] as int, + constructionUnit: json['constructionUnit'] as String, + director: json['director'] as String, + directorTel: json['directorTel'] as String, + expectedBegin: json['expectedBegin'] as String, + expectedEnd: json['expectedEnd'] as String, + actualBegin: json['actualBegin'] as String?, + actualEnd: json['actualEnd'] as String?, + rejectReason: json['rejectReason'] as String?, + reviewerName: json['reviewerName'] as String?, + auditDate: json['auditDate'] as String?, + trackerName: json['trackerName'] as String?, + applicationCheckDate: json['applicationCheckDate'] as String?, + isQualified: json['isQualified'] as int?, + createName: json['createName'] as String, + createDate: json['createDate'] as String, + checkVoList: (json['checkVoList'] as List) + .map((e) => CheckVoList.fromJson(e as Map)) + .toList(), + ); +} + +CheckVoList _$CheckVoListFromJson(Map json) { + return CheckVoList( + id: json['id'] as int, + decorationNewId: json['decorationNewId'] as int, + detail: json['detail'] as String, + isQualified: json['isQualified'] as int, + createName: json['createName'] as String, + createDate: json['createDate'] as String, + ); +} diff --git a/lib/pages/renovation_manage/new_renovation/new_renovation_add_page.dart b/lib/pages/renovation_manage/new_renovation/new_renovation_add_page.dart new file mode 100644 index 00000000..e45a01d2 --- /dev/null +++ b/lib/pages/renovation_manage/new_renovation/new_renovation_add_page.dart @@ -0,0 +1,198 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/constants/api.dart'; +import 'package:aku_community/utils/network/base_model.dart'; +import 'package:aku_community/utils/network/net_util.dart'; +import 'package:aku_community/widget/bee_divider.dart'; +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:aku_community/widget/buttons/bottom_button.dart'; +import 'package:aku_community/widget/others/bee_input_row.dart'; +import 'package:aku_community/widget/others/user_tool.dart'; +import 'package:aku_community/widget/picker/bee_date_picker.dart'; +import 'package:bot_toast/bot_toast.dart'; +import 'package:flustars/flustars.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:aku_community/utils/headers.dart'; +import 'package:aku_community/extensions/widget_list_ext.dart'; +import 'package:get/get.dart'; + +class NewRenovationAddPage extends StatefulWidget { + NewRenovationAddPage({Key? key}) : super(key: key); + + @override + _NewRenovationAddPageState createState() => _NewRenovationAddPageState(); +} + +class _NewRenovationAddPageState extends State { + late TextEditingController _unitController; + late TextEditingController _directorController; + late TextEditingController _telController; + DateTime? startDate; + DateTime? endDate; + + @override + void initState() { + super.initState(); + _unitController = TextEditingController(); + _directorController = TextEditingController(); + _telController = TextEditingController(); + } + + @override + void dispose() { + _unitController.dispose(); + _directorController.dispose(); + _telController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '申请装修', + body: ListView( + children: [ + 32.w.heightBox, + _buildInputCard(), + _datePick(), + ], + ), + bottomNavi: BottomButton( + onPressed: () async { + if (UserTool.appProveider.selectedHouse?.status == 4) { + BaseModel baseModel = + await NetUtil().post(API.manager.insertNewRenovation, + params: { + "estateId": + UserTool.appProveider.selectedHouse!.estateId, + "constructionUnit": _unitController.text, + "director": _directorController.text, + "directorTel": _telController.text, + "expectedBegin": DateUtil.formatDate(startDate), + "expectedEnd": DateUtil.formatDate(endDate) + }, + showMessage: true); + + if (baseModel.status ?? false) { + Get.back(); + } + } else { + BotToast.showText(text: '您未拥有通过审核的房产!'); + } + }, + child: '立即申请'.text.size(32.sp).color(ktextPrimary).bold.make()), + ); + } + + Widget _buildInputCard() { + return Container( + width: double.infinity, + decoration: BoxDecoration(color: Colors.white), + padding: EdgeInsets.all(32.w), + child: Column( + children: [ + BeeInputRow( + title: '装修公司名称', + controller: _unitController, + hintText: '请输入装修公司名称'), + BeeInputRow( + title: '负责人姓名', + controller: _directorController, + hintText: '请输入负责人姓名'), + BeeInputRow( + title: '负责人电话', controller: _telController, hintText: '请输入联系电话'), + ].sepWidget(separate: 40.w.heightBox), + ), + ); + } + + Widget _datePick() { + return Container( + padding: EdgeInsets.symmetric(vertical: 32.w), + width: double.infinity, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '预约时间', + style: TextStyle(fontWeight: FontWeight.bold), + ).pSymmetric(h: 32.w), + SizedBox( + height: 120.w, + child: Row( + children: [ + MaterialButton( + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + height: 120.w, + onPressed: () async { + DateTime _currentTime = DateTime.now(); + DateTime? date = await BeeDatePicker.pick( + _currentTime.add(Duration(minutes: 60)), + mode: CupertinoDatePickerMode.dateAndTime, + min: _currentTime.add(Duration(minutes: 30)), + max: _currentTime.add(Duration(days: 30)), + ); + if (date != null) { + startDate = date; + setState(() {}); + } + }, + child: Text( + startDate == null + ? '请选择开始时间' + : DateUtil.formatDate( + startDate, + format: 'yyyy-MM-dd HH:mm', + ), + style: TextStyle( + color: ktextSubColor, + ), + ), + ).expand(), + Icon(Icons.arrow_forward), + MaterialButton( + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + height: 120.w, + onPressed: () async { + DateTime? date = await BeeDatePicker.pick( + startDate == null + ? DateTime.now().add(Duration(minutes: 90)) + : startDate!.add(Duration(minutes: 30)), + min: startDate == null + ? DateTime.now().add(Duration(minutes: 60)) + : startDate!.add(Duration(minutes: 30)), + max: startDate == null + ? DateTime.now().add(Duration(days: 2)) + : (startDate!).add(Duration(days: 2)), + mode: CupertinoDatePickerMode.dateAndTime, + ); + if (date != null) { + endDate = date; + setState(() {}); + } + }, + child: Text( + endDate == null + ? '请选择结束时间' + : DateUtil.formatDate( + endDate, + format: 'yyyy-MM-dd HH:mm', + ), + style: TextStyle( + color: ktextSubColor, + ), + ), + ).expand(), + ], + ), + ), + BeeDivider.horizontal( + indent: 32.w, + endIndent: 32.w, + ), + ], + ), + ); + } +} diff --git a/lib/pages/renovation_manage/new_renovation/new_renovation_card.dart b/lib/pages/renovation_manage/new_renovation/new_renovation_card.dart new file mode 100644 index 00000000..0e811978 --- /dev/null +++ b/lib/pages/renovation_manage/new_renovation/new_renovation_card.dart @@ -0,0 +1,169 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/constants/api.dart'; +import 'package:aku_community/models/new_renovation/new_renovation_list_model.dart'; +import 'package:aku_community/pages/renovation_manage/new_renovation/new_renovation_detail_page.dart'; +import 'package:aku_community/utils/network/base_model.dart'; +import 'package:aku_community/utils/network/net_util.dart'; +import 'package:aku_community/widget/bee_divider.dart'; +import 'package:aku_community/widget/buttons/card_bottom_button.dart'; +import 'package:flutter/material.dart'; +import 'package:aku_community/utils/headers.dart'; +import 'package:get/get.dart'; + +class NewRenovationCard extends StatefulWidget { + final NewRenovationListModel model; + final VoidCallback callRefresh; + NewRenovationCard({Key? key, required this.model, required this.callRefresh}) + : super(key: key); + + @override + _NewRenovationCardState createState() => _NewRenovationCardState(); +} + +class _NewRenovationCardState extends State { + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () { + Get.to(() => NewRenovationDetailPage(model: widget.model)); + }, + child: Container( + width: double.infinity, + padding: EdgeInsets.all(24.w), + decoration: BoxDecoration( + color: Colors.white, borderRadius: BorderRadius.circular(8.w)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + widget.model.roomName, + style: TextStyle( + fontSize: 32.sp, + fontWeight: FontWeight.bold, + color: ktextPrimary, + ), + ), + Spacer(), + widget.model.statusString.text + .size(30.sp) + .color(widget.model.statusColor) + .bold + .make(), + ], + ), + 16.w.heightBox, + BeeDivider.horizontal(), + 24.w.heightBox, + ...[ + _rowTile( + R.ASSETS_ICONS_APPOINTMENT_CODE_PNG, + '装修公司', + widget.model.constructionUnit.text + .size(24.sp) + .color(ktextSubColor) + .make(), + ), + _rowTile( + R.ASSETS_ICONS_APPOINTMENT_CODE_PNG, + '负责人姓名', + widget.model.director.text + .size(24.sp) + .color(ktextSubColor) + .make(), + ), + _rowTile( + R.ASSETS_ICONS_APPOINTMENT_CODE_PNG, + '负责人电话', + widget.model.directorTel.text + .size(24.sp) + .color(ktextSubColor) + .make(), + ), + _rowTile( + R.ASSETS_ICONS_APPOINTMENT_CODE_PNG, + '预计装修时间', + widget.model.expectSlot.text + .size(24.sp) + .color(ktextSubColor) + .make(), + ), + ..._nullableRowTile( + widget.model.actualEnd.isEmptyOrNull, + R.ASSETS_ICONS_APPOINTMENT_CODE_PNG, + '实际装修时间', + widget.model.actualSlot.text + .size(24.sp) + .color(ktextSubColor) + .make()) + ].sepWidget(separate: 12.w.heightBox), + ..._bottomWidgets(), + ], + ), + ), + ); + } + + List _bottomWidgets() { + return (widget.model.status != 2) + ? [] + : [ + 40.w.heightBox, + Row( + children: [Spacer(), ..._getButtons()], + ), + ]; + } + + List _getButtons() { + List buttons = []; + switch (widget.model.status) { + case 2: + buttons = [ + CardBottomButton.yellow( + text: '申请完工检查', + onPressed: () async { + BaseModel baseModel = + await NetUtil().get(API.manager.applyCompleteRenovation, + params: { + "userDecorationNewId": widget.model.id, + }, + showMessage: true); + if (baseModel.status ?? false) { + widget.callRefresh(); + } + }) + ]; + break; + default: + buttons = []; + } + return buttons; + } + + _nullableRowTile( + bool isNull, String assetPath, String title, Widget content) { + return isNull + ? [] + : [ + _rowTile(assetPath, title, content), + ]; + } + + Widget _rowTile(String assetPath, String titile, Widget content) { + return Row( + children: [ + Image.asset( + assetPath, + width: 40.w, + height: 40.w, + ), + 12.w.widthBox, + titile.text.size(24.sp).color(ktextSubColor).make(), + Spacer(), + content, + ], + ); + } +} diff --git a/lib/pages/renovation_manage/new_renovation/new_renovation_detail_page.dart b/lib/pages/renovation_manage/new_renovation/new_renovation_detail_page.dart new file mode 100644 index 00000000..eac89433 --- /dev/null +++ b/lib/pages/renovation_manage/new_renovation/new_renovation_detail_page.dart @@ -0,0 +1,224 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/models/new_renovation/new_renovation_list_model.dart'; +import 'package:aku_community/widget/bee_divider.dart'; +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:flutter/material.dart'; +import 'package:aku_community/utils/headers.dart'; + +class NewRenovationDetailPage extends StatefulWidget { + final NewRenovationListModel model; + NewRenovationDetailPage({Key? key, required this.model}) : super(key: key); + + @override + _NewRenovationDetailPageState createState() => + _NewRenovationDetailPageState(); +} + +class _NewRenovationDetailPageState extends State { + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '装修详情', + body: ListView( + padding: EdgeInsets.all(32.w), + children: [ + _renovationInfo(), + 40.w.heightBox, + _contentWidget(), + ..._checkWidge(), + ], + ), + ); + } + + Widget _contentWidget() { + return Container( + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, borderRadius: BorderRadius.circular(8.w)), + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + '装修反馈'.text.size(32.sp).color(ktextPrimary).bold.make(), + Spacer(), + ], + ), + 16.w.heightBox, + BeeDivider.horizontal(), + 20.w.heightBox, + (widget.model.rejectReason ?? '') + .text + .size(28.sp) + .color(ktextPrimary) + .make(), + ...widget.model.auditDate.isEmptyOrNull + ? [] + : [ + 40.w.heightBox, + Row( + children: [ + Spacer(), + widget.model.auditDate!.text + .size(24.sp) + .color(ktextSubColor) + .make(), + ], + ), + ], + ...widget.model.checkVoList.isEmpty ? [] : [..._checkWidge()] + ], + ), + ); + } + + List _checkWidge() { + return widget.model.checkVoList + .map((e) => Container( + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w)), + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + child: Column( + children: [ + 16.w.heightBox, + BeeDivider.horizontal(), + 20.w.heightBox, + Row( + children: [ + '完工检查${widget.model.checkVoList.indexOf(e)}' + .text + .size(32.sp) + .color(ktextPrimary) + .bold + .make(), + Spacer(), + ], + ), + 12.w.heightBox, + e!.qualitfied.text + .size(28.sp) + .color(e.isQualified == 1 ? Colors.green : Colors.red) + .make(), + 20.w.heightBox, + Row( + children: [ + Spacer(), + (e.createDate) + .text + .size(24.sp) + .color(ktextSubColor) + .make(), + ], + ), + ], + ), + )) + .toList(); + } + + Widget _renovationInfo() { + return Container( + width: double.infinity, + padding: EdgeInsets.all(24.w), + decoration: BoxDecoration( + color: Colors.white, borderRadius: BorderRadius.circular(8.w)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + widget.model.roomName, + style: TextStyle( + fontSize: 32.sp, + fontWeight: FontWeight.bold, + color: ktextPrimary, + ), + ), + Spacer(), + widget.model.statusString.text + .size(30.sp) + .color(widget.model.statusColor) + .bold + .make(), + ], + ), + 16.w.heightBox, + BeeDivider.horizontal(), + 24.w.heightBox, + ...[ + _rowTile( + R.ASSETS_ICONS_APPOINTMENT_CODE_PNG, + '装修公司', + widget.model.constructionUnit.text + .size(24.sp) + .color(ktextSubColor) + .make(), + ), + _rowTile( + R.ASSETS_ICONS_APPOINTMENT_CODE_PNG, + '负责人姓名', + widget.model.director.text + .size(24.sp) + .color(ktextSubColor) + .make(), + ), + _rowTile( + R.ASSETS_ICONS_APPOINTMENT_CODE_PNG, + '负责人电话', + widget.model.directorTel.text + .size(24.sp) + .color(ktextSubColor) + .make(), + ), + _rowTile( + R.ASSETS_ICONS_APPOINTMENT_CODE_PNG, + '预计装修时间', + widget.model.expectSlot.text + .size(24.sp) + .color(ktextSubColor) + .make(), + ), + ..._nullableRowTile( + widget.model.actualEnd.isEmptyOrNull, + R.ASSETS_ICONS_APPOINTMENT_CODE_PNG, + '实际装修时间', + widget.model.actualSlot.text + .size(24.sp) + .color(ktextSubColor) + .make()) + ].sepWidget(separate: 12.w.heightBox), + ], + ), + ); + } + + _nullableRowTile( + bool isNull, String assetPath, String title, Widget content) { + return isNull + ? [] + : [ + _rowTile(assetPath, title, content), + ]; + } + + Widget _rowTile(String assetPath, String titile, Widget content) { + return Row( + children: [ + Image.asset( + assetPath, + width: 40.w, + height: 40.w, + ), + 12.w.widthBox, + titile.text.size(24.sp).color(ktextSubColor).make(), + Spacer(), + content, + ], + ); + } +} diff --git a/lib/pages/renovation_manage/new_renovation/new_renovation_page.dart b/lib/pages/renovation_manage/new_renovation/new_renovation_page.dart new file mode 100644 index 00000000..06eac954 --- /dev/null +++ b/lib/pages/renovation_manage/new_renovation/new_renovation_page.dart @@ -0,0 +1,81 @@ +import 'package:aku_community/pages/renovation_manage/new_renovation/new_renovation_add_page.dart'; +import 'package:aku_community/pages/renovation_manage/new_renovation/new_renovation_view.dart'; +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:aku_community/utils/headers.dart'; +import 'package:get/get.dart'; + +class NewRenovationPage extends StatefulWidget { + NewRenovationPage({Key? key}) : super(key: key); + + @override + _NewRenovationPageState createState() => _NewRenovationPageState(); +} + +class _NewRenovationPageState extends State + with TickerProviderStateMixin { + List _tabs = [ + '申请中', + '装修中', + '申请驳回', + '申请完工检查', + '完工检查中', + '检查通过', + '检查未通过' + ]; + late TabController _tabController; + @override + void initState() { + super.initState(); + _tabController = TabController(length: _tabs.length, vsync: this); + } + + @override + void dispose() { + _tabController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '装修管理', + appBarBottom: PreferredSize( + preferredSize: Size.fromHeight(88.w), + child: BeeTabBar( + controller: _tabController, + tabs: _tabs, + scrollable: true, + ), + ), + actions: [ + IconButton( + icon: Icon( + CupertinoIcons.plus_circle, + color: Colors.black, + ), + onPressed: () { + Get.to(() => NewRenovationAddPage()); + }), + ], + body: TabBarView( + children: List.generate(_tabs.length, (index) => _getViews(index)), + controller: _tabController, + ), + ); + } + + _getViews(index) { + if (index > 2) { + return NewRenovationView( + index: index + 1, + ); + } else { + return NewRenovationView( + index: index, + ); + } + } +} diff --git a/lib/pages/renovation_manage/new_renovation/new_renovation_view.dart b/lib/pages/renovation_manage/new_renovation/new_renovation_view.dart new file mode 100644 index 00000000..5dba2ad4 --- /dev/null +++ b/lib/pages/renovation_manage/new_renovation/new_renovation_view.dart @@ -0,0 +1,65 @@ +import 'package:aku_community/constants/api.dart'; +import 'package:aku_community/models/new_renovation/new_renovation_list_model.dart'; +import 'package:aku_community/pages/renovation_manage/new_renovation/new_renovation_card.dart'; +import 'package:aku_community/pages/things_page/widget/bee_list_view.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:aku_community/utils/headers.dart'; + +class NewRenovationView extends StatefulWidget { + final int index; + NewRenovationView({Key? key, required this.index}) : super(key: key); + + @override + _NewRenovationViewState createState() => _NewRenovationViewState(); +} + +class _NewRenovationViewState extends State + with AutomaticKeepAliveClientMixin { + late EasyRefreshController _refreshController; + @override + void initState() { + super.initState(); + _refreshController = EasyRefreshController(); + } + + @override + void dispose() { + _refreshController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BeeListView( + path: API.manager.newRenovationList, + extraParams: { + "userDecorationNewStatus": widget.index + 1, + }, + controller: _refreshController, + convert: (models) { + return models.tableList! + .map((e) => NewRenovationListModel.fromJson(e)) + .toList(); + }, + builder: (items) { + return ListView.separated( + padding: EdgeInsets.all(32.w), + itemBuilder: (context, index) { + return NewRenovationCard( + model: items[index], + callRefresh: () { + _refreshController.callRefresh(); + }, + ); + }, + separatorBuilder: (_, __) { + return 24.w.heightBox; + }, + itemCount: items.length); + }); + } + + @override + bool get wantKeepAlive => true; +} diff --git a/lib/widget/others/bee_input_row.dart b/lib/widget/others/bee_input_row.dart new file mode 100644 index 00000000..34f5cefa --- /dev/null +++ b/lib/widget/others/bee_input_row.dart @@ -0,0 +1,58 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:flutter/material.dart'; +import 'package:aku_community/utils/headers.dart'; +import 'package:flutter/services.dart'; + +class BeeInputRow extends StatefulWidget { + final String title; + final TextEditingController controller; + final List? formatters; + final String? hintText; + BeeInputRow( + {Key? key, + required this.title, + required this.controller, + this.formatters, + required this.hintText}) + : super(key: key); + + @override + _BeeInputRowState createState() => _BeeInputRowState(); +} + +class _BeeInputRowState extends State { + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + widget.title.text.size(28.sp).color(ktextPrimary).make(), + 32.w.heightBox, + TextField( + inputFormatters: widget.formatters, + controller: widget.controller, + textAlign: TextAlign.start, + onChanged: (value) { + setState(() {}); + }, + decoration: InputDecoration( + hintText: widget.hintText ?? '', + isDense: true, + contentPadding: EdgeInsets.zero, + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Color(0xFFE8E8E8), width: 2.w), + ), + ), + style: TextStyle( + fontSize: 36.sp, + fontWeight: FontWeight.bold, + color: ktextPrimary, + ), + ), + ], + ), + ); + } +} diff --git a/lib/widget/others/user_tool.dart b/lib/widget/others/user_tool.dart new file mode 100644 index 00000000..d705a4ad --- /dev/null +++ b/lib/widget/others/user_tool.dart @@ -0,0 +1,10 @@ +import 'package:aku_community/provider/app_provider.dart'; +import 'package:aku_community/provider/user_provider.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; + +class UserTool { + static UserProvider get userProvider => + Provider.of(Get.context!, listen: false); + static AppProvider get appProveider => Provider.of(Get.context!,listen: false); +}