From 1113679ad7f51f7a7db4b7f57c94f0989bad03c8 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Thu, 5 Nov 2020 11:47:00 +0800 Subject: [PATCH] update decoration detail page --- .../decoration_manager_card.dart | 62 ++--- .../decoration_manager_detail_page.dart | 217 ++++++++++++++++++ .../decoration_manager/decoration_util.dart | 58 +++++ 3 files changed, 289 insertions(+), 48 deletions(-) create mode 100644 lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart create mode 100644 lib/ui/sub_pages/decoration_manager/decoration_util.dart diff --git a/lib/ui/sub_pages/decoration_manager/decoration_manager_card.dart b/lib/ui/sub_pages/decoration_manager/decoration_manager_card.dart index 08b36db..c279cde 100644 --- a/lib/ui/sub_pages/decoration_manager/decoration_manager_card.dart +++ b/lib/ui/sub_pages/decoration_manager/decoration_manager_card.dart @@ -3,12 +3,15 @@ import 'package:aku_community_manager/mock_models/users/user_info_model.dart'; import 'package:aku_community_manager/provider/user_provider.dart'; import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/tools/widget_tool.dart'; +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart'; +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_util.dart'; import 'package:aku_community_manager/ui/widgets/inner/aku_chip_box.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:common_utils/common_utils.dart'; import 'package:flutter/material.dart'; import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:aku_community_manager/const/resource.dart'; +import 'package:get/get.dart'; import 'package:provider/provider.dart'; class DecorationManagerCard extends StatefulWidget { @@ -45,9 +48,15 @@ class _DecorationManagerCardState extends State { ), Spacer(), Text( - _getTagName(), + DecorationUIUtil(context).getTagName( + widget.model.type, + widget.model.statusType, + ), style: TextStyle( - color: _getTagColor(), + color: DecorationUIUtil(context).getTagColor( + widget.model.type, + widget.model.statusType, + ), fontSize: 24.w, ), ), @@ -83,7 +92,9 @@ class _DecorationManagerCardState extends State { Align( alignment: Alignment.centerRight, child: AkuMaterialButton( - onPressed: () {}, + onPressed: () { + Get.to(DecorationManagerDetailPage(model: widget.model)); + }, height: 64.w, minWidth: 160.w, color: AppStyle.primaryColor, @@ -134,49 +145,4 @@ class _DecorationManagerCardState extends State { ], ); } - - _getTagName() { - Map managerMap = { - DecorationType.WAIT_HAND_OUT: '待指派', - DecorationType.HAND_OUT: '已指派', - DecorationType.DONE: '已执行', - }; - - Map fixerMap = { - DecorationType.HAND_OUT: '待执行', - DecorationType.DONE: '已执行', - }; - - Map defaultMap = { - DecorationStatusType.DONE: '装修完成', - DecorationStatusType.PROGRESS: '装修中', - }; - - switch (role) { - case USER_ROLE.MANAGER: - return managerMap[widget.model.type]; - break; - case USER_ROLE.PROPERTY: - return fixerMap[widget.model.type]; - break; - default: - return defaultMap[widget.model.statusType]; - break; - } - } - - Color _getTagColor() { - if (role == USER_ROLE.MANAGER || role == USER_ROLE.PROPERTY) { - if (widget.model.type == DecorationType.WAIT_HAND_OUT || - widget.model.type == DecorationType.HAND_OUT) { - return Color(0xFFFF4501); - } else - return AppStyle.minorTextColor; - } else { - if (widget.model.statusType == DecorationStatusType.PROGRESS) { - return Color(0xFFFF4501); - } else - return Color(0xFF32B814); - } - } } diff --git a/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart b/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart new file mode 100644 index 0000000..33d6ca3 --- /dev/null +++ b/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart @@ -0,0 +1,217 @@ +import 'package:aku_community_manager/mock_models/decoration/decoration_model.dart'; +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/tools/widget_tool.dart'; +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_util.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_title_box.dart'; +import 'package:aku_community_manager/tools/screen_tool.dart'; +import 'package:aku_community_manager/const/resource.dart'; +import 'package:flutter/material.dart'; + +class DecorationManagerDetailPage extends StatefulWidget { + final DecorationModel model; + DecorationManagerDetailPage({Key key, @required this.model}) + : super(key: key); + + @override + _DecorationManagerDetailStatePage createState() => + _DecorationManagerDetailStatePage(); +} + +class _DecorationManagerDetailStatePage + extends State { + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '装修详情', + body: ListView( + padding: EdgeInsets.symmetric(vertical: 16.w), + children: [ + _buildInfo(), + _buildFinishWorkCheck(), + _buildCycleCheck(), + _buildCheckDetail(), + ], + ), + ); + } + + _buildInfo() { + return AkuTitleBox( + title: '装修信息', + spacing: 24, + suffix: Text( + DecorationUIUtil(context).getTagName( + widget.model.type, + widget.model.statusType, + ), + style: TextStyle( + color: DecorationUIUtil(context).getTagColor( + widget.model.type, + widget.model.statusType, + ), + fontSize: 24.w, + ), + ), + children: [ + _buildInfoCard( + tag: '家', + midTop: widget.model.userHomeModel.plot, + midBottom: widget.model.userHomeModel.detailAddr, + name: '业主:' + widget.model.userHomeModel.userName, + phone: widget.model.userHomeModel.phone, + rightTopWidget: Placeholder(), + ), + AkuBox.h(16), + _buildInfoCard( + tag: '装', + midTop: widget.model.decorationTeamModel.name, + name: '负责人:' + widget.model.decorationTeamModel.userName, + phone: widget.model.decorationTeamModel.phone, + ), + ], + ); + } + + _buildInfoCard({ + String tag, + String midTop, + String midBottom, + String name, + String phone, + Widget rightTopWidget = const SizedBox(), + }) { + return Stack( + children: [ + Container( + child: Column( + children: [ + Expanded( + child: Row( + children: [ + AkuBox.w(32), + Container( + height: 96.w, + width: 96.w, + alignment: Alignment.center, + child: Text( + tag, + style: TextStyle( + color: AppStyle.secondaryColor, + fontWeight: FontWeight.bold, + fontSize: 32.sp, + ), + ), + decoration: BoxDecoration( + color: Color(0xFFE9F2FF), + borderRadius: BorderRadius.circular(48.w), + ), + ), + AkuBox.w(24), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + midTop, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 32.sp, + fontWeight: FontWeight.bold, + ), + ), + midBottom == null + ? SizedBox() + : Text( + midBottom, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 32.sp, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ], + )), + Divider( + height: 1.w, + thickness: 1.w, + ), + Row( + children: [ + AkuBox.h(88), + AkuBox.w(32), + Image.asset( + R.ASSETS_MESSAGE_IC_PEOPLE_PNG, + height: 40.w, + width: 40.w, + ), + Text( + name, + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 24.sp, + ), + ), + Spacer(), + Image.asset( + R.ASSETS_MESSAGE_IC_PHONE_PNG, + height: 40.w, + width: 40.w, + ), + Text( + '电话:$phone', + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 24.sp, + ), + ), + AkuBox.w(42), + ], + ), + ], + ), + height: 248.w, + decoration: BoxDecoration( + color: Color(0xFFF9F9F9), + borderRadius: BorderRadius.circular(8.w), + ), + ), + Positioned( + top: -30.w, + right: -30.w, + width: 140.w, + height: 140.w, + child: rightTopWidget, + ), + ], + ); + } + + _buildFinishWorkCheck() { + return AkuTitleBox( + title: '完工检查', + spacing: 24, + children: [], + ); + } + + _buildCycleCheck() { + return AkuTitleBox( + title: '周期检查', + spacing: 24, + children: [], + ); + } + + _buildCheckDetail() { + return AkuTitleBox( + title: '执行信息', + spacing: 24, + children: [], + ); + } +} diff --git a/lib/ui/sub_pages/decoration_manager/decoration_util.dart b/lib/ui/sub_pages/decoration_manager/decoration_util.dart new file mode 100644 index 0000000..e939efa --- /dev/null +++ b/lib/ui/sub_pages/decoration_manager/decoration_util.dart @@ -0,0 +1,58 @@ +import 'package:aku_community_manager/mock_models/decoration/decoration_model.dart'; +import 'package:aku_community_manager/mock_models/users/user_info_model.dart'; +import 'package:aku_community_manager/provider/user_provider.dart'; +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class DecorationUIUtil { + BuildContext context; + USER_ROLE get role => + Provider.of(context, listen: false).userInfoModel.role; + + DecorationUIUtil(this.context); + String getTagName(DecorationType type, DecorationStatusType statusType) { + Map managerMap = { + DecorationType.WAIT_HAND_OUT: '待指派', + DecorationType.HAND_OUT: '已指派', + DecorationType.DONE: '已执行', + }; + + Map fixerMap = { + DecorationType.HAND_OUT: '待执行', + DecorationType.DONE: '已执行', + }; + + Map defaultMap = { + DecorationStatusType.DONE: '装修完成', + DecorationStatusType.PROGRESS: '装修中', + }; + + switch (role) { + case USER_ROLE.MANAGER: + return managerMap[type]; + break; + case USER_ROLE.PROPERTY: + return fixerMap[type]; + break; + default: + return defaultMap[statusType]; + break; + } + } + + Color getTagColor(DecorationType type, DecorationStatusType statusType) { + if (role == USER_ROLE.MANAGER || role == USER_ROLE.PROPERTY) { + if (type == DecorationType.WAIT_HAND_OUT || + type == DecorationType.HAND_OUT) { + return Color(0xFFFF4501); + } else + return AppStyle.minorTextColor; + } else { + if (statusType == DecorationStatusType.PROGRESS) { + return Color(0xFFFF4501); + } else + return Color(0xFF32B814); + } + } +}