diff --git a/assets/manage/circuit.png b/assets/manage/circuit.png new file mode 100644 index 0000000..f488f4a Binary files /dev/null and b/assets/manage/circuit.png differ diff --git a/assets/manage/security.png b/assets/manage/security.png new file mode 100644 index 0000000..b4f4c6b Binary files /dev/null and b/assets/manage/security.png differ diff --git a/assets/manage/wall.png b/assets/manage/wall.png new file mode 100644 index 0000000..244eecf Binary files /dev/null and b/assets/manage/wall.png differ diff --git a/assets/manage/waterway.png b/assets/manage/waterway.png new file mode 100644 index 0000000..1906a07 Binary files /dev/null and b/assets/manage/waterway.png differ diff --git a/assets/manage/window.png b/assets/manage/window.png new file mode 100644 index 0000000..eaa7c05 Binary files /dev/null and b/assets/manage/window.png differ diff --git a/lib/mock_models/decoration/decoration_model.dart b/lib/mock_models/decoration/decoration_model.dart index 091bcbc..4e6049d 100644 --- a/lib/mock_models/decoration/decoration_model.dart +++ b/lib/mock_models/decoration/decoration_model.dart @@ -1,5 +1,6 @@ import 'package:aku_community_manager/mock_models/fix/fixer_model.dart'; import 'package:flutter/material.dart'; +import 'package:aku_community_manager/const/resource.dart'; enum DecorationType { ///待指派 @@ -41,6 +42,14 @@ Map checkTypeStringMap = { '安防': CHECK_TYPE.SECURITY, }; +Map checkAssetMap = { + CHECK_TYPE.ELECTRIC: R.ASSETS_MANAGE_CIRCUIT_PNG, + CHECK_TYPE.WATER: R.ASSETS_MANAGE_WATERWAY_PNG, + CHECK_TYPE.WALL: R.ASSETS_MANAGE_WALL_PNG, + CHECK_TYPE.DOOR_AND_WINDOWS: R.ASSETS_MANAGE_WINDOW_PNG, + CHECK_TYPE.SECURITY: R.ASSETS_MANAGE_SECURITY_PNG, +}; + class DecorationModel { DecorationType type; DecorationStatusType statusType; @@ -152,6 +161,7 @@ class CheckInfomation { class CheckDetail { CHECK_TYPE type; bool status; + String get assetpath => checkAssetMap[type]; CheckDetail({ @required this.type, this.status = true, diff --git a/lib/style/app_style.dart b/lib/style/app_style.dart index abf1225..05536e0 100644 --- a/lib/style/app_style.dart +++ b/lib/style/app_style.dart @@ -20,6 +20,16 @@ class AppStyle { ///背景色 static const backgroundColor = Color(0xFFF9F9F9); + ///成功色 + static const successColor = Color(0xFF32B814); + + static const subSuccessColor = Color(0xFFE5FFDF); + + ///失败色 + static const failColor = Color(0xFFFF4501); + + static const subFailColor = Color(0xFFFFE5DB); + ///字体格式 final barTitleStyle = TextStyle( color: primaryTextColor, diff --git a/lib/ui/sub_pages/decoration_manager/decoration_check_card_widget.dart b/lib/ui/sub_pages/decoration_manager/decoration_check_card_widget.dart new file mode 100644 index 0000000..56c79dd --- /dev/null +++ b/lib/ui/sub_pages/decoration_manager/decoration_check_card_widget.dart @@ -0,0 +1,44 @@ +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:flutter/material.dart'; +import 'package:aku_community_manager/tools/screen_tool.dart'; + +class DecorationCheckCardWidget extends StatelessWidget { + final CHECK_TYPE type; + const DecorationCheckCardWidget({Key key, @required this.type}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + height: 160.w, + width: 124.w, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + checkAssetMap[type], + height: 56.w, + width: 56.w, + ), + AkuBox.h(4), + Text( + checkTypeMap[type], + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 24.sp, + ), + ), + ], + ), + decoration: BoxDecoration( + border: Border.all( + color: Color(0xFFE8E8E8), + width: 3.w, + ), + borderRadius: BorderRadius.circular(8.w), + ), + ); + } +} diff --git a/lib/ui/sub_pages/decoration_manager/decoration_check_row.dart b/lib/ui/sub_pages/decoration_manager/decoration_check_row.dart new file mode 100644 index 0000000..719a524 --- /dev/null +++ b/lib/ui/sub_pages/decoration_manager/decoration_check_row.dart @@ -0,0 +1,29 @@ +import 'package:aku_community_manager/mock_models/decoration/decoration_model.dart'; +import 'package:aku_community_manager/tools/widget_tool.dart'; +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_check_card_widget.dart'; +import 'package:aku_community_manager/tools/screen_tool.dart'; +import 'package:flutter/material.dart'; + +class DecorationCheckRow extends StatelessWidget { + final List details; + const DecorationCheckRow({Key key, @required this.details}) : super(key: key); + + @override + Widget build(BuildContext context) { + return SizedBox( + height: 160.w, + child: ListView.separated( + scrollDirection: Axis.horizontal, + itemBuilder: (context, index) { + return DecorationCheckCardWidget( + type: details[index], + ); + }, + itemCount: details.length, + separatorBuilder: (context, index) { + return AkuBox.w(16); + }, + ), + ); + } +} diff --git a/lib/ui/sub_pages/decoration_manager/decoration_checkbox.dart b/lib/ui/sub_pages/decoration_manager/decoration_checkbox.dart new file mode 100644 index 0000000..e5978b3 --- /dev/null +++ b/lib/ui/sub_pages/decoration_manager/decoration_checkbox.dart @@ -0,0 +1,109 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/tools/widget_tool.dart'; +import 'package:flutter/material.dart'; + +class DecorationCheckBox extends StatefulWidget { + final bool initValue; + final Function(bool state) onChange; + DecorationCheckBox({Key key, this.initValue = true, this.onChange}) + : super(key: key); + + @override + _DecorationCheckBoxState createState() => _DecorationCheckBoxState(); +} + +class _DecorationCheckBoxState extends State { + bool _nowValue; + @override + void initState() { + super.initState(); + _nowValue = widget.initValue; + } + + @override + Widget build(BuildContext context) { + return Row( + mainAxisSize: MainAxisSize.min, + children: [ + _buildBox( + rawChecked: true, + color: AppStyle.successColor, + subColor: AppStyle.subSuccessColor, + title: '正常', + icon: Icons.check, + ), + AkuBox.w(56), + _buildBox( + rawChecked: false, + color: AppStyle.failColor, + subColor: AppStyle.subFailColor, + title: '异常', + icon: Icons.check, + ), + ], + ); + } + + _buildBox( + {bool rawChecked, + Color color, + Color subColor, + String title, + IconData icon}) { + final checked = _nowValue == rawChecked; + return GestureDetector( + onTap: widget.onChange == null + ? null + : () { + setState(() { + _nowValue = rawChecked; + }); + widget.onChange(_nowValue); + }, + child: Material( + color: Colors.transparent, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + AnimatedContainer( + height: 40.w, + width: 40.w, + curve: Curves.easeInOutCubic, + child: _buildIcon(icon, color, checked), + duration: Duration(milliseconds: 300), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20.w), + border: Border.all( + color: checked ? color : Color(0xFFE8E8E8), + ), + color: checked ? subColor : subColor.withOpacity(0), + ), + ), + AkuBox.w(16), + AkuBox.h(96), + _buildText(title, color, checked), + ], + ), + ), + ); + } + + _buildText(String title, Color color, bool checked) { + return Text( + title, + style: TextStyle( + color: checked ? color : AppStyle.minorTextColor, + fontSize: 24.sp, + fontWeight: FontWeight.bold, + ), + ); + } + + _buildIcon(IconData icon, Color color, bool checked) { + return Icon( + icon, + color: checked ? color : Color(0xFFE8E8E8), + size: 32.w, + ); + } +} 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 index 33d6ca3..66a9b88 100644 --- a/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart +++ b/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart @@ -1,11 +1,15 @@ 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_check_row.dart'; +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_checkbox.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:common_utils/common_utils.dart'; +import 'package:expandable/expandable.dart'; import 'package:flutter/material.dart'; class DecorationManagerDetailPage extends StatefulWidget { @@ -195,7 +199,40 @@ class _DecorationManagerDetailStatePage return AkuTitleBox( title: '完工检查', spacing: 24, - children: [], + children: [ + _buildRow( + title: '开始装修时间', + subTitle: DateUtil.formatDate( + widget.model.workFinishCheck.decorationDate, + format: 'yyyy-MM-dd', + ), + ), + _buildRow( + title: '接受人', + subTitle: widget.model.workFinishCheck.authPerson.name, + ), + _buildRow(title: '所属项目', subTitle: '装修管理'), + _buildRow( + title: '开始日期', + subTitle: DateUtil.formatDate( + widget.model.workFinishCheck.startDate, + format: 'yyyy-MM-dd', + ), + ), + Padding( + padding: EdgeInsets.symmetric( + vertical: 28.w, + ), + child: Text( + '检查内容', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.w, + ), + ), + ), + DecorationCheckRow(details: widget.model.workFinishCheck.checkDetails), + ], ); } @@ -203,7 +240,40 @@ class _DecorationManagerDetailStatePage return AkuTitleBox( title: '周期检查', spacing: 24, - children: [], + children: [ + _buildRow( + title: '开始装修时间', + subTitle: DateUtil.formatDate( + widget.model.cycleCheck.decorationDate, + format: 'yyyy-MM-dd', + ), + ), + _buildRow( + title: '接受人', + subTitle: widget.model.cycleCheck.authPerson.name, + ), + _buildRow(title: '所属项目', subTitle: '装修管理'), + _buildRow( + title: '开始日期', + subTitle: DateUtil.formatDate( + widget.model.cycleCheck.startDate, + format: 'yyyy-MM-dd', + ), + ), + Padding( + padding: EdgeInsets.symmetric( + vertical: 28.w, + ), + child: Text( + '检查内容', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.w, + ), + ), + ), + DecorationCheckRow(details: widget.model.cycleCheck.checkDetails), + ], ); } @@ -211,7 +281,158 @@ class _DecorationManagerDetailStatePage return AkuTitleBox( title: '执行信息', spacing: 24, - children: [], + children: widget.model.checkInfomations.map((e) { + return Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Color(0xFFE8E8E8), + width: 1.w, + ), + ), + ), + child: ExpandablePanel( + theme: ExpandableThemeData( + tapHeaderToExpand: true, + iconPlacement: ExpandablePanelIconPlacement.right, + iconPadding: EdgeInsets.only(top: 32.w), + iconSize: 32.w, + iconColor: AppStyle.minorTextColor, + ), + header: Row( + children: [ + AkuBox.h(96), + Text( + '${DateUtil.formatDate(e.checkDate, format: 'yyyy-MM-dd')} ' + + e.checkType, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.sp, + ), + ), + Spacer(), + Text( + e.checkAllResult ? '正常' : '异常', + style: TextStyle( + color: e.checkAllResult + ? Color(0xFF32B814) + : Color(0xFFFF4501), + fontSize: 28.sp, + ), + ), + ], + ), + expanded: Column( + mainAxisSize: MainAxisSize.min, + children: [ + ...e.details.map((e) { + return Container( + height: 96.w, + decoration: BoxDecoration( + border: Border( + top: BorderSide( + color: Color(0xFFE8E8E8), + width: 1.w, + ), + ), + ), + child: Row( + children: [ + AkuBox.w(48), + Image.asset( + e.assetpath, + height: 40.w, + ), + Text( + e.typeValue, + style: TextStyle( + fontSize: 28.sp, + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + ), + ), + Spacer(), + DecorationCheckBox( + initValue: e.status, + ), + Spacer(), + ], + ), + ); + }).toList(), + Container( + decoration: BoxDecoration( + border: Border( + top: BorderSide( + width: 1.w, + color: Color(0xFFE8E8E8), + ), + ), + ), + height: 96.w, + padding: EdgeInsets.symmetric(horizontal: 32.w), + alignment: Alignment.centerLeft, + child: Text.rich( + TextSpan( + children: [ + TextSpan( + text: '检查描述:', + style: TextStyle( + color: AppStyle.minorTextColor, + ), + ), + TextSpan( + text: e.info, + ), + ], + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + ), + ), + ), + ), + ], + ), + ), + ); + }).toList(), + ); + } + + _buildRow({ + String title, + String subTitle, + }) { + return Container( + decoration: BoxDecoration( + border: + Border(bottom: BorderSide(color: Color(0xFFE8E8E8), width: 1.w)), + ), + child: InkWell( + child: Row( + children: [ + AkuBox.h(96), + Text( + title, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.w, + ), + ), + Spacer(), + Text( + subTitle, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.w, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), ); } }