人员资料填写方法改为选择 睡眠数据的多语言
This commit is contained in:
@@ -753,141 +753,6 @@ Future<void> showHeightPickerDialog(
|
||||
);
|
||||
}
|
||||
|
||||
// Future showDayTimeSelectionDialog(BuildContext context,
|
||||
// {required List<int> dayTimeArr, Function? checkChange, String title = ""}) {
|
||||
// ThemeController themeController = Get.find();
|
||||
|
||||
// final hours = List.generate(24, (i) => i);
|
||||
// final minutes = List.generate(60, (i) => i);
|
||||
|
||||
// final RxInt hoursIndex = RxInt(hours.indexOf(dayTimeArr[0]));
|
||||
// final RxInt minutesIndex = RxInt(minutes.indexOf(dayTimeArr[1]));
|
||||
|
||||
// return showDialog(
|
||||
// context: context,
|
||||
// barrierDismissible: true,
|
||||
// builder: (BuildContext context) {
|
||||
// return Stack(
|
||||
// children: [
|
||||
// Positioned(
|
||||
// bottom: 0,
|
||||
// left: 0,
|
||||
// right: 0,
|
||||
// child: Material(
|
||||
// color: Colors.transparent,
|
||||
// child: Dialog(
|
||||
// backgroundColor: stringToColor("#182B7C"),
|
||||
// insetPadding: EdgeInsets.zero,
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(0),
|
||||
// ),
|
||||
// child: Container(
|
||||
// width: double.infinity,
|
||||
// padding: EdgeInsets.fromLTRB(30.rpx, 10.rpx, 30.rpx, 90.rpx),
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// children: <Widget>[
|
||||
// Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Text(
|
||||
// title,
|
||||
// style: FlutterFlowTheme.of(context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: themeController.currentColor.sc3,
|
||||
// fontSize: 30.rpx,
|
||||
// ),
|
||||
// ),
|
||||
// closeIconWhite,
|
||||
// ],
|
||||
// ),
|
||||
// Container(
|
||||
// height: 240.rpx,
|
||||
// margin: EdgeInsets.only(top: 60.rpx, bottom: 60.rpx),
|
||||
// padding: EdgeInsets.only(left: 30.rpx, right: 30.rpx),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: Padding(
|
||||
// padding:
|
||||
// EdgeInsets.symmetric(horizontal: 10.rpx),
|
||||
// child: getOnePickers(context, hours, hoursIndex,
|
||||
// unit: ''),
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// "时",
|
||||
// style: FlutterFlowTheme.of(context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: themeController.currentColor.sc3,
|
||||
// fontSize: 30.rpx,
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: Padding(
|
||||
// padding:
|
||||
// EdgeInsets.symmetric(horizontal: 10.rpx),
|
||||
// child: getOnePickers(
|
||||
// context, minutes, minutesIndex,
|
||||
// unit: ''),
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// "分",
|
||||
// style: FlutterFlowTheme.of(context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: themeController.currentColor.sc3,
|
||||
// fontSize: 30.rpx,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// InkWell(
|
||||
// onTap: () {
|
||||
// checkChange?.call([
|
||||
// hours[hoursIndex.value],
|
||||
// minutes[minutesIndex.value]
|
||||
// ]);
|
||||
// Get.back();
|
||||
// },
|
||||
// child: Container(
|
||||
// height: 68.rpx,
|
||||
// alignment: Alignment.center,
|
||||
// decoration: BoxDecoration(
|
||||
// color: stringToColor("#D3B684"),
|
||||
// borderRadius: BorderRadius.circular(10.rpx),
|
||||
// ),
|
||||
// child: Text(
|
||||
// "确定",
|
||||
// style: FlutterFlowTheme.of(context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: themeController.currentColor.sc3,
|
||||
// fontSize: 30.rpx,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
Future showDayTimeSelectionDialog(
|
||||
BuildContext context, {
|
||||
|
||||
@@ -82,8 +82,6 @@ class _MinePageState extends State<MinePage> {
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
|
||||
|
||||
ClickableContainer(
|
||||
backgroundColor:
|
||||
Colors.transparent, // 容器背景色
|
||||
@@ -107,7 +105,7 @@ class _MinePageState extends State<MinePage> {
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 0.rpx, 0.rpx, 0.rpx),
|
||||
10.rpx, 10.rpx, 10.rpx, 10.rpx),
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/setting.svg',
|
||||
width: 29.rpx,
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -4,7 +4,9 @@ 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/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/pages/common/selectDialog.dart';
|
||||
|
||||
Future showDateSelectionDialog(BuildContext context,
|
||||
{required DateTime checkDate, Function? checkChange, String title = "生日"}) {
|
||||
@@ -250,3 +252,271 @@ getOnePicker(BuildContext context, List arr, int checkIndex,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showHeightPickerDialog(
|
||||
BuildContext context, {
|
||||
required int initialHeight, // 初始身高(单位:cm)
|
||||
required Function(int selectedHeight) onConfirm,
|
||||
String title = "选择身高",
|
||||
}) async {
|
||||
List<int> heights = List.generate(101, (index) => 120 + index); // 120~220cm
|
||||
int selectedIndex = heights.indexOf(initialHeight);
|
||||
// int tempIndex = selectedIndex;
|
||||
final RxInt tempIndex = RxInt(selectedIndex); // ✅ 改为 RxInt
|
||||
ThemeController themeController = Get.find();
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
builder: (BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: Dialog(
|
||||
backgroundColor: themeController.currentColor.sc17,
|
||||
insetPadding: EdgeInsets.zero,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(0),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(0.rpx, 0.rpx, 0.rpx, 90.rpx),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
padding:
|
||||
EdgeInsets.fromLTRB(30.rpx, 0.rpx, 30.rpx, 0.rpx),
|
||||
color: themeController.currentColor.sc5,
|
||||
height: 80.rpx,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
onTap: () {
|
||||
Get.back();
|
||||
},
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 110.rpx,
|
||||
height: 60.rpx,
|
||||
child: Text(
|
||||
"取消".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 30.rpx,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
)),
|
||||
Text(title,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize: 30.rpx,
|
||||
)),
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
onTap: () {
|
||||
onConfirm(
|
||||
heights[tempIndex.value]); // ✅ 使用 .value
|
||||
Get.back();
|
||||
},
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 110.rpx,
|
||||
height: 60.rpx,
|
||||
child: Text(
|
||||
"确定".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 30.rpx,
|
||||
color: themeController.currentColor.sc2,
|
||||
),
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20.rpx),
|
||||
Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: IgnorePointer(
|
||||
child: Center(
|
||||
child: Container(
|
||||
height: 90.rpx,
|
||||
margin:
|
||||
EdgeInsets.symmetric(horizontal: 95.rpx),
|
||||
decoration: BoxDecoration(
|
||||
color: themeController.currentColor.sc2,
|
||||
borderRadius: BorderRadius.circular(16.rpx),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 240.rpx,
|
||||
child: getOnePickers(
|
||||
context,
|
||||
heights,
|
||||
tempIndex, // ✅ 传入 RxInt
|
||||
unit: "cm",
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showWeightPickerDialog(
|
||||
BuildContext context, {
|
||||
required String initialWeight, // 初始体重(单位:kg)
|
||||
required Function(int selectedWeight) onConfirm,
|
||||
String title = "选择体重",
|
||||
}) async {
|
||||
List<int> weights = List.generate(151, (index) => 30 + index); // 30~180kg
|
||||
int selectedIndex = weights.indexOf(int.tryParse(initialWeight) ?? 50);
|
||||
final RxInt tempIndex = RxInt(selectedIndex); // ✅ 改为 RxInt
|
||||
|
||||
ThemeController themeController = Get.find();
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
builder: (BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: Dialog(
|
||||
backgroundColor: themeController.currentColor.sc17,
|
||||
insetPadding: EdgeInsets.zero,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(0),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(0.rpx, 0.rpx, 0.rpx, 90.rpx),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// 标题 + 按钮
|
||||
Container(
|
||||
padding:
|
||||
EdgeInsets.fromLTRB(30.rpx, 0.rpx, 30.rpx, 0.rpx),
|
||||
color: themeController.currentColor.sc5,
|
||||
height: 80.rpx,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 110.rpx,
|
||||
height: 60.rpx,
|
||||
child: Text(
|
||||
"取消".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 30.rpx,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
)),
|
||||
Text(title.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize: 30.rpx,
|
||||
)),
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
onTap: () {
|
||||
onConfirm(
|
||||
weights[tempIndex.value]); // ✅ 回调返回选中值
|
||||
Get.back();
|
||||
},
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 110.rpx,
|
||||
height: 60.rpx,
|
||||
child: Text(
|
||||
"确定".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 30.rpx,
|
||||
color: themeController.currentColor.sc2,
|
||||
),
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 20.rpx),
|
||||
Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: IgnorePointer(
|
||||
child: Center(
|
||||
child: Container(
|
||||
height: 90.rpx,
|
||||
margin:
|
||||
EdgeInsets.symmetric(horizontal: 95.rpx),
|
||||
decoration: BoxDecoration(
|
||||
color: themeController.currentColor.sc2,
|
||||
borderRadius: BorderRadius.circular(16.rpx),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 240.rpx,
|
||||
child: getOnePickers(
|
||||
context,
|
||||
weights,
|
||||
tempIndex, // ✅ 传入 RxInt
|
||||
unit: "kg",
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -564,7 +564,7 @@ List<String> buildValueTexts(
|
||||
|
||||
// 中文年月日格式
|
||||
DateTime date = DateTime.fromMillisecondsSinceEpoch(item['st']);
|
||||
final dateStr = "${date.year}年 ${date.month}月 ${date.day}日";
|
||||
final dateStr = "${date.year}/ ${date.month}/ ${date.day}";
|
||||
|
||||
return "$prefix$val$suffix\n$dateStr";
|
||||
}).toList();
|
||||
|
||||
@@ -45,7 +45,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('assets/img/bgNoImg.png'), // 本地图片
|
||||
fit: BoxFit.fill, // 填满整个 Container
|
||||
fit: BoxFit.fill, // 填满个 Container
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
|
||||
Reference in New Issue
Block a user