|
|
|
@ -15,6 +15,7 @@ import 'package:dio/dio.dart';
|
|
|
|
|
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
|
|
|
import 'package:shimmer/shimmer.dart';
|
|
|
|
|
import 'package:velocity_x/velocity_x.dart';
|
|
|
|
|
|
|
|
|
@ -61,6 +62,7 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
|
List _todoModelList;
|
|
|
|
|
List _anounceMentList;
|
|
|
|
|
bool _onload = true;
|
|
|
|
|
EasyRefreshController _refreshController;
|
|
|
|
|
|
|
|
|
|
///自定义bar的菜单按钮
|
|
|
|
|
Widget _menuButton(String assetPath, String text, Widget page) {
|
|
|
|
@ -152,17 +154,7 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
|
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
|
|
|
|
|
statusBarColor: Colors.transparent,
|
|
|
|
|
));
|
|
|
|
|
Future.delayed(Duration(milliseconds: 300), () 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(() {});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
_refreshController = EasyRefreshController();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
: _onload
|
|
|
|
|
? loadingWidget
|
|
|
|
@ -465,7 +474,8 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
|
child: Stack(children: [
|
|
|
|
|
CarouselSlider(
|
|
|
|
|
items: _anounceMentList
|
|
|
|
|
.map((e) => AllAnouncementState.anounceCard(e))
|
|
|
|
|
.map(
|
|
|
|
|
(e) => AllAnouncementState.anounceCard(e))
|
|
|
|
|
.toList(),
|
|
|
|
|
options: CarouselOptions(
|
|
|
|
|
viewportFraction: 1.0,
|
|
|
|
@ -521,7 +531,8 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
|
),
|
|
|
|
|
Spacer(),
|
|
|
|
|
AkuButton(
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 16.w),
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.symmetric(vertical: 16.w),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Get.to(BusinessPage(initIndex: 3));
|
|
|
|
|
},
|
|
|
|
@ -607,7 +618,8 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Row(children: [
|
|
|
|
|
GridientDiveder().horizontalDivider(343.w),
|
|
|
|
|
GridientDiveder()
|
|
|
|
|
.horizontalDivider(343.w),
|
|
|
|
|
GridientDiveder(isReverse: true)
|
|
|
|
|
.horizontalDivider(343.w)
|
|
|
|
|
]),
|
|
|
|
@ -629,6 +641,7 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
value: SystemUiOverlayStyle.dark,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|