设备分享

This commit is contained in:
czz
2025-07-22 14:02:52 +08:00
parent 210617c6ff
commit 7ef7f89507
3 changed files with 276 additions and 477 deletions

View File

@@ -309,155 +309,38 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
),
getLine(),
Obx(
() => Container(
() => InkWell(
onTap: () {
// 延迟执行的代码
FocusScope.of(context)
.requestFocus(
FocusNode());
Future.delayed(
const Duration(
milliseconds: 250),
() {
showOneSelectionDialog(
context,
arr: ["", ""],
checkIndex: controller
.model
.peopleList[
index]['gender'],
checkChange: (sindex) {
controller.model.peopleList[
index]['gender'] =
sindex; // 👈 保存为 0 / 1
controller.updateAll();
});
});
},
child: Container(
margin: EdgeInsets.only(
left: 40.rpx,
right: 35.rpx),
width: double.infinity,
height: 90.rpx,
decoration: BoxDecoration(),
child: InkWell(
onTap: () {
// 延迟执行的代码
FocusScope.of(context)
.requestFocus(
FocusNode());
Future.delayed(
const Duration(
milliseconds:
250), () {
showOneSelectionDialog(
context,
arr: ["", ""],
checkIndex: controller
.model
.peopleList[index]
[
'gender'] ==
""
? 0
: 1,
checkChange:
(sindex) {
controller.model.peopleList[
index]
['gender'] =
sindex; // 👈 保存为 0 / 1
controller
.updateAll();
});
});
},
child: Row(
mainAxisSize:
MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'性别',
style: TextStyle(
fontFamily:
'Readex Pro',
color: Color(
0xFF9EA4B7),
fontSize: 30.rpx,
letterSpacing: 0,
),
),
Row(
mainAxisSize:
MainAxisSize.max,
children: [
Container(
width: 200.rpx,
child: Text(
'${controller.model.peopleList[index]['gender'] == 1 ? '' : ''}',
textAlign:
TextAlign
.right,
style:
TextStyle(
fontFamily:
'Readex Pro',
color: Colors
.white,
fontSize:
30.rpx,
letterSpacing:
0,
),
),
),
SizedBox(
width: 16.rpx,
),
Container(
height: 30.rpx,
width: 30.rpx,
child:
SvgPicture
.asset(
'assets/img/icon/expand_more.svg',
color: Colors
.white,
))
],
),
],
),
)),
),
getLine(),
Container(
width: double.infinity,
height: 90.rpx,
margin: EdgeInsets.only(
left: 40.rpx,
right: 35.rpx),
decoration: BoxDecoration(),
child: InkWell(
onTap: () {
// Convert string height to int for initial value
final currentHeight =
controller.model
.peopleList[
index]['height'];
final initialHeight =
currentHeight != null
? int.tryParse(
currentHeight
.toString()) ??
170
: 170;
FocusScope.of(context)
.requestFocus(
FocusNode());
Future.delayed(
const Duration(
milliseconds: 250),
() {
showHeightPickerDialog(
context,
initialHeight:
initialHeight,
onConfirm: (int
selectedHeight) {
controller.model.peopleList[
index]
['height'] =
selectedHeight
.toString();
controller
.updateAll();
print(
"身高: $selectedHeight cm");
},
);
});
},
child: Row(
mainAxisSize:
MainAxisSize.max,
@@ -466,7 +349,205 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
.spaceBetween,
children: [
Text(
'身高(cm)',
'性别',
style: TextStyle(
fontFamily:
'Readex Pro',
color:
Color(0xFF9EA4B7),
fontSize: 30.rpx,
letterSpacing: 0,
),
),
Row(
mainAxisSize:
MainAxisSize.max,
children: [
Container(
width: 200.rpx,
child: Text(
controller.model.peopleList[
index]
[
'gender'] ==
0
? ''
: '',
textAlign:
TextAlign
.right,
style: TextStyle(
fontFamily:
'Readex Pro',
color: Colors
.white,
fontSize:
30.rpx,
letterSpacing:
0,
),
),
),
SizedBox(
width: 16.rpx,
),
Container(
height: 30.rpx,
width: 30.rpx,
child: SvgPicture
.asset(
'assets/img/icon/expand_more.svg',
color: Colors
.white,
))
],
),
],
),
),
),
),
getLine(),
InkWell(
onTap: () {
// Convert string height to int for initial value
final currentHeight = controller
.model.peopleList[index]
['height'];
final initialHeight =
currentHeight != null
? int.tryParse(
currentHeight
.toString()) ??
170
: 170;
FocusScope.of(context)
.requestFocus(FocusNode());
Future.delayed(
const Duration(
milliseconds: 250), () {
showHeightPickerDialog(
context,
initialHeight:
initialHeight,
onConfirm:
(int selectedHeight) {
controller.model.peopleList[
index]['height'] =
selectedHeight
.toString();
controller.updateAll();
print(
"身高: $selectedHeight cm");
},
);
});
},
child: Container(
width: double.infinity,
height: 90.rpx,
margin: EdgeInsets.only(
left: 40.rpx,
right: 35.rpx),
decoration: BoxDecoration(),
child: Row(
mainAxisSize:
MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'身高(cm)',
style: TextStyle(
fontFamily:
'Readex Pro',
color:
Color(0xFF9EA4B7),
fontSize: 30.rpx,
letterSpacing: 0,
),
),
Row(
children: [
Text(
controller.model.peopleList[
index]
[
'height'] !=
null
? "${controller.model.peopleList[index]['height']} cm"
: '',
style: TextStyle(
fontFamily:
'Readex Pro',
color: Colors.white,
fontSize: 30.rpx,
),
),
SizedBox(width: 16.rpx),
Container(
height: 30.rpx,
width: 30.rpx,
child: SvgPicture
.asset(
'assets/img/icon/expand_more.svg',
color:
Colors.white,
))
],
),
],
),
),
),
getLine(),
Obx(
() => InkWell(
onTap: () {
FocusScope.of(context)
.requestFocus(
FocusNode());
Future.delayed(
const Duration(
milliseconds: 250),
() {
showWeightPickerDialog(
context,
initialWeight: controller
.model
.peopleList[
index]['weight'] ??
"",
onConfirm:
(int selectedWeight) {
controller.model
.peopleList[
index]['weight'] =
selectedWeight
.toString(); // ✅ 转成字符串
controller.updateAll();
},
);
});
},
child: Container(
width: double.infinity,
height: 90.rpx,
margin: EdgeInsets.only(
left: 40.rpx,
right: 35.rpx),
decoration: BoxDecoration(),
child: Row(
mainAxisSize:
MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'体重(kg)',
style: TextStyle(
fontFamily:
'Readex Pro',
@@ -482,9 +563,9 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
controller.model.peopleList[
index]
[
'height'] !=
'weight'] !=
null
? "${controller.model.peopleList[index]['height']} cm"
? "${controller.model.peopleList[index]['weight']} kg"
: '',
style: TextStyle(
fontFamily:
@@ -509,158 +590,50 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
),
],
),
)),
getLine(),
Obx(
() => Container(
width: double.infinity,
height: 90.rpx,
margin: EdgeInsets.only(
left: 40.rpx,
right: 35.rpx),
decoration: BoxDecoration(),
child: InkWell(
onTap: () {
FocusScope.of(context)
.requestFocus(
FocusNode());
Future.delayed(
const Duration(
milliseconds:
250), () {
showWeightPickerDialog(
context,
initialWeight: controller
.model
.peopleList[
index]
['weight'] ??
"",
onConfirm: (int
selectedWeight) {
controller.model.peopleList[
index]
['weight'] =
selectedWeight
.toString(); // ✅ 转成字符串
controller
.updateAll();
print(
"体重: $selectedWeight kg");
},
);
});
},
child: Row(
mainAxisSize:
MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'体重(kg)',
style: TextStyle(
fontFamily:
'Readex Pro',
color: Color(
0xFF9EA4B7),
fontSize: 30.rpx,
letterSpacing: 0,
),
),
Row(
children: [
Text(
controller.model.peopleList[
index]
[
'weight'] !=
null
? "${controller.model.peopleList[index]['weight']} kg"
: '',
style: TextStyle(
fontFamily:
'Readex Pro',
color: Colors
.white,
fontSize:
30.rpx,
),
),
SizedBox(
width: 16.rpx),
Container(
height: 30.rpx,
width: 30.rpx,
child:
SvgPicture
.asset(
'assets/img/icon/expand_more.svg',
color: Colors
.white,
))
],
),
],
),
)),
),
),
),
getLine(),
Obx(
() => Container(
width: double.infinity,
height: 90.rpx,
margin: EdgeInsets.only(
left: 40.rpx,
right: 35.rpx),
decoration: BoxDecoration(),
child: InkWell(
onTap: () {
// 延迟执行的代码
FocusScope.of(context)
.requestFocus(
FocusNode());
Future.delayed(
const Duration(
milliseconds:
250), () {
showDateSelectionDialog(
context,
checkDate: controller
.model
.peopleList[index]['birthday']
is DateTime
? controller
.model
.peopleList[index]
['birthday']
: DateTime.tryParse(
controller.model.peopleList[index]['birthday'] ??
'') ??
DateTime.now(),
checkChange:
(DateTime d) {
controller.model
.peopleList[
index]
['birthday'] = d;
controller
.updateAll();
print("$d");
// final String dateStr =
// "${d.year}-${d.month.toString().padLeft(2, '0')}";
// controller.model.peopleList[
// index]
// ['birthday'] =
// dateStr;
// controller
// .updateAll();
// print(dateStr);
});
Obx(() => InkWell(
onTap: () {
// 延迟执行的代码
FocusScope.of(context)
.requestFocus(
FocusNode());
Future.delayed(
const Duration(
milliseconds: 250),
() {
showDateSelectionDialog(
context,
checkDate: controller
.model
.peopleList[index]
['birthday']
is DateTime
? controller.model
.peopleList[index]
['birthday']
: DateTime.tryParse(
controller.model.peopleList[index]['birthday'] ??
'') ??
DateTime.now(),
checkChange: (DateTime d) {
controller.model
.peopleList[
index]
['birthday'] = d;
controller.updateAll();
});
},
});
},
child: Container(
width: double.infinity,
height: 90.rpx,
margin: EdgeInsets.only(
left: 40.rpx,
right: 35.rpx),
decoration: BoxDecoration(),
child: Row(
mainAxisSize:
MainAxisSize.max,
@@ -732,8 +705,8 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
),
],
),
)),
),
),
)),
getLine(),
Container(
width: double.infinity,