人员资料填写方法改为选择 睡眠数据的多语言
This commit is contained in:
@@ -393,7 +393,7 @@ class _UpdatePageState extends State<UpdatePersonPage> {
|
||||
personController.dateTime = d;
|
||||
personController.updateAll();
|
||||
},
|
||||
title: "生日".tr,
|
||||
title: "选择生日".tr,
|
||||
);
|
||||
});
|
||||
},
|
||||
@@ -420,9 +420,8 @@ class _UpdatePageState extends State<UpdatePersonPage> {
|
||||
),
|
||||
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),
|
||||
@@ -432,107 +431,59 @@ class _UpdatePageState extends State<UpdatePersonPage> {
|
||||
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),
|
||||
@@ -542,103 +493,48 @@ class _UpdatePageState extends State<UpdatePersonPage> {
|
||||
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
|
||||
.toString(),
|
||||
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,
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0, 117.rpx, 0, 0),
|
||||
|
||||
Reference in New Issue
Block a user