修复首页待办事项显示

hmxc
张萌 4 years ago
parent dcd8b77c6b
commit 43ac4aa086

@ -2,6 +2,7 @@ import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/models/todo_bussiness/todo_model.dart';
import 'package:aku_community_manager/models/todo_bussiness/todo_outdoor_model.dart';
import 'package:aku_community_manager/ui/home/business/bussiness_func.dart';
import 'package:aku_community_manager/ui/home/business/todo_outdoor_card.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_fix_card.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
@ -22,15 +23,18 @@ class _BussinessViewState extends State<BussinessView>
with AutomaticKeepAliveClientMixin {
List _modelList;
EasyRefreshController _refreshController;
ScrollController _scrollController;
@override
void initState() {
super.initState();
_refreshController = EasyRefreshController();
_scrollController = ScrollController();
}
@override
void dispose() {
_refreshController?.dispose();
_scrollController?.dispose();
super.dispose();
}
@ -38,11 +42,12 @@ class _BussinessViewState extends State<BussinessView>
Widget build(BuildContext context) {
super.build(context);
return EasyRefresh(
scrollController: _scrollController,
firstRefresh: true,
controller: _refreshController,
header: MaterialHeader(),
onRefresh: () async {
var dataList = await getBussinessModelList(widget.backlogStatus);
var dataList = await BussinessFunc.getBussinessModelList(widget.backlogStatus);
_modelList = dataList.map((e) => ToDoModel.fromJson(e)).toList();
setState(() {});
},
@ -69,13 +74,7 @@ class _BussinessViewState extends State<BussinessView>
return SizedBox();
}
Future getBussinessModelList(int backlogStatus) async {
Response response =
await NetUtil().dio.get(API.manage.backlogList, queryParameters: {
"backlogStatus": backlogStatus,
});
return response.data['data'] as List;
}
@override
bool get wantKeepAlive => true;

@ -0,0 +1,13 @@
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:dio/dio.dart';
class BussinessFunc{
static Future getBussinessModelList(int backlogStatus) async {
Response response =
await NetUtil().dio.get(API.manage.backlogList, queryParameters: {
"backlogStatus": backlogStatus,
});
return response.data['data'] as List;
}
}

@ -3,6 +3,11 @@ import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/models/manager/decoration/decoration_list_model.dart';
import 'package:aku_community_manager/models/manager/item_num_model.dart';
import 'package:aku_community_manager/models/todo_bussiness/todo_model.dart';
import 'package:aku_community_manager/models/todo_bussiness/todo_outdoor_model.dart';
import 'package:aku_community_manager/ui/home/business/business_view.dart';
import 'package:aku_community_manager/ui/home/business/bussiness_func.dart';
import 'package:aku_community_manager/ui/home/business/todo_outdoor_card.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
@ -54,6 +59,7 @@ class HomePage extends StatefulWidget {
class _HomePageState extends State<HomePage> {
ItemNumModel _itemNumModel;
List _todoModelList;
bool _onload = true;
///bar
@ -148,6 +154,8 @@ class _HomePageState extends State<HomePage> {
));
Future.delayed(Duration(milliseconds: 300), () async {
_itemNumModel = await _getItemNum();
var dataList = await BussinessFunc.getBussinessModelList(1);
_todoModelList = dataList.map((e) => ToDoModel.fromJson(e)).toList();
_onload = false;
setState(() {});
});
@ -529,20 +537,28 @@ class _HomePageState extends State<HomePage> {
width: 526.w,
child: Builder(
builder: (context) {
final item =
AllModel(context).waitThings[index];
if (item is DecorationListModel) {
return DecorationManagerCard(model: item);
} else if (item is BussinessAndFixModel) {
if (_todoModelList[index]
.dynamicModel
.runtimeType ==
BussinessAndFixModel) {
return BusinessFixCard(
model: item, homeDisplay: true);
model: _todoModelList[index]
.dynamicModel);
} else if (_todoModelList[index]
.dynamicModel
.runtimeType ==
ToDoOutDoorModel) {
return ToDoOutDoorCard(
model:
_todoModelList[index].dynamicModel,
);
} else
return SizedBox();
},
),
);
},
itemCount: AllModel(context).waitThings.length,
itemCount: _todoModelList.length,
),
),
SizedBox(height: 24.w),

@ -19,7 +19,7 @@ class _AkuTabBarState extends State<AkuTabBar> {
@override
Widget build(BuildContext context) {
return TabBar(
isScrollable: true,
// isScrollable: true,
labelColor: AppStyle.primaryTextColor,
unselectedLabelColor: AppStyle.minorTextColor,
labelStyle: TextStyle(

Loading…
Cancel
Save