更新首页数据滚动效果
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
@@ -184,7 +185,7 @@ class _HomePageState extends State<HomePage> {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (userInfoController.model.login == 1) {
|
||||
homeController.getSleepReport();
|
||||
// deviceController.getSleepReport();
|
||||
deviceController.getDeviceNum().then((apiResponse) {
|
||||
if (apiResponse.code != HttpStatusCodes.ok) {
|
||||
TopSlideNotification.show(
|
||||
@@ -203,7 +204,9 @@ class _HomePageState extends State<HomePage> {
|
||||
);
|
||||
} else {
|
||||
//请求睡眠报告
|
||||
deviceController.getSleepReport();
|
||||
deviceController.getSleepReport().then((value) {
|
||||
homeController.updateAll();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1006,7 +1009,13 @@ class _HomePageState extends State<HomePage> {
|
||||
Map<String, List<dynamic>> reportData =
|
||||
deviceController.sleepReportData.value;
|
||||
var deviceList = deviceController.deviceList.value
|
||||
.where((device) => device['show'] == true)
|
||||
.where((device) => (device['show'] == true &&
|
||||
device['bind_type'] ==
|
||||
homeController.model.type))
|
||||
.toList();
|
||||
var newList = deviceList
|
||||
.map((device) =>
|
||||
{'mac': device['mac'], 'show': device['show']})
|
||||
.toList();
|
||||
if (deviceList.isEmpty) {
|
||||
return Expanded(child: NullDataWidget());
|
||||
@@ -1022,11 +1031,30 @@ class _HomePageState extends State<HomePage> {
|
||||
)
|
||||
.toList();
|
||||
if (macList.length != deviceList.length) {
|
||||
edm.EasyDartModule.logger.info(
|
||||
"[首页睡眠报告问题]reportData数量: ${macList.length}");
|
||||
edm.EasyDartModule.logger.info(
|
||||
"[首页睡眠报告问题]reportData信息: ${macList.toString()}");
|
||||
edm.EasyDartModule.logger.info(
|
||||
"[首页睡眠报告问题]deviceList数量: ${deviceList.length}");
|
||||
edm.EasyDartModule.logger.info(
|
||||
"[首页睡眠报告问题]deviceList信息: ${newList.toString()}");
|
||||
return Expanded(
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: themeController.currentColor.sc1,
|
||||
)),
|
||||
// child: Column(
|
||||
// children: [
|
||||
// Text(
|
||||
// "[首页睡眠报告问题]reportData数量: ${macList.length}\n" +
|
||||
// "[首页睡眠报告问题]reportData信息: ${macList.toString()}\n" +
|
||||
// "[首页睡眠报告问题]deviceList数量: ${deviceList.length}\n" +
|
||||
// "[首页睡眠报告问题]deviceList信息: ${deviceList.toString()}\n",
|
||||
// style: TextStyle(color: Colors.red),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user