首页添加刷新组件

修复保修延时处理不显示的问题
hmxc
张萌 4 years ago
parent acf4994f47
commit 68da371190

@ -63,17 +63,35 @@ class AkuMap {
static Map<int, String> fixAreaType = {1: '公区维修', 2: '家庭维修'}; static Map<int, String> fixAreaType = {1: '公区维修', 2: '家庭维修'};
///- ///-
static Map<int, String> operationType = { static String operationType(int operationType) {
1: '提交报修', switch (operationType) {
2: '派单', case 1:
3: '开始处理', return '提交保修';
4: '处理完成', case 2:
5: '确认', return '派单';
6: '回访', case 3:
7: '回退', return '开始处理';
8: '作废', case 4:
9: '取消' return '处理完成';
}; case 5:
return '确认';
case 6:
return '回访';
case 7:
return '回退';
case 8:
return '作废';
case 9:
return '取消';
break;
case 10:
return '改派';
case 11:
return '延时';
default:
return '';
}
}
static Map<int, String> dispatchType = {1: '无偿服务', 2: '有偿服务'}; static Map<int, String> dispatchType = {1: '无偿服务', 2: '有偿服务'};
} }

@ -15,6 +15,7 @@ import 'package:dio/dio.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:shimmer/shimmer.dart'; import 'package:shimmer/shimmer.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
@ -61,6 +62,7 @@ class _HomePageState extends State<HomePage> {
List _todoModelList; List _todoModelList;
List _anounceMentList; List _anounceMentList;
bool _onload = true; bool _onload = true;
EasyRefreshController _refreshController;
///bar ///bar
Widget _menuButton(String assetPath, String text, Widget page) { Widget _menuButton(String assetPath, String text, Widget page) {
@ -152,17 +154,7 @@ class _HomePageState extends State<HomePage> {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.transparent, statusBarColor: Colors.transparent,
)); ));
Future.delayed(Duration(milliseconds: 300), () async { _refreshController = EasyRefreshController();
final userProvider = Provider.of<UserProvider>(context, listen: false);
if (userProvider.isLogin) {
_itemNumModel = await _getItemNum();
var dataList = await BussinessFunc.getBussinessModelList(1);
_todoModelList = dataList.map((e) => ToDoModel.fromJson(e)).toList();
_anounceMentList = await _getAnouncement();
_onload = false;
setState(() {});
}
});
} }
int _currentIndicator = 0; int _currentIndicator = 0;
@ -407,7 +399,24 @@ class _HomePageState extends State<HomePage> {
), ),
), ),
// //
body: (!UserTool.userProvider.isLogin) body: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
controller: _refreshController,
onRefresh: () async {
final userProvider =
Provider.of<UserProvider>(context, listen: false);
if (userProvider.isLogin) {
_itemNumModel = await _getItemNum();
var dataList = await BussinessFunc.getBussinessModelList(1);
_todoModelList =
dataList.map((e) => ToDoModel.fromJson(e)).toList();
_anounceMentList = await _getAnouncement();
_onload = false;
setState(() {});
}
},
child: (!UserTool.userProvider.isLogin)
? SizedBox() ? SizedBox()
: _onload : _onload
? loadingWidget ? loadingWidget
@ -465,7 +474,8 @@ class _HomePageState extends State<HomePage> {
child: Stack(children: [ child: Stack(children: [
CarouselSlider( CarouselSlider(
items: _anounceMentList items: _anounceMentList
.map((e) => AllAnouncementState.anounceCard(e)) .map(
(e) => AllAnouncementState.anounceCard(e))
.toList(), .toList(),
options: CarouselOptions( options: CarouselOptions(
viewportFraction: 1.0, viewportFraction: 1.0,
@ -521,7 +531,8 @@ class _HomePageState extends State<HomePage> {
), ),
Spacer(), Spacer(),
AkuButton( AkuButton(
padding: EdgeInsets.symmetric(vertical: 16.w), padding:
EdgeInsets.symmetric(vertical: 16.w),
onPressed: () { onPressed: () {
Get.to(BusinessPage(initIndex: 3)); Get.to(BusinessPage(initIndex: 3));
}, },
@ -607,7 +618,8 @@ class _HomePageState extends State<HomePage> {
], ],
), ),
Row(children: [ Row(children: [
GridientDiveder().horizontalDivider(343.w), GridientDiveder()
.horizontalDivider(343.w),
GridientDiveder(isReverse: true) GridientDiveder(isReverse: true)
.horizontalDivider(343.w) .horizontalDivider(343.w)
]), ]),
@ -629,6 +641,7 @@ class _HomePageState extends State<HomePage> {
], ],
), ),
), ),
),
value: SystemUiOverlayStyle.dark, value: SystemUiOverlayStyle.dark,
); );
} }

@ -42,7 +42,6 @@ class BusinessAndFixDetailPage extends StatefulWidget {
} }
class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> { class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
bool get isHandOut => widget.model.status == 1; bool get isHandOut => widget.model.status == 1;
FixedDetailModel _detailModel; FixedDetailModel _detailModel;
bool _onload = true; bool _onload = true;
@ -204,9 +203,10 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
color: AppStyle.primaryColor, color: AppStyle.primaryColor,
), ),
), ),
onPressed: () { onPressed: () async {
Get.to( await Get.to(
FixMoreTimePage(dispatchId: widget.model.dispatchId)); FixMoreTimePage(dispatchId: widget.model.dispatchId));
_easyRefreshController.callRefresh();
}, },
child: Text( child: Text(
'申请延时', '申请延时',
@ -404,7 +404,7 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
title: '报修进程', title: '报修进程',
children: _detailModel.processRecord.map((e) { children: _detailModel.processRecord.map((e) {
return _buildProcessTile( return _buildProcessTile(
AkuMap.operationType[e.operationType], AkuMap.operationType(e.operationType),
DateUtil.formatDateStr(e.operationDate, DateUtil.formatDateStr(e.operationDate,
format: 'yyyy-MM-dd HH:mm:ss'), format: 'yyyy-MM-dd HH:mm:ss'),
); );

@ -86,7 +86,7 @@ packages:
name: badges name: badges
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "2.0.0-nullsafety.1"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:

@ -69,7 +69,7 @@ dependencies:
url: http://159.75.73.143:8080/third_packages/jpush_flutter url: http://159.75.73.143:8080/third_packages/jpush_flutter
shimmer: ^2.0.0-nullsafety.0 shimmer: ^2.0.0-nullsafety.0
badges: ^1.2.0 badges: ^2.0.0-nullsafety.1
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

Loading…
Cancel
Save