update decoration model

hmxc
小赖 4 years ago
parent 0bdb559a09
commit deb19085eb

@ -4,6 +4,23 @@ import 'package:aku_community_manager/mock_models/fix/fixer_model.dart';
class DecorationData { class DecorationData {
static List<DecorationModel> allModels = [ static List<DecorationModel> allModels = [
DecorationModel( 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, type: DecorationType.DONE,
statusType: DecorationStatusType.DONE, statusType: DecorationStatusType.DONE,
userHomeModel: UserHomeModel( userHomeModel: UserHomeModel(
@ -11,7 +28,6 @@ class DecorationData {
plot: '深圳华茂悦峰', plot: '深圳华茂悦峰',
detailAddr: '1幢-1单元-302室', detailAddr: '1幢-1单元-302室',
phone: '18201939840', phone: '18201939840',
decorationStatus: false,
), ),
decorationTeamModel: DecorationTeamModel( decorationTeamModel: DecorationTeamModel(
name: '深圳莫川装修有限公司', name: '深圳莫川装修有限公司',
@ -19,7 +35,6 @@ class DecorationData {
phone: '19298540192', phone: '19298540192',
), ),
cycleCheck: CycleCheck( cycleCheck: CycleCheck(
decorationDate: DateTime(2020, 1, 23, 12, 23, 0),
authPerson: FixerModel(name: '林鸿章', phone: '18294859301'), authPerson: FixerModel(name: '林鸿章', phone: '18294859301'),
startDate: DateTime(2020, 1, 23, 20, 23, 0), startDate: DateTime(2020, 1, 23, 20, 23, 0),
checkCycle: 7, checkCycle: 7,
@ -31,7 +46,6 @@ class DecorationData {
], ],
), ),
workFinishCheck: WorkFinishCheck( workFinishCheck: WorkFinishCheck(
decorationDate: DateTime(2020, 1, 23, 12, 23, 0),
authPerson: FixerModel(name: '林鸿章', phone: '18294859301'), authPerson: FixerModel(name: '林鸿章', phone: '18294859301'),
startDate: DateTime(2020, 1, 23, 20, 23, 0), startDate: DateTime(2020, 1, 23, 20, 23, 0),
checkDetails: [ checkDetails: [

@ -53,6 +53,7 @@ Map<CHECK_TYPE, String> checkAssetMap = {
class DecorationModel { class DecorationModel {
DecorationType type; DecorationType type;
DecorationStatusType statusType; DecorationStatusType statusType;
DateTime decorationDate;
UserHomeModel userHomeModel; UserHomeModel userHomeModel;
DecorationTeamModel decorationTeamModel; DecorationTeamModel decorationTeamModel;
CycleCheck cycleCheck; CycleCheck cycleCheck;
@ -71,6 +72,7 @@ class DecorationModel {
@required this.statusType, @required this.statusType,
@required this.userHomeModel, @required this.userHomeModel,
@required this.decorationTeamModel, @required this.decorationTeamModel,
@required this.decorationDate,
this.cycleCheck, this.cycleCheck,
this.workFinishCheck, this.workFinishCheck,
this.checkInfomations, this.checkInfomations,
@ -83,13 +85,11 @@ class UserHomeModel {
String detailAddr; String detailAddr;
String userName; String userName;
String phone; String phone;
bool decorationStatus;
UserHomeModel({ UserHomeModel({
this.plot, this.plot,
this.detailAddr, this.detailAddr,
this.userName, this.userName,
this.phone, this.phone,
this.decorationStatus,
}); });
} }
@ -107,7 +107,6 @@ class DecorationTeamModel {
/// ///
class CycleCheck { class CycleCheck {
DateTime decorationDate;
FixerModel authPerson; FixerModel authPerson;
DateTime startDate; DateTime startDate;
@ -115,7 +114,6 @@ class CycleCheck {
int checkCycle; int checkCycle;
List<CHECK_TYPE> checkDetails; List<CHECK_TYPE> checkDetails;
CycleCheck({ CycleCheck({
this.decorationDate,
this.authPerson, this.authPerson,
this.startDate, this.startDate,
this.checkCycle, this.checkCycle,
@ -124,12 +122,10 @@ class CycleCheck {
} }
class WorkFinishCheck { class WorkFinishCheck {
DateTime decorationDate;
FixerModel authPerson; FixerModel authPerson;
DateTime startDate; DateTime startDate;
List<CHECK_TYPE> checkDetails; List<CHECK_TYPE> checkDetails;
WorkFinishCheck({ WorkFinishCheck({
this.decorationDate,
this.authPerson, this.authPerson,
this.startDate, this.startDate,
this.checkDetails, this.checkDetails,

@ -6,7 +6,9 @@ import 'package:aku_community_manager/tools/screen_tool.dart';
class DecorationCheckCardWidget extends StatelessWidget { class DecorationCheckCardWidget extends StatelessWidget {
final CHECK_TYPE type; 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); : super(key: key);
@override @override
@ -34,10 +36,11 @@ class DecorationCheckCardWidget extends StatelessWidget {
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: Color(0xFFE8E8E8), color: checked ? AppStyle.primaryTextColor : Color(0xFFE8E8E8),
width: 3.w, width: 3.w,
), ),
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),
color: checked ? Color(0xFFFFF3CC) : Colors.white,
), ),
); );
} }

@ -1,12 +1,31 @@
import 'package:aku_community_manager/mock_models/decoration/decoration_model.dart'; 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/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_check_card_widget.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'; import 'package:flutter/material.dart';
class DecorationCheckRow extends StatelessWidget { import 'package:aku_community_manager/tools/screen_tool.dart';
class DecorationCheckRow extends StatefulWidget {
final List<CHECK_TYPE> details; final List<CHECK_TYPE> details;
const DecorationCheckRow({Key key, @required this.details}) : super(key: key); final Function(List<CHECK_TYPE> details) onChange;
DecorationCheckRow({Key key, @required this.details, this.onChange})
: super(key: key);
@override
_DecorationCheckRowState createState() => _DecorationCheckRowState();
}
class _DecorationCheckRowState extends State<DecorationCheckRow> {
List<CHECK_TYPE> _tempCheckDetails = [];
List<CHECK_TYPE> _checkedDetails = [];
@override
void initState() {
super.initState();
_tempCheckDetails = widget.details;
widget.details.forEach((element) {
_checkedDetails.add(element);
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -15,11 +34,28 @@ class DecorationCheckRow extends StatelessWidget {
child: ListView.separated( child: ListView.separated(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return DecorationCheckCardWidget( return GestureDetector(
type: details[index], 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) { separatorBuilder: (context, index) {
return AkuBox.w(16); return AkuBox.w(16);
}, },

@ -38,7 +38,7 @@ class _DecorationManagerCardState extends State<DecorationManagerCard> {
AkuBox.w(16), AkuBox.w(16),
Text( Text(
DateUtil.formatDate( DateUtil.formatDate(
widget.model.cycleCheck.decorationDate, widget.model.decorationDate,
format: 'yyyy-MM-dd HH:mm:ss', format: 'yyyy-MM-dd HH:mm:ss',
), ),
style: TextStyle( style: TextStyle(

@ -203,7 +203,7 @@ class _DecorationManagerDetailStatePage
_buildRow( _buildRow(
title: '开始装修时间', title: '开始装修时间',
subTitle: DateUtil.formatDate( subTitle: DateUtil.formatDate(
widget.model.workFinishCheck.decorationDate, widget.model.decorationDate,
format: 'yyyy-MM-dd', 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( _buildRow(
title: '开始装修时间', title: '开始装修时间',
subTitle: DateUtil.formatDate( subTitle: DateUtil.formatDate(
widget.model.cycleCheck.decorationDate, widget.model.decorationDate,
format: 'yyyy-MM-dd', format: 'yyyy-MM-dd',
), ),
), ),

Loading…
Cancel
Save