This commit is contained in:
wyf
2025-05-23 14:51:09 +08:00
parent 8a418c9c98
commit c650bad8b1
36 changed files with 1297 additions and 892 deletions

View File

@@ -49,8 +49,8 @@ class _EPageState extends State<PersonPage> {
personController.name.value = '';
personController.gender.value = 1;
personController.birthday.value = "";
personController.weight.value = 65;
personController.dateTime = DateTime.now();
personController.weight.value = "";
personController.dateTime = null;
}
@override
@@ -107,8 +107,8 @@ class _EPageState extends State<PersonPage> {
if (apiRespons.code == HttpStatusCodes.ok) {
TopSlideNotification.show(context,
text: apiRespons.msg!);
// Get.offAllNamed("/bindDeviceSuccess");
Get.toNamed("/wifiPage");
Get.offAllNamed("/bindDeviceSuccess");
// Get.toNamed("/wifiPage");
} else {
TopSlideNotification.show(context,
text: apiRespons.msg!,
@@ -200,6 +200,7 @@ class _EPageState extends State<PersonPage> {
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
@@ -440,6 +441,7 @@ class _EPageState extends State<PersonPage> {
personController.dateTime = d;
personController.updateAll();
},
title: "生日".tr
);
});
},
@@ -499,8 +501,7 @@ class _EPageState extends State<PersonPage> {
.height.value
.toString(),
onChanged: (value) {
personController.height.value =
int.tryParse(value) ?? 0;
personController.height.value = value;
},
autofocus: false,
obscureText: false,
@@ -573,7 +574,8 @@ class _EPageState extends State<PersonPage> {
Obx(() {
final height =
personController.height.value;
return height == 0
return (height == null ||
height.isEmpty)
? const SizedBox.shrink() // 不显示任何内容
: Text(
'${height}cm',
@@ -621,12 +623,10 @@ class _EPageState extends State<PersonPage> {
FilteringTextInputFormatter
.digitsOnly,
],
initialValue: personController
.weight.value
.toString(),
initialValue:
personController.weight.value,
onChanged: (value) {
personController.weight.value =
int.tryParse(value) ?? 0;
personController.weight.value = value;
},
autofocus: false,
obscureText: false,
@@ -699,7 +699,8 @@ class _EPageState extends State<PersonPage> {
Obx(() {
final weight =
personController.weight.value;
return weight == 0
return (weight == null ||
weight.isEmpty)
? const SizedBox.shrink() // 不显示任何内容
: Text(
'${weight}kg',
@@ -768,7 +769,6 @@ class _EPageState extends State<PersonPage> {
}
personController.model.read = 0;
personController.updateAll();
},
);
}).toList(),

View File

@@ -3,6 +3,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
Future showDateSelectionDialog(BuildContext context,
@@ -68,70 +69,76 @@ Future showDateSelectionDialog(BuildContext context,
color: themeController.currentColor.sc5,
alignment: Alignment.centerLeft,
height: 80.rpx,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
InkWell(
child: Text(
"日期.取消".tr,
child: Padding(
padding: EdgeInsets.only(left: 30.rpx, right: 30.rpx),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
InkWell(
child: Text(
"日期.取消".tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color:
themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: AppConstants()
.normal_text_fontSize),
),
onTap: () {
Get.back();
},
),
Text(
"$title",
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: AppConstants()
.normal_text_fontSize),
fontSize:
AppConstants().title_text_fontSize),
),
onTap: () {
Get.back();
},
),
Text(
"$title",
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize:
AppConstants().title_text_fontSize),
),
// closeIconWhite,
InkWell(
child: Text(
"日期.确定".tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: AppConstants()
.normal_text_fontSize),
),
onTap: () {
checkChange?.call(DateTime(years[yearIndex],
months[monthIndex], days[dayIndex]));
Get.back();
},
)
],
// closeIconWhite,
InkWell(
child: Text(
"日期.确定".tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color:
themeController.currentColor.sc2,
letterSpacing: 0,
fontSize: AppConstants()
.normal_text_fontSize),
),
onTap: () {
checkChange?.call(DateTime(years[yearIndex],
months[monthIndex], days[dayIndex]));
Get.back();
},
)
],
),
),
),
Container(
height: 240.rpx,
margin: EdgeInsets.only(top: 60.rpx, bottom: 60.rpx),
padding: EdgeInsets.only(left: 30.rpx, right: 30.rpx),
child: Container(
child: Row(
children: [
Expanded(
child: Container(
padding: EdgeInsets.only(
left: 40.rpx, right: 30.rpx),
padding: EdgeInsets.symmetric(horizontal: 30.rpx),
child: Row(
mainAxisAlignment: MainAxisAlignment.center, // ✅ 整体居中
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
children: [
SizedBox(
width: 120.rpx,
child: getOnePicker(context, years, yearIndex,
(d) {
yearIndex = d;
@@ -147,26 +154,18 @@ Future showDateSelectionDialog(BuildContext context,
.day;
days_select.value =
days.sublist(0, day_len);
}),
}, "".tr),
),
),
Container(
child: Text(
"",
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color:
themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx),
),
),
Expanded(
child: Container(
padding: EdgeInsets.only(
left: 30.rpx, right: 30.rpx),
],
),
SizedBox(width: 100.rpx),
// 月
Row(
children: [
SizedBox(
width: 80.rpx,
child: getOnePicker(
context, months, monthIndex, (d) {
monthIndex = d;
@@ -182,58 +181,29 @@ Future showDateSelectionDialog(BuildContext context,
.day;
days_select.value =
days.sublist(0, day_len);
}, "".tr),
),
],
),
SizedBox(width: 100.rpx),
Row(
children: [
SizedBox(
width: 80.rpx,
child: Obx(() {
return getOnePicker(
context, days_select, dayIndex, (d) {
dayIndex = d;
}, "".tr);
}),
),
),
Container(
child: Text(
"",
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color:
themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx),
),
),
Expanded(
child: Container(
padding: EdgeInsets.only(
left: 30.rpx, right: 40.rpx),
child: Obx(
() {
// print("${dayIndex} ${day_len}");
return getOnePicker(
context,
days_select,
dayIndex,
(d) {
dayIndex = d;
},
);
},
),
),
),
Container(
child: Text(
"",
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color:
themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx),
),
),
],
),
],
),
],
),
),
)
],
),
),
@@ -246,9 +216,20 @@ Future showDateSelectionDialog(BuildContext context,
);
}
getOnePicker(context, List arr, int checkIndex, Function onSelectedItemChanged,
TextStyle _unitStyle(BuildContext context) {
return FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
fontSize: 30.rpx,
letterSpacing: 0,
);
}
getOnePicker(BuildContext context, List arr, int checkIndex,
Function onSelectedItemChanged, String unit,
{bool looping = false}) {
ThemeController themeController = Get.find();
return CupertinoPicker(
key: UniqueKey(),
useMagnifier: false,
@@ -258,24 +239,22 @@ getOnePicker(context, List arr, int checkIndex, Function onSelectedItemChanged,
squeeze: 1,
looping: looping,
scrollController: FixedExtentScrollController(initialItem: checkIndex),
selectionOverlay: Container(),
selectionOverlay: Container(), // 不要默认选中遮罩
onSelectedItemChanged: (int value) {
// print("$value");
onSelectedItemChanged.call(value);
},
children: [
...List.generate(arr.length, (index) {
return Container(
alignment: Alignment.center,
width: 400.rpx,
child: Text("${arr[index]}",
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx)),
);
})
],
children: List.generate(arr.length, (index) {
return Container(
alignment: Alignment.center,
child: Text(
"${arr[index]}$unit", // ✅ 每项都带单位
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
fontSize: 30.rpx,
),
),
);
}),
);
}

View File

@@ -38,6 +38,7 @@ class _UpdatePageState extends State<UpdatePersonPage> {
@override
void initState() {
super.initState();
personController.dateTime = null;
personController.getDiseaseData().then((apiResponse) {
if (apiResponse.code != HttpStatusCodes.ok) {
TopSlideNotification.show(
@@ -108,7 +109,6 @@ class _UpdatePageState extends State<UpdatePersonPage> {
if (apiRespons.code == HttpStatusCodes.ok) {
TopSlideNotification.show(context,
text: apiRespons.msg!);
} else {
TopSlideNotification.show(context,
text: apiRespons.msg!,
@@ -201,6 +201,8 @@ class _UpdatePageState extends State<UpdatePersonPage> {
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
@@ -269,7 +271,7 @@ class _UpdatePageState extends State<UpdatePersonPage> {
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.center,
children: [
children: [
Obx(
() {
bool isMaleGreyed =
@@ -441,6 +443,7 @@ class _UpdatePageState extends State<UpdatePersonPage> {
personController.dateTime = d;
personController.updateAll();
},
title: "生日".tr,
);
});
},
@@ -488,7 +491,7 @@ class _UpdatePageState extends State<UpdatePersonPage> {
alignment: AlignmentDirectional(0, 0),
child: Stack(
alignment: Alignment.center,
children: [
children: [
TextFormField(
keyboardType: TextInputType.number,
inputFormatters: [
@@ -499,8 +502,7 @@ class _UpdatePageState extends State<UpdatePersonPage> {
.height.value
.toString(),
onChanged: (value) {
personController.height.value =
int.tryParse(value) ?? 0;
personController.height.value = value;
},
autofocus: false,
obscureText: false,
@@ -573,7 +575,8 @@ class _UpdatePageState extends State<UpdatePersonPage> {
Obx(() {
final height =
personController.height.value;
return height == 0
return (height == null ||
height.isEmpty)
? const SizedBox.shrink() // 不显示任何内容
: Text(
'${height}cm',
@@ -625,8 +628,7 @@ class _UpdatePageState extends State<UpdatePersonPage> {
.weight.value
.toString(),
onChanged: (value) {
personController.weight.value =
int.tryParse(value) ?? 0;
personController.weight.value = value;
},
autofocus: false,
obscureText: false,
@@ -698,8 +700,9 @@ class _UpdatePageState extends State<UpdatePersonPage> {
),
Obx(() {
final weight =
personController.weight.value;
return weight == 0
personController.weight?.value;
return (weight == null ||
weight.isEmpty)
? const SizedBox.shrink() // 不显示任何内容
: Text(
'${weight}kg',