添加报修页面数据

hmxc
小赖 4 years ago
parent 208701b96d
commit 471adb6563

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

@ -1,4 +1,5 @@
import 'package:aku_community_manager/provider/app_provider.dart'; import 'package:aku_community_manager/provider/app_provider.dart';
import 'package:aku_community_manager/provider/fix_provider.dart';
import 'package:aku_community_manager/provider/user_provider.dart'; import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/ui/home/home_page.dart'; import 'package:aku_community_manager/ui/home/home_page.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
@ -18,6 +19,7 @@ class MyApp extends StatelessWidget {
providers: [ providers: [
ChangeNotifierProvider(create: (context) => UserProvider()), ChangeNotifierProvider(create: (context) => UserProvider()),
ChangeNotifierProvider(create: (context) => AppProvider()), ChangeNotifierProvider(create: (context) => AppProvider()),
ChangeNotifierProvider(create: (context) => FixProvider()),
], ],
child: GetMaterialApp( child: GetMaterialApp(
title: '小蜜蜂管家', title: '小蜜蜂管家',

@ -0,0 +1,171 @@
import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/mock_models/fix/fixer_model.dart';
import 'package:aku_community_manager/mock_models/users/user_info_model.dart';
import 'package:flutter/material.dart';
enum FIX_ENUM {
///
HAND_OUT,
///&&
WAIT_PICKUP,
///
PROCESSING,
///
DONE,
}
class FixModel {
static Map<FIX_ENUM, String> managerRoleMap = {
FIX_ENUM.HAND_OUT: '待派单',
FIX_ENUM.WAIT_PICKUP: '已派单',
FIX_ENUM.PROCESSING: '处理中',
FIX_ENUM.DONE: '已处理',
};
static Map<FIX_ENUM, String> otherRoleMap = {
FIX_ENUM.HAND_OUT: '',
FIX_ENUM.WAIT_PICKUP: '待接单',
FIX_ENUM.PROCESSING: '处理中',
FIX_ENUM.DONE: '已处理',
};
String title;
DateTime dateStart;
FIX_ENUM type;
///dynamic type
///
///img Stringassetimg File File
List imgs;
FixDetailModel detail;
FixModel({
@required this.title,
@required this.dateStart,
@required this.type,
@required this.imgs,
@required this.detail,
});
static List<FixModel> initList() {
return [
FixModel(
title: '家中电饭煲出问题了,请师傅速来。',
dateStart: DateTime(2020, 10, 22, 9, 28, 56),
type: FIX_ENUM.DONE,
imgs: [R.ASSETS_STATIC_FIX_FOOD2_PNG, R.ASSETS_STATIC_FIX_FOOD_PNG],
detail: FixDetailModel(
userName: '杨建',
userPhoneNumber: '18882929292',
fixArea: 'A区',
type: FIX_PAYMENT_TYPE.FREE,
limit: FIX_DATE_LIMIT.HOUR_24,
subType: FIX_SUB_TYPE.NORMAL,
fixStatuses: [
FixStatus(title: '申请保修', date: DateTime(2020, 10, 23, 10, 28, 56)),
FixStatus(
title: '分派给李保国师傅', date: DateTime(2020, 10, 23, 10, 32, 14)),
FixStatus(title: '师傅已接单', date: DateTime(2020, 10, 23, 10, 38, 26)),
FixStatus(title: '处理完成', date: DateTime(2020, 10, 23, 11, 01, 08)),
],
result: FixResult(
detail: '电饭煲插头没插',
material: '',
imgs: [R.ASSETS_STATIC_FIX_FOOD_PNG],
),
review: UserReviewInfo(
rate: 5,
content: '师傅太用心了',
),
),
),
];
}
}
///
enum FIX_PAYMENT_TYPE {
FREE,
PAY,
}
///
enum FIX_SUB_TYPE {
///
NORMAL,
///
HURRY,
}
///
enum FIX_DATE_LIMIT {
HOUR_24,
HOUR_12,
HOUR_8,
}
class FixDetailModel {
///
String userName;
String userPhoneNumber;
String fixArea;
FIX_PAYMENT_TYPE type;
FIX_DATE_LIMIT limit;
FIX_SUB_TYPE subType;
List<FixStatus> fixStatuses;
FixResult result;
UserReviewInfo review;
FixDetailModel({
this.userName,
this.userPhoneNumber,
this.fixArea,
this.type,
this.limit,
this.subType,
this.fixStatuses,
this.result,
this.review,
});
}
class FixStatus {
String title;
DateTime date;
FixStatus({
this.title,
this.date,
});
}
class FixResult {
String detail;
String material;
///dynamic img
List imgs;
FixResult({
this.detail,
this.material,
this.imgs,
});
}
class UserReviewInfo {
double rate;
String content;
UserReviewInfo({
this.rate,
this.content,
});
}

@ -0,0 +1,16 @@
enum FIXER_TYPE {
///
AIR_CONDITION,
///
ELECTRIC,
///
CEMENT,
}
class FixerModel {
FIXER_TYPE type;
String name;
String phone;
}

@ -0,0 +1,54 @@
import 'package:aku_community_manager/mock_models/fix/fix_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:flutter/material.dart';
import 'package:provider/provider.dart';
class FixProvider extends ChangeNotifier {
List<FixModel> _fixModels = FixModel.initList();
List<FixModel> get fixModels => _fixModels;
addFixModel(FixModel model) {
_fixModels.insert(0, model);
notifyListeners();
}
List<FixModel> getFixModel(int index, BuildContext context) {
final userProvider = Provider.of<UserProvider>(context, listen: false);
USER_ROLE role = userProvider.userInfoModel.role;
List<FixModel> _doneModels =
_fixModels.where((element) => element.type == FIX_ENUM.DONE).toList();
List<FixModel> _processingModels = _fixModels
.where((element) => element.type == FIX_ENUM.PROCESSING)
.toList();
List<FixModel> _handOutModels = _fixModels
.where((element) => element.type == FIX_ENUM.HAND_OUT)
.toList();
List<FixModel> _waitPickUpModels = _fixModels
.where((element) => element.type == FIX_ENUM.WAIT_PICKUP)
.toList();
switch (role) {
case USER_ROLE.MANAGER:
return [
_handOutModels,
_waitPickUpModels,
_processingModels,
_doneModels,
_fixModels,
][index];
break;
default:
return [
_waitPickUpModels,
_processingModels,
_doneModels,
_fixModels,
][index];
break;
}
}
}

@ -8,6 +8,7 @@ import 'package:aku_community_manager/ui/home/business/business_page.dart';
import 'package:aku_community_manager/ui/home/messages/message.dart'; import 'package:aku_community_manager/ui/home/messages/message.dart';
import 'package:aku_community_manager/ui/home/application/applications_page.dart'; import 'package:aku_community_manager/ui/home/application/applications_page.dart';
import 'package:aku_community_manager/ui/home/personal_draw.dart'; import 'package:aku_community_manager/ui/home/personal_draw.dart';
import 'package:aku_community_manager/ui/login/login_page.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_page.dart'; import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_page.dart';
import 'package:aku_community_manager/ui/tool_pages/scan_page.dart'; import 'package:aku_community_manager/ui/tool_pages/scan_page.dart';
import 'package:aku_ui/aku_ui.dart'; import 'package:aku_ui/aku_ui.dart';
@ -33,7 +34,12 @@ class _HomePageState extends State<HomePage> {
radius: 8.w, radius: 8.w,
height: 75.w + 8.w + 33.w, height: 75.w + 8.w + 33.w,
onPressed: () { onPressed: () {
final userProvider =
Provider.of<UserProvider>(context, listen: false);
if (userProvider.isSigned)
Get.to(page); Get.to(page);
else
Get.to(LoginPage());
}, },
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,

@ -1,5 +1,8 @@
import 'package:aku_community_manager/mock_models/fix/fix_model.dart';
import 'package:aku_community_manager/mock_models/users/user_info_model.dart'; import 'package:aku_community_manager/mock_models/users/user_info_model.dart';
import 'package:aku_community_manager/provider/fix_provider.dart';
import 'package:aku_community_manager/provider/user_provider.dart'; import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_fix_card.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart'; import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart';
@ -21,10 +24,10 @@ class _BusinessAndFixPageState extends State<BusinessAndFixPage>
final userProvider = Provider.of<UserProvider>(context, listen: false); final userProvider = Provider.of<UserProvider>(context, listen: false);
switch (userProvider.userInfoModel.role) { switch (userProvider.userInfoModel.role) {
case USER_ROLE.MANAGER: case USER_ROLE.MANAGER:
return []; return ['待派单', '已派单', '处理中', '已处理', '全部'];
break; break;
case USER_ROLE.FIXER: case USER_ROLE.FIXER:
return []; return ['待接单', '处理中', '已处理', '全部'];
break; break;
case USER_ROLE.SECURITY: case USER_ROLE.SECURITY:
return []; return [];
@ -51,13 +54,28 @@ class _BusinessAndFixPageState extends State<BusinessAndFixPage>
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AkuScaffold( return AkuScaffold(
title: '报事报修', title: '报事报修',
bottom: PreferredSize( appBarBottom: PreferredSize(
preferredSize: Size.fromHeight(88.w), preferredSize: Size.fromHeight(88.w),
child: AkuTabBar( child: AkuTabBar(
controller: _tabController, controller: _tabController,
tabs: _tabs, tabs: _tabs,
), ),
), ),
body: TabBarView(
controller: _tabController,
children: _tabs.map((e) => _buildTabView(_tabs.indexOf(e))).toList(),
),
);
}
Widget _buildTabView(int index) {
final fixProvider = Provider.of<FixProvider>(context, listen: false);
List<FixModel> models = fixProvider.getFixModel(index, context);
return ListView.builder(
itemBuilder: (context, index) {
return BusinessFixCard(model: models[index]);
},
itemCount: models.length,
); );
} }
} }

@ -0,0 +1,134 @@
import 'package:aku_community_manager/mock_models/fix/fix_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:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:provider/provider.dart';
class BusinessFixCard extends StatefulWidget {
final FixModel model;
BusinessFixCard({Key key, @required this.model}) : super(key: key);
@override
_BusinessFixCardState createState() => _BusinessFixCardState();
}
class _BusinessFixCardState extends State<BusinessFixCard> {
String get dateStart => DateUtil.formatDate(widget.model.dateStart,
format: 'yyyy-MM-dd HH:mm:ss');
Widget get fixTypeWidget {
final userProvider = Provider.of<UserProvider>(context, listen: false);
if (userProvider.userInfoModel.role == USER_ROLE.MANAGER) {
return Text(
FixModel.managerRoleMap[widget.model.type],
style: TextStyle(
color: widget.model.type != FIX_ENUM.DONE
? Color(0XFFFF4501)
: AppStyle.minorTextColor,
),
);
} else {
return Text(
FixModel.otherRoleMap[widget.model.type],
style: TextStyle(
color: widget.model.type != FIX_ENUM.DONE
? Color(0XFFFF4501)
: AppStyle.minorTextColor,
),
);
}
}
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
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),
),
),
AkuBox.w(16),
Expanded(
child: Text(
dateStart,
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 22.sp,
),
),
),
fixTypeWidget,
],
),
AkuBox.h(24),
Text(
widget.model.title,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.sp,
fontWeight: FontWeight.bold,
),
),
AkuBox.h(16),
_buildImgs(),
],
),
margin: EdgeInsets.symmetric(
horizontal: 32.w,
vertical: 8.w,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.w),
),
);
}
_buildImgs() {
return Container(
height: 168.w,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
var imgObj = widget.model.imgs[index];
return Container(
margin: EdgeInsets.symmetric(horizontal: 8.w),
height: 168.w,
width: 168.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.w),
image: DecorationImage(
image: (imgObj is String)
? AssetImage(imgObj)
: FileImage(imgObj)),
),
);
},
itemCount: widget.model.imgs.length,
),
);
}
}

@ -74,6 +74,7 @@ flutter:
- assets/message/ - assets/message/
- assets/static_temp/ - assets/static_temp/
- assets/static_fix/
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
# assets: # assets:
# - images/a_dot_burr.jpeg # - images/a_dot_burr.jpeg

Loading…
Cancel
Save