diff --git a/lib/mock_models/decoration/decoration_data.dart b/lib/mock_models/decoration/decoration_data.dart index 73344b0..bc321b3 100644 --- a/lib/mock_models/decoration/decoration_data.dart +++ b/lib/mock_models/decoration/decoration_data.dart @@ -4,6 +4,23 @@ import 'package:aku_community_manager/mock_models/fix/fixer_model.dart'; class DecorationData { static List allModels = [ DecorationModel( + type: DecorationType.WAIT_HAND_OUT, + statusType: DecorationStatusType.PROGRESS, + decorationDate: DateTime(2020, 1, 23, 12, 23, 0), + userHomeModel: UserHomeModel( + userName: '林居明', + plot: '深圳华茂悦峰', + detailAddr: '2幢-2单元-501室', + phone: '19995430126', + ), + decorationTeamModel: DecorationTeamModel( + name: '深圳莫川装修有限公司', + userName: '李惠政', + phone: '19298540192', + ), + ), + DecorationModel( + decorationDate: DateTime(2020, 1, 23, 12, 23, 0), type: DecorationType.DONE, statusType: DecorationStatusType.DONE, userHomeModel: UserHomeModel( @@ -11,7 +28,6 @@ class DecorationData { plot: '深圳华茂悦峰', detailAddr: '1幢-1单元-302室', phone: '18201939840', - decorationStatus: false, ), decorationTeamModel: DecorationTeamModel( name: '深圳莫川装修有限公司', @@ -19,7 +35,6 @@ class DecorationData { phone: '19298540192', ), cycleCheck: CycleCheck( - decorationDate: DateTime(2020, 1, 23, 12, 23, 0), authPerson: FixerModel(name: '林鸿章', phone: '18294859301'), startDate: DateTime(2020, 1, 23, 20, 23, 0), checkCycle: 7, @@ -31,7 +46,6 @@ class DecorationData { ], ), workFinishCheck: WorkFinishCheck( - decorationDate: DateTime(2020, 1, 23, 12, 23, 0), authPerson: FixerModel(name: '林鸿章', phone: '18294859301'), startDate: DateTime(2020, 1, 23, 20, 23, 0), checkDetails: [ diff --git a/lib/mock_models/decoration/decoration_model.dart b/lib/mock_models/decoration/decoration_model.dart index 4e6049d..5ebf0eb 100644 --- a/lib/mock_models/decoration/decoration_model.dart +++ b/lib/mock_models/decoration/decoration_model.dart @@ -53,6 +53,7 @@ Map checkAssetMap = { class DecorationModel { DecorationType type; DecorationStatusType statusType; + DateTime decorationDate; UserHomeModel userHomeModel; DecorationTeamModel decorationTeamModel; CycleCheck cycleCheck; @@ -71,6 +72,7 @@ class DecorationModel { @required this.statusType, @required this.userHomeModel, @required this.decorationTeamModel, + @required this.decorationDate, this.cycleCheck, this.workFinishCheck, this.checkInfomations, @@ -83,13 +85,11 @@ class UserHomeModel { String detailAddr; String userName; String phone; - bool decorationStatus; UserHomeModel({ this.plot, this.detailAddr, this.userName, this.phone, - this.decorationStatus, }); } @@ -107,7 +107,6 @@ class DecorationTeamModel { ///周期检查 class CycleCheck { - DateTime decorationDate; FixerModel authPerson; DateTime startDate; @@ -115,7 +114,6 @@ class CycleCheck { int checkCycle; List checkDetails; CycleCheck({ - this.decorationDate, this.authPerson, this.startDate, this.checkCycle, @@ -124,12 +122,10 @@ class CycleCheck { } class WorkFinishCheck { - DateTime decorationDate; FixerModel authPerson; DateTime startDate; List checkDetails; WorkFinishCheck({ - this.decorationDate, this.authPerson, this.startDate, this.checkDetails, 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 index 56c79dd..a8aa760 100644 --- a/lib/ui/sub_pages/decoration_manager/decoration_check_card_widget.dart +++ b/lib/ui/sub_pages/decoration_manager/decoration_check_card_widget.dart @@ -6,7 +6,9 @@ import 'package:aku_community_manager/tools/screen_tool.dart'; class DecorationCheckCardWidget extends StatelessWidget { final CHECK_TYPE type; - const DecorationCheckCardWidget({Key key, @required this.type}) + final bool checked; + const DecorationCheckCardWidget( + {Key key, @required this.type, this.checked = false}) : super(key: key); @override @@ -34,10 +36,11 @@ class DecorationCheckCardWidget extends StatelessWidget { ), decoration: BoxDecoration( border: Border.all( - color: Color(0xFFE8E8E8), + color: checked ? AppStyle.primaryTextColor : Color(0xFFE8E8E8), width: 3.w, ), borderRadius: BorderRadius.circular(8.w), + color: checked ? Color(0xFFFFF3CC) : Colors.white, ), ); } diff --git a/lib/ui/sub_pages/decoration_manager/decoration_check_row.dart b/lib/ui/sub_pages/decoration_manager/decoration_check_row.dart index 719a524..43514c1 100644 --- a/lib/ui/sub_pages/decoration_manager/decoration_check_row.dart +++ b/lib/ui/sub_pages/decoration_manager/decoration_check_row.dart @@ -1,12 +1,31 @@ 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 { +import 'package:aku_community_manager/tools/screen_tool.dart'; + +class DecorationCheckRow extends StatefulWidget { final List details; - const DecorationCheckRow({Key key, @required this.details}) : super(key: key); + final Function(List details) onChange; + DecorationCheckRow({Key key, @required this.details, this.onChange}) + : super(key: key); + + @override + _DecorationCheckRowState createState() => _DecorationCheckRowState(); +} + +class _DecorationCheckRowState extends State { + List _tempCheckDetails = []; + List _checkedDetails = []; + @override + void initState() { + super.initState(); + _tempCheckDetails = widget.details; + widget.details.forEach((element) { + _checkedDetails.add(element); + }); + } @override Widget build(BuildContext context) { @@ -15,11 +34,28 @@ class DecorationCheckRow extends StatelessWidget { child: ListView.separated( scrollDirection: Axis.horizontal, itemBuilder: (context, index) { - return DecorationCheckCardWidget( - type: details[index], + return GestureDetector( + onTap: widget.onChange == null + ? null + : () { + setState(() { + _checkedDetails.indexOf(_tempCheckDetails[index]) != -1 + ? _checkedDetails.remove(_tempCheckDetails[index]) + : _checkedDetails.add(_tempCheckDetails[index]); + }); + }, + child: Material( + color: Colors.transparent, + child: DecorationCheckCardWidget( + type: _tempCheckDetails[index], + checked: widget.onChange == null + ? false + : _checkedDetails.indexOf(_tempCheckDetails[index]) != -1, + ), + ), ); }, - itemCount: details.length, + itemCount: _tempCheckDetails.length, separatorBuilder: (context, index) { return AkuBox.w(16); }, 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 c279cde..1072249 100644 --- a/lib/ui/sub_pages/decoration_manager/decoration_manager_card.dart +++ b/lib/ui/sub_pages/decoration_manager/decoration_manager_card.dart @@ -38,7 +38,7 @@ class _DecorationManagerCardState extends State { AkuBox.w(16), Text( DateUtil.formatDate( - widget.model.cycleCheck.decorationDate, + widget.model.decorationDate, format: 'yyyy-MM-dd HH:mm:ss', ), style: TextStyle( 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 66a9b88..e2fa350 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 @@ -203,7 +203,7 @@ class _DecorationManagerDetailStatePage _buildRow( title: '开始装修时间', subTitle: DateUtil.formatDate( - widget.model.workFinishCheck.decorationDate, + widget.model.decorationDate, format: 'yyyy-MM-dd', ), ), @@ -231,7 +231,10 @@ class _DecorationManagerDetailStatePage ), ), ), - DecorationCheckRow(details: widget.model.workFinishCheck.checkDetails), + DecorationCheckRow( + details: widget.model.workFinishCheck.checkDetails, + onChange: (details) {}, + ), ], ); } @@ -244,7 +247,7 @@ class _DecorationManagerDetailStatePage _buildRow( title: '开始装修时间', subTitle: DateUtil.formatDate( - widget.model.cycleCheck.decorationDate, + widget.model.decorationDate, format: 'yyyy-MM-dd', ), ),