人员资料填写方法改为选择 睡眠数据的多语言

This commit is contained in:
czz
2025-08-12 18:09:49 +08:00
parent fcd3a281cf
commit 3dd2d1c59d
10 changed files with 584 additions and 518 deletions

View File

@@ -392,7 +392,7 @@ class _EPageState extends State<PersonPage> {
MyUtils.formatBindTime(d);
personController.dateTime = d;
personController.updateAll();
}, title: "生日".tr);
}, title: "选择生日".tr);
});
},
child: Center(
@@ -418,9 +418,8 @@ class _EPageState extends State<PersonPage> {
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 18.rpx, 70.rpx, 0),
70.rpx, 50.rpx, 70.rpx, 0),
child: Container(
width: double.infinity,
height: 100.rpx,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50.rpx),
@@ -430,108 +429,58 @@ class _EPageState extends State<PersonPage> {
width: AppConstants().border_width,
),
),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: Stack(
alignment: Alignment.center,
children: [
// 实际输入框(输入逻辑保留)
TextFormField(
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter
.digitsOnly,
],
initialValue: personController
.height.value
.toString(),
onChanged: (value) {
personController.height.value = value;
child: InkWell(
onTap: () {
final currentHeight =
personController.height.value;
final initialHeight = currentHeight != null
? int.tryParse(
currentHeight.toString()) ??
170
: 170;
FocusScope.of(context)
.requestFocus(FocusNode());
Future.delayed(
const Duration(milliseconds: 250), () {
showHeightPickerDialog(
context,
title: "选择身高".tr,
initialHeight: initialHeight,
onConfirm: (int selectedHeight) {
personController.height.value =
selectedHeight.toString();
personController.updateAll();
print("身高: $selectedHeight cm");
},
autofocus: false,
obscureText: false,
style: TextStyle(
fontFamily: 'Inter',
color: Colors.transparent, // 隐藏输入文字
letterSpacing: 0.0,
),
textAlign: TextAlign.center,
cursorColor:
themeController.currentColor.sc3,
decoration: InputDecoration(
fillColor: Colors.transparent,
isDense: true,
hintText: '身高输入提示'.tr,
hintStyle: TextStyle(
fontFamily: 'Inter',
color: themeController
.currentColor.sc4,
fontSize: AppConstants()
.normal_text_fontSize,
letterSpacing: 0.0,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
focusedErrorBorder:
OutlineInputBorder(
borderSide: BorderSide(
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
filled: true,
),
);
});
},
child: Center(
child: Text(
personController.height.value != ""
? personController.height.value
: '身高输入提示'.tr,
textAlign: TextAlign.right,
style: TextStyle(
fontFamily: 'Readex Pro',
color: personController.height.value !=
""
? themeController.currentColor.sc3
: themeController.currentColor.sc4,
fontSize:
AppConstants().normal_text_fontSize,
letterSpacing: 0,
),
Obx(() {
final height =
personController.height.value;
return (height == null ||
height.isEmpty)
? const SizedBox.shrink() // 不显示任何内容
: Text(
'${height}cm',
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: 'Inter',
color: themeController
.currentColor.sc3,
fontSize: AppConstants()
.normal_text_fontSize,
),
);
}),
],
),
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 18.rpx, 70.rpx, 0),
70.rpx, 50.rpx, 70.rpx, 0),
child: Container(
width: double.infinity,
height: 100.rpx,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50.rpx),
@@ -541,98 +490,43 @@ class _EPageState extends State<PersonPage> {
width: AppConstants().border_width,
),
),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: Stack(
alignment: Alignment.center,
children: [
// 实际输入框(输入逻辑保留)
TextFormField(
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter
.digitsOnly,
],
initialValue:
personController.weight.value,
onChanged: (value) {
personController.weight.value = value;
child: InkWell(
onTap: () {
FocusScope.of(context)
.requestFocus(FocusNode());
Future.delayed(
const Duration(milliseconds: 250), () {
showWeightPickerDialog(
context,
title: "选择体重".tr,
initialWeight:
personController.weight.value ?? "",
onConfirm: (int selectedWeight) {
personController.weight.value =
selectedWeight
.toString(); // ✅ 转成字符串
personController.updateAll();
},
autofocus: false,
obscureText: false,
style: TextStyle(
fontFamily: 'Inter',
color: Colors.transparent, // 隐藏输入文字
letterSpacing: 0.0,
),
textAlign: TextAlign.center,
cursorColor:
themeController.currentColor.sc3,
decoration: InputDecoration(
fillColor: Colors.transparent,
isDense: true,
hintText: '人员资料.体重输入提示'.tr,
hintStyle: TextStyle(
fontFamily: 'Inter',
color: themeController
.currentColor.sc4,
fontSize: AppConstants()
.normal_text_fontSize,
letterSpacing: 0.0,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
focusedErrorBorder:
OutlineInputBorder(
borderSide: BorderSide(
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
filled: true,
),
);
});
},
child: Center(
child: Text(
personController.weight.value != ""
? personController.weight.value
: '体重输入提示'.tr,
textAlign: TextAlign.right,
style: TextStyle(
fontFamily: 'Readex Pro',
color: personController.weight.value !=
""
? themeController.currentColor.sc3
: themeController.currentColor.sc4,
fontSize:
AppConstants().normal_text_fontSize,
letterSpacing: 0,
),
Obx(() {
final weight =
personController.weight.value;
return (weight == null ||
weight.isEmpty)
? const SizedBox.shrink() // 不显示任何内容
: Text(
'${weight}kg',
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: 'Inter',
color: themeController
.currentColor.sc3,
fontSize: AppConstants()
.normal_text_fontSize,
),
);
}),
],
),
),
),
),