完成装修页面主体和卡片

hmxc
小赖 4 years ago
parent c463a0d2f7
commit 4398886847

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -0,0 +1,118 @@
import 'package:aku_community_manager/mock_models/decoration/decoration_model.dart';
import 'package:aku_community_manager/mock_models/fix/fixer_model.dart';
class DecorationData {
static List<DecorationModel> allModels = [
DecorationModel(
type: DecorationType.DONE,
statusType: DecorationStatusType.DONE,
userHomeModel: UserHomeModel(
userName: '李慧珍',
plot: '深圳华茂悦峰',
detailAddr: '1幢-1单元-302室',
phone: '18201939840',
decorationStatus: false,
),
decorationTeamModel: DecorationTeamModel(
name: '深圳莫川装修有限公司',
userName: '李惠政',
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,
checkDetails: [
CHECK_TYPE.ELECTRIC,
CHECK_TYPE.WATER,
CHECK_TYPE.WALL,
CHECK_TYPE.DOOR_AND_WINDOWS,
],
),
workFinishCheck: WorkFinishCheck(
decorationDate: DateTime(2020, 1, 23, 12, 23, 0),
authPerson: FixerModel(name: '林鸿章', phone: '18294859301'),
startDate: DateTime(2020, 1, 23, 20, 23, 0),
checkDetails: [
CHECK_TYPE.ELECTRIC,
CHECK_TYPE.WATER,
CHECK_TYPE.WALL,
CHECK_TYPE.DOOR_AND_WINDOWS,
CHECK_TYPE.SECURITY,
],
),
checkInfomations: [
CheckInfomation(
checkDate: DateTime(2020, 3, 20, 12, 00),
info: '正常',
checkType: '完工检查',
details: [
CheckDetail(type: CHECK_TYPE.ELECTRIC),
CheckDetail(type: CHECK_TYPE.WATER),
CheckDetail(type: CHECK_TYPE.WALL),
CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS),
],
),
CheckInfomation(
checkDate: DateTime(2020, 2, 14, 12, 00),
info: '正常',
checkType: '周期检查',
details: [
CheckDetail(type: CHECK_TYPE.ELECTRIC),
CheckDetail(type: CHECK_TYPE.WATER),
CheckDetail(type: CHECK_TYPE.WALL),
CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS),
],
),
CheckInfomation(
checkDate: DateTime(2020, 2, 7, 12, 00),
info: '厨房水路异常',
checkType: '周期检查',
details: [
CheckDetail(type: CHECK_TYPE.ELECTRIC),
CheckDetail(type: CHECK_TYPE.WATER, status: false),
CheckDetail(type: CHECK_TYPE.WALL),
CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS),
],
),
CheckInfomation(
checkDate: DateTime(2020, 1, 30, 12, 00),
info: '正常',
checkType: '周期检查',
details: [
CheckDetail(type: CHECK_TYPE.ELECTRIC),
CheckDetail(type: CHECK_TYPE.WATER),
CheckDetail(type: CHECK_TYPE.WALL),
CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS),
],
),
CheckInfomation(
checkDate: DateTime(2020, 1, 23, 12, 00),
info: '正常',
checkType: '周期检查',
details: [
CheckDetail(type: CHECK_TYPE.ELECTRIC),
CheckDetail(type: CHECK_TYPE.WATER),
CheckDetail(type: CHECK_TYPE.WALL),
CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS),
],
),
],
),
];
static List<DecorationModel> getModels(DecorationType type) {
return allModels.where((element) => element.type == type).toList();
}
static List<DecorationModel> getTypeModels(DecorationStatusType type) {
return allModels.where((element) => element.statusType == type).toList();
}
static List<DecorationModel> get allPropertyModels {
return allModels
.where((element) => element.type != DecorationType.WAIT_HAND_OUT)
.toList();
}
}

@ -1,14 +1,22 @@
import 'package:aku_community_manager/mock_models/fix/fixer_model.dart';
import 'package:flutter/material.dart';
enum DecorationType {
///
WAIT_,
///
WAIT_HAND_OUT,
///
///&
HAND_OUT,
///
DONE,
}
enum DecorationStatusType {
PROGRESS,
DONE,
}
enum CHECK_TYPE {
ELECTRIC,
WATER,
@ -17,13 +25,47 @@ enum CHECK_TYPE {
SECURITY,
}
Map<CHECK_TYPE, String> checkTypeMap = {
CHECK_TYPE.ELECTRIC: '电路',
CHECK_TYPE.WATER: '水路',
CHECK_TYPE.WALL: '墙面',
CHECK_TYPE.DOOR_AND_WINDOWS: '门窗',
CHECK_TYPE.SECURITY: '安防',
};
Map<String, CHECK_TYPE> checkTypeStringMap = {
'电路': CHECK_TYPE.ELECTRIC,
'水路': CHECK_TYPE.WATER,
'墙面': CHECK_TYPE.WALL,
'门窗': CHECK_TYPE.DOOR_AND_WINDOWS,
'安防': CHECK_TYPE.SECURITY,
};
class DecorationModel {
DateTime decorationDate;
DateTime startDate;
String checkCycle;
DecorationType type;
DecorationStatusType statusType;
UserHomeModel userHomeModel;
DecorationTeamModel decorationTeamModel;
List<CHECK_TYPE> checkTypes;
CycleCheck cycleCheck;
WorkFinishCheck workFinishCheck;
List<CheckInfomation> checkInfomations;
String get statusTypeValue {
if (statusType == DecorationStatusType.PROGRESS)
return '装修中';
else
return '装修完成';
}
DecorationModel({
@required this.type,
@required this.statusType,
@required this.userHomeModel,
@required this.decorationTeamModel,
this.cycleCheck,
this.workFinishCheck,
this.checkInfomations,
});
}
///
@ -32,11 +74,13 @@ class UserHomeModel {
String detailAddr;
String userName;
String phone;
bool decorationStatus;
UserHomeModel({
this.plot,
this.detailAddr,
this.userName,
this.phone,
this.decorationStatus,
});
}
@ -51,3 +95,66 @@ class DecorationTeamModel {
this.phone,
});
}
///
class CycleCheck {
DateTime decorationDate;
FixerModel authPerson;
DateTime startDate;
///check cycle in days
int checkCycle;
List<CHECK_TYPE> checkDetails;
CycleCheck({
this.decorationDate,
this.authPerson,
this.startDate,
this.checkCycle,
this.checkDetails,
});
}
class WorkFinishCheck {
DateTime decorationDate;
FixerModel authPerson;
DateTime startDate;
List<CHECK_TYPE> checkDetails;
WorkFinishCheck({
this.decorationDate,
this.authPerson,
this.startDate,
this.checkDetails,
});
}
///
class CheckInfomation {
DateTime checkDate;
List<CheckDetail> details;
String info;
String checkType;
CheckInfomation({
this.checkDate,
this.info,
this.details,
this.checkType,
});
///
bool get checkAllResult {
for (var item in details) {
if (!item.status) return false;
}
return true;
}
}
class CheckDetail {
CHECK_TYPE type;
bool status;
CheckDetail({
@required this.type,
this.status = true,
});
String get typeValue => checkTypeMap[type];
}

@ -4,7 +4,7 @@ enum USER_ROLE {
///
MANAGER,
///
///
FIXER,
///

@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
export 'package:flutter_screenutil/flutter_screenutil.dart';
class AppStyle {
//
static const primaryColor = Color(0xFFFDCF12);

@ -6,6 +6,7 @@ import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_more_time_page.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_work_finish_page.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';
@ -66,23 +67,7 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
children: [
Row(
children: [
Container(
child: Text(
'报事报修',
style: TextStyle(
color: AppStyle.secondaryColor,
fontSize: 20.sp,
fontWeight: FontWeight.bold,
),
),
padding:
EdgeInsets.symmetric(vertical: 6.w, horizontal: 16.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2.w),
border:
Border.all(width: 2.w, color: AppStyle.secondaryColor),
),
),
AkuChipBox(title: '报事报修'),
AkuBox.w(16),
Expanded(
child: Text(

@ -0,0 +1,182 @@
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:aku_community_manager/tools/widget_tool.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:provider/provider.dart';
class DecorationManagerCard extends StatefulWidget {
final DecorationModel model;
DecorationManagerCard({Key key, @required this.model}) : super(key: key);
@override
_DecorationManagerCardState createState() => _DecorationManagerCardState();
}
class _DecorationManagerCardState extends State<DecorationManagerCard> {
USER_ROLE get role =>
Provider.of<UserProvider>(context, listen: false).userInfoModel.role;
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(top: 16.w),
padding: EdgeInsets.all(24.w),
child: Column(
children: [
Row(
children: [
AkuChipBox(title: '装修管理'),
AkuBox.w(16),
Text(
DateUtil.formatDate(
widget.model.cycleCheck.decorationDate,
format: 'yyyy-MM-dd HH:mm:ss',
),
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 22.w,
),
),
Spacer(),
Text(
_getTagName(),
style: TextStyle(
color: _getTagColor(),
fontSize: 24.w,
),
),
],
),
AkuBox.h(24),
_buildTile(
R.ASSETS_MANAGE_HOME_PNG,
'小区名称',
widget.model.userHomeModel.plot,
),
AkuBox.h(12),
_buildTile(
R.ASSETS_MANAGE_ADDRESS_PNG,
'详细地址',
widget.model.userHomeModel.detailAddr,
),
AkuBox.h(12),
_buildTile(
R.ASSETS_MANAGE_DECORATION_PNG,
'装修公司',
widget.model.decorationTeamModel.name,
),
AkuBox.h(12),
_buildTile(
R.ASSETS_MANAGE_STATUS_PNG,
'装修状态',
widget.model.statusTypeValue,
),
Divider(
height: 48.w,
),
Align(
alignment: Alignment.centerRight,
child: AkuMaterialButton(
onPressed: () {},
height: 64.w,
minWidth: 160.w,
color: AppStyle.primaryColor,
child: Text(
'查看详情',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontWeight: FontWeight.bold,
fontSize: 28.w,
),
),
radius: 4.w,
),
),
],
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.w),
),
);
}
_buildTile(String path, String title, String subTitle) {
return Row(
children: [
Image.asset(
path,
height: 40.w,
width: 40.w,
),
Text(
title,
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 28.sp,
),
),
Spacer(),
Text(
subTitle,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.sp,
fontWeight: FontWeight.bold,
),
),
],
);
}
_getTagName() {
Map<DecorationType, String> managerMap = {
DecorationType.WAIT_HAND_OUT: '待指派',
DecorationType.HAND_OUT: '已指派',
DecorationType.DONE: '已执行',
};
Map<DecorationType, String> fixerMap = {
DecorationType.HAND_OUT: '待执行',
DecorationType.DONE: '已执行',
};
Map<DecorationStatusType, String> 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);
}
}
}

@ -1,5 +1,13 @@
import 'package:aku_community_manager/mock_models/decoration/decoration_data.dart';
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/ui/sub_pages/decoration_manager/decoration_manager_card.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart';
import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class DecorationManagerPage extends StatefulWidget {
DecorationManagerPage({Key key}) : super(key: key);
@ -8,11 +16,88 @@ class DecorationManagerPage extends StatefulWidget {
_DecorationManagerPageState createState() => _DecorationManagerPageState();
}
class _DecorationManagerPageState extends State<DecorationManagerPage> {
class _DecorationManagerPageState extends State<DecorationManagerPage>
with TickerProviderStateMixin {
TabController _tabController;
USER_ROLE get role =>
Provider.of<UserProvider>(context, listen: false).userInfoModel.role;
List<String> get tabs {
switch (role) {
case USER_ROLE.MANAGER:
return ['待指派', '已指派', '已执行', '全部'];
break;
case USER_ROLE.PROPERTY:
return ['待执行', '已执行', '全部'];
break;
default:
return ['装修中', '装修完成', '全部'];
break;
}
}
@override
void initState() {
super.initState();
_tabController = TabController(length: tabs.length, vsync: this);
}
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '装修管理',
appBarBottom: PreferredSize(
child: AkuTabBar(
controller: _tabController,
tabs: tabs,
),
preferredSize: Size.fromHeight(96.w),
),
body: TabBarView(
controller: _tabController,
children: _getViews(),
),
);
}
List<Widget> _getViews() {
switch (role) {
case USER_ROLE.MANAGER:
return [
_getSingleListView(
DecorationData.getModels(DecorationType.WAIT_HAND_OUT)),
_getSingleListView(DecorationData.getModels(DecorationType.HAND_OUT)),
_getSingleListView(DecorationData.getModels(DecorationType.DONE)),
_getSingleListView(DecorationData.allModels),
];
break;
case USER_ROLE.PROPERTY:
return [
_getSingleListView(DecorationData.getModels(DecorationType.HAND_OUT)),
_getSingleListView(DecorationData.getModels(DecorationType.DONE)),
_getSingleListView(DecorationData.allPropertyModels),
];
default:
return [
_getSingleListView(
DecorationData.getTypeModels(DecorationStatusType.PROGRESS)),
_getSingleListView(
DecorationData.getTypeModels(DecorationStatusType.DONE)),
_getSingleListView(DecorationData.allPropertyModels),
];
break;
}
}
_getSingleListView(List<DecorationModel> models) {
return ListView.builder(
itemBuilder: (context, index) {
return DecorationManagerCard(model: models[index]);
},
itemCount: models.length,
padding: EdgeInsets.symmetric(horizontal: 32.w),
);
}
}

@ -0,0 +1,26 @@
import 'package:aku_community_manager/style/app_style.dart';
import 'package:flutter/material.dart';
class AkuChipBox extends StatelessWidget {
final String title;
const AkuChipBox({Key key, @required this.title}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
child: Text(
title,
style: TextStyle(
color: AppStyle.secondaryColor,
fontSize: 20.sp,
fontWeight: FontWeight.bold,
),
),
padding: EdgeInsets.symmetric(vertical: 6.w, horizontal: 16.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2.w),
border: Border.all(width: 2.w, color: AppStyle.secondaryColor),
),
);
}
}
Loading…
Cancel
Save