更新首页
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/NullDataComponentWidget.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
@@ -66,7 +67,8 @@ class _NewHomePageState extends State<NewHomePage> {
|
||||
}
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (homeController.sleepDays.value.isNotEmpty) {
|
||||
homeController.selectedDayIndex.value = homeController.sleepDays.value.length - 1;
|
||||
homeController.selectedDayIndex.value =
|
||||
homeController.sleepDays.value.length - 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -411,7 +413,8 @@ class _NewHomePageState extends State<NewHomePage> {
|
||||
personInfo.value =
|
||||
selectedPerson;
|
||||
|
||||
homeController.selectedDayIndex =
|
||||
homeController
|
||||
.selectedDayIndex =
|
||||
(6).obs;
|
||||
print("$val");
|
||||
if (val == null) {
|
||||
@@ -470,11 +473,18 @@ class _NewHomePageState extends State<NewHomePage> {
|
||||
.value !=
|
||||
null) {
|
||||
Get.toNamed(
|
||||
"/sleepWebview",
|
||||
arguments: [
|
||||
formFieldController
|
||||
.value
|
||||
]);
|
||||
"/newSleepReportPage",
|
||||
arguments: {
|
||||
'mac':
|
||||
formFieldController
|
||||
.value!,
|
||||
'type': 1,
|
||||
"person": personInfo
|
||||
.value,
|
||||
'backgroundImg':
|
||||
'assets/images/new_background.png',
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
@@ -501,138 +511,152 @@ class _NewHomePageState extends State<NewHomePage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
top: 0.rpx,
|
||||
bottom: 20.rpx,
|
||||
left: 16.rpx,
|
||||
right: 16.rpx,
|
||||
),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Obx(() => Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize.max,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
...List.generate(
|
||||
homeController
|
||||
.sleepDays
|
||||
.value
|
||||
.length, (index) {
|
||||
var day = homeController
|
||||
.sleepDays[index];
|
||||
bool isSelected =
|
||||
homeController.selectedDayIndex
|
||||
.value ==
|
||||
index;
|
||||
return Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
homeController.selectedDayIndex
|
||||
.value = index;
|
||||
int? timeMillis =
|
||||
parseToInt(day[
|
||||
'time']); // 使用我们刚才封装的安全转换函数
|
||||
Get.toNamed(
|
||||
"/newSleepReportPage",
|
||||
arguments: {
|
||||
'date':
|
||||
timeMillis,
|
||||
'mac':
|
||||
formFieldController
|
||||
.value!,
|
||||
'type': 1,
|
||||
"person":
|
||||
personInfo
|
||||
.value,
|
||||
'backgroundImg':
|
||||
'assets/images/new_background.png',
|
||||
// 'backgroundColor':stringToColor("#003058"),
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding:
|
||||
EdgeInsets.only(
|
||||
top: 10.rpx,
|
||||
bottom: 20.rpx,
|
||||
),
|
||||
width: 90.rpx,
|
||||
decoration:
|
||||
BoxDecoration(
|
||||
color: isSelected
|
||||
? stringToColor(
|
||||
"#184468")
|
||||
: Colors
|
||||
.transparent,
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
8.rpx),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize:
|
||||
MainAxisSize
|
||||
.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment
|
||||
.center,
|
||||
children: [
|
||||
Text(
|
||||
day['week'],
|
||||
style: FlutterFlowTheme.of(
|
||||
context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
fontSize:
|
||||
30.rpx,
|
||||
letterSpacing:
|
||||
0,
|
||||
color: stringToColor(
|
||||
"#FFFFFF"),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
12.rpx),
|
||||
Text(
|
||||
day['date'],
|
||||
// "哈哈",
|
||||
style: FlutterFlowTheme.of(
|
||||
context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
letterSpacing:
|
||||
0,
|
||||
fontSize:
|
||||
22.rpx,
|
||||
color: stringToColor(
|
||||
"#929699"),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
39.rpx),
|
||||
buildScoreOrIcon(
|
||||
day['score']),
|
||||
],
|
||||
if (homeController
|
||||
.sleepDays.value.length ==
|
||||
0)
|
||||
Expanded(child: NullDataWidget()),
|
||||
if (homeController
|
||||
.sleepDays.value.length !=
|
||||
0)
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
top: 0.rpx,
|
||||
bottom: 20.rpx,
|
||||
left: 16.rpx,
|
||||
right: 16.rpx,
|
||||
),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Obx(() => Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize.max,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment
|
||||
.start,
|
||||
children: [
|
||||
...List.generate(
|
||||
homeController
|
||||
.sleepDays
|
||||
.value
|
||||
.length, (index) {
|
||||
var day = homeController
|
||||
.sleepDays[index];
|
||||
bool isSelected =
|
||||
homeController
|
||||
.selectedDayIndex
|
||||
.value ==
|
||||
index;
|
||||
return Expanded(
|
||||
child:
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
homeController
|
||||
.selectedDayIndex
|
||||
.value = index;
|
||||
int? timeMillis =
|
||||
parseToInt(day[
|
||||
'time']); // 使用我们刚才封装的安全转换函数
|
||||
Get.toNamed(
|
||||
"/newSleepReportPage",
|
||||
arguments: {
|
||||
'date':
|
||||
timeMillis,
|
||||
'mac':
|
||||
formFieldController
|
||||
.value!,
|
||||
'type': 1,
|
||||
"person":
|
||||
personInfo
|
||||
.value,
|
||||
'backgroundImg':
|
||||
'assets/images/new_background.png',
|
||||
'date':
|
||||
timeMillis,
|
||||
// 'backgroundColor':stringToColor("#003058"),
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding:
|
||||
EdgeInsets
|
||||
.only(
|
||||
top: 10.rpx,
|
||||
bottom: 20.rpx,
|
||||
),
|
||||
width: 90.rpx,
|
||||
decoration:
|
||||
BoxDecoration(
|
||||
color: isSelected
|
||||
? stringToColor(
|
||||
"#184468")
|
||||
: Colors
|
||||
.transparent,
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
8.rpx),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize:
|
||||
MainAxisSize
|
||||
.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment
|
||||
.center,
|
||||
children: [
|
||||
Text(
|
||||
day['week'],
|
||||
style: FlutterFlowTheme.of(
|
||||
context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
fontSize:
|
||||
30.rpx,
|
||||
letterSpacing:
|
||||
0,
|
||||
color:
|
||||
stringToColor("#FFFFFF"),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 12
|
||||
.rpx),
|
||||
Text(
|
||||
day['date'],
|
||||
// "哈哈",
|
||||
style: FlutterFlowTheme.of(
|
||||
context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
letterSpacing:
|
||||
0,
|
||||
fontSize:
|
||||
22.rpx,
|
||||
color:
|
||||
stringToColor("#929699"),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 39
|
||||
.rpx),
|
||||
buildScoreOrIcon(
|
||||
day['score']),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
})
|
||||
],
|
||||
)),
|
||||
),
|
||||
);
|
||||
})
|
||||
],
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user