|
|
@ -4,6 +4,8 @@ import 'dart:async';
|
|
|
|
import 'package:aku_community_manager/provider/message_provider.dart';
|
|
|
|
import 'package:aku_community_manager/provider/message_provider.dart';
|
|
|
|
import 'package:aku_community_manager/ui/widgets/common/aku_button.dart';
|
|
|
|
import 'package:aku_community_manager/ui/widgets/common/aku_button.dart';
|
|
|
|
import 'package:aku_community_manager/ui/widgets/common/aku_material_button.dart';
|
|
|
|
import 'package:aku_community_manager/ui/widgets/common/aku_material_button.dart';
|
|
|
|
|
|
|
|
import 'package:aku_community_manager/utils/websocket/web_socket_util.dart';
|
|
|
|
|
|
|
|
import 'package:bot_toast/bot_toast.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
|
|
|
|
|
|
@ -64,6 +66,8 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
bool _onload = true;
|
|
|
|
bool _onload = true;
|
|
|
|
EasyRefreshController? _refreshController;
|
|
|
|
EasyRefreshController? _refreshController;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DateTime? _lastPressed;
|
|
|
|
|
|
|
|
|
|
|
|
///自定义bar的菜单按钮
|
|
|
|
///自定义bar的菜单按钮
|
|
|
|
Widget _menuButton(String assetPath, String text, Widget page) {
|
|
|
|
Widget _menuButton(String assetPath, String text, Widget page) {
|
|
|
|
final appProvider = Provider.of<AppProvider>(context);
|
|
|
|
final appProvider = Provider.of<AppProvider>(context);
|
|
|
@ -400,7 +404,21 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
//需要重构
|
|
|
|
//需要重构
|
|
|
|
body: EasyRefresh(
|
|
|
|
body: WillPopScope(
|
|
|
|
|
|
|
|
onWillPop: () async {
|
|
|
|
|
|
|
|
if (_lastPressed == null ||
|
|
|
|
|
|
|
|
DateTime.now().difference(_lastPressed!) >
|
|
|
|
|
|
|
|
Duration(seconds: 1)) {
|
|
|
|
|
|
|
|
//两次点击间隔超过1秒重新计算
|
|
|
|
|
|
|
|
_lastPressed = DateTime.now();
|
|
|
|
|
|
|
|
BotToast.showText(text: '再点击一次返回退出');
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//否则关闭app
|
|
|
|
|
|
|
|
WebSocketUtil().closeWebSocket();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: EasyRefresh(
|
|
|
|
firstRefresh: true,
|
|
|
|
firstRefresh: true,
|
|
|
|
header: MaterialHeader(),
|
|
|
|
header: MaterialHeader(),
|
|
|
|
controller: _refreshController,
|
|
|
|
controller: _refreshController,
|
|
|
@ -412,7 +430,7 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
var dataList = await BussinessFunc.getBussinessModelList(1);
|
|
|
|
var dataList = await BussinessFunc.getBussinessModelList(1);
|
|
|
|
_todoModelList =
|
|
|
|
_todoModelList =
|
|
|
|
dataList.map((e) => ToDoModel.fromJson(e)).toList();
|
|
|
|
dataList.map((e) => ToDoModel.fromJson(e)).toList();
|
|
|
|
_anounceMentList = await _getAnouncement() ;
|
|
|
|
_anounceMentList = await _getAnouncement();
|
|
|
|
_onload = false;
|
|
|
|
_onload = false;
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -475,8 +493,8 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
child: Stack(children: [
|
|
|
|
child: Stack(children: [
|
|
|
|
CarouselSlider(
|
|
|
|
CarouselSlider(
|
|
|
|
items: _anounceMentList
|
|
|
|
items: _anounceMentList
|
|
|
|
.map(
|
|
|
|
.map((e) =>
|
|
|
|
(e) => AllAnouncementState.anounceCard(e))
|
|
|
|
AllAnouncementState.anounceCard(e))
|
|
|
|
.toList(),
|
|
|
|
.toList(),
|
|
|
|
options: CarouselOptions(
|
|
|
|
options: CarouselOptions(
|
|
|
|
viewportFraction: 1.0,
|
|
|
|
viewportFraction: 1.0,
|
|
|
@ -502,8 +520,8 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
return Container(
|
|
|
|
return Container(
|
|
|
|
width: 12.w,
|
|
|
|
width: 12.w,
|
|
|
|
height: 12.w,
|
|
|
|
height: 12.w,
|
|
|
|
margin:
|
|
|
|
margin: EdgeInsets.symmetric(
|
|
|
|
EdgeInsets.symmetric(horizontal: 12.w),
|
|
|
|
horizontal: 12.w),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
color: _currentIndicator == index
|
|
|
|
color: _currentIndicator == index
|
|
|
@ -621,12 +639,18 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
_card(_itemNumModel.unProcessedNum ?? 0,
|
|
|
|
_card(
|
|
|
|
'未处理事项', Color(0xFFFF4E0D), 0),
|
|
|
|
_itemNumModel.unProcessedNum ?? 0,
|
|
|
|
|
|
|
|
'未处理事项',
|
|
|
|
|
|
|
|
Color(0xFFFF4E0D),
|
|
|
|
|
|
|
|
0),
|
|
|
|
GridientDiveder()
|
|
|
|
GridientDiveder()
|
|
|
|
.verticalDivider(166.5.w),
|
|
|
|
.verticalDivider(166.5.w),
|
|
|
|
_card(_itemNumModel.processingNum ?? 0,
|
|
|
|
_card(
|
|
|
|
'处理中事项', Color(0xFFFFC40C), 1),
|
|
|
|
_itemNumModel.processingNum ?? 0,
|
|
|
|
|
|
|
|
'处理中事项',
|
|
|
|
|
|
|
|
Color(0xFFFFC40C),
|
|
|
|
|
|
|
|
1),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Row(children: [
|
|
|
|
Row(children: [
|
|
|
@ -643,8 +667,8 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
.verticalDivider(
|
|
|
|
.verticalDivider(
|
|
|
|
166.5.w,
|
|
|
|
166.5.w,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
_card(_itemNumModel.allNum ?? 0, '全部事项',
|
|
|
|
_card(_itemNumModel.allNum ?? 0,
|
|
|
|
Color(0xFF333333), 3),
|
|
|
|
'全部事项', Color(0xFF333333), 3),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
@ -654,6 +678,7 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
value: SystemUiOverlayStyle.dark,
|
|
|
|
value: SystemUiOverlayStyle.dark,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|