设备分享

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

@@ -318,6 +318,7 @@ class _DeviceSharePageState extends State<DeviceSharePage> {
text: apiResponse.msg!, text: apiResponse.msg!,
textColor: themeController.currentColor.sc9); textColor: themeController.currentColor.sc9);
} }
}, },
colors: [ colors: [
// 渐变色 // 渐变色
@@ -350,56 +351,6 @@ class _DeviceSharePageState extends State<DeviceSharePage> {
), ),
), ),
), ),
// Padding(
// padding:
// EdgeInsetsDirectional.fromSTEB(0, 379.rpx, 0, 0),
// child: CustomCard(
// borderRadius:
// AppConstants().button_container_radius, // 圆角半径
// onTap: () async {
// // TopSlideNotification.show(context,
// // text: "待开发功能".tr);
// LoginController loginController = Get.find();
// // loginController.fluwx.share(WeChatShareTextModel(
// // "太和e护分享链接",
// // scene: WeChatScene.session));
// final Uint8List data = await rootBundle.load('assets/img/camera.png').then((bd) => bd.buffer.asUint8List());
// loginController.fluwx.share(WeChatShareWebPageModel("taihecare://goods?id=123",title: "标题",description: "描述",thumbData: data));
// },
// colors: [
// // 渐变色
// themeController.currentColor.sc1,
// themeController.currentColor.sc2,
// ],
// child: Container(
// width: MediaQuery.sizeOf(context).width * 0.66,
// height: MediaQuery.sizeOf(context).height * 0.055,
// constraints: BoxConstraints(
// minWidth: 500.rpx,
// minHeight: 90.rpx,
// ),
// child: Row(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Text(
// '微信好友一键分享'.tr,
// style: FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// color: themeController.currentColor.sc3,
// fontFamily: 'Inter',
// fontSize: AppConstants()
// .normal_text_fontSize, // 自定义字体大小
// letterSpacing: 0.0,
// ),
// ),
// ].divide(SizedBox(width: 17.rpx)),
// ),
// ),
// ),
// ),
], ],
), ),
), ),

View File

@@ -22,12 +22,17 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
final _formKey = GlobalKey<FormState>(); final _formKey = GlobalKey<FormState>();
final _phoneController = TextEditingController(); final _phoneController = TextEditingController();
fetchData() async {
await controller.shareDeviceList(data["mac"]);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
controller.model.msg = ""; controller.model.msg = "";
controller.model.code = 0; controller.model.code = 0;
controller.model.type = 1; controller.model.type = 1;
controller.model.account = ''; controller.model.account = '';
fetchData();
return GestureDetector( return GestureDetector(
// onTap: () => FocusScope.of(context).unfocus(),, // onTap: () => FocusScope.of(context).unfocus(),,
child: Container( child: Container(
@@ -278,135 +283,6 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
), ),
), ),
), ),
// Obx(
// () => GestureDetector(
// onTap: () {
// controller.model.type = 2;
// controller.updateAll();
// },
// child: Container(
// width: MediaQuery.sizeOf(context).width,
// constraints: const BoxConstraints(
// minHeight: 46,
// ),
// decoration: BoxDecoration(
// borderRadius:
// BorderRadius.circular(0),
// ),
// child: Row(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// children: [
// Text(
// '仅允许对方查看该设备'.tr,
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color: Colors.white,
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// ),
// ),
// // Theme(
// // data:
// // Theme.of(context).copyWith(
// // unselectedWidgetColor: Color(
// // 0xFFC8CBD2), // 改变未选中状态边框颜色
// // ),
// // child: Radio<int>(
// // value: 2,
// // groupValue:
// // controller.model.type,
// // onChanged: (value) {
// // controller.model.type =
// // value!;
// // controller.updateAll();
// // },
// // activeColor:
// // const Color(0xFF6BFDAC),
// // materialTapTargetSize:
// // MaterialTapTargetSize
// // .shrinkWrap, // 减少内边距
// // visualDensity: VisualDensity(
// // horizontal: -4,
// // vertical: -4), // 缩小视觉密度
// // ))
// ClipOval(
// child: Container(
// height:
// MediaQuery.sizeOf(context)
// .height *
// 0.0449,
// child: AspectRatio(
// aspectRatio: 1,
// child: Center(
// child: LayoutBuilder(
// builder: (context,
// constraints) {
// double h =
// MediaQuery.sizeOf(
// context)
// .height *
// 0.0326;
// bool check = controller
// .model.type ==
// 2;
// if (check) {
// return Container(
// height: h,
// width: h,
// decoration:
// BoxDecoration(
// borderRadius:
// BorderRadius
// .circular(
// h / 2),
// border: Border.all(
// width: 1,
// color: Color(
// 0xFF6BFDAC)),
// ),
// child: Center(
// child: ClipOval(
// child: Container(
// width:
// h * 0.6,
// height:
// h * 0.6,
// color: Color(
// 0xFF6BFDAC)),
// ),
// ),
// );
// } else {
// return Container(
// height: h,
// width: h,
// decoration:
// BoxDecoration(
// borderRadius:
// BorderRadius
// .circular(
// h / 2),
// border: Border.all(
// width: 0.5,
// color: Colors
// .white),
// ),
// );
// }
// },
// ),
// ),
// ),
// ),
// ),
// ],
// ),
// ),
// ),
// ),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
controller.model.type = 2; controller.model.type = 2;
@@ -476,7 +352,6 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
), ),
), ),
), ),
Align( Align(
alignment: const AlignmentDirectional(0, 0), alignment: const AlignmentDirectional(0, 0),
child: Padding( child: Padding(

View File

@@ -309,14 +309,7 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
), ),
getLine(), getLine(),
Obx( Obx(
() => Container( () => InkWell(
margin: EdgeInsets.only(
left: 40.rpx,
right: 35.rpx),
width: double.infinity,
height: 90.rpx,
decoration: BoxDecoration(),
child: InkWell(
onTap: () { onTap: () {
// 延迟执行的代码 // 延迟执行的代码
FocusScope.of(context) FocusScope.of(context)
@@ -324,30 +317,30 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
FocusNode()); FocusNode());
Future.delayed( Future.delayed(
const Duration( const Duration(
milliseconds: milliseconds: 250),
250), () { () {
showOneSelectionDialog( showOneSelectionDialog(
context, context,
arr: ["", ""], arr: ["", ""],
checkIndex: controller checkIndex: controller
.model .model
.peopleList[index] .peopleList[
[ index]['gender'],
'gender'] == checkChange: (sindex) {
""
? 0
: 1,
checkChange:
(sindex) {
controller.model.peopleList[ controller.model.peopleList[
index] index]['gender'] =
['gender'] =
sindex; // 👈 保存为 0 / 1 sindex; // 👈 保存为 0 / 1
controller controller.updateAll();
.updateAll();
}); });
}); });
}, },
child: Container(
margin: EdgeInsets.only(
left: 40.rpx,
right: 35.rpx),
width: double.infinity,
height: 90.rpx,
decoration: BoxDecoration(),
child: Row( child: Row(
mainAxisSize: mainAxisSize:
MainAxisSize.max, MainAxisSize.max,
@@ -360,8 +353,8 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
style: TextStyle( style: TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
color: Color( color:
0xFF9EA4B7), Color(0xFF9EA4B7),
fontSize: 30.rpx, fontSize: 30.rpx,
letterSpacing: 0, letterSpacing: 0,
), ),
@@ -373,12 +366,17 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
Container( Container(
width: 200.rpx, width: 200.rpx,
child: Text( child: Text(
'${controller.model.peopleList[index]['gender'] == 1 ? '' : ''}', controller.model.peopleList[
index]
[
'gender'] ==
0
? ''
: '',
textAlign: textAlign:
TextAlign TextAlign
.right, .right,
style: style: TextStyle(
TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
color: Colors color: Colors
@@ -396,8 +394,7 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
Container( Container(
height: 30.rpx, height: 30.rpx,
width: 30.rpx, width: 30.rpx,
child: child: SvgPicture
SvgPicture
.asset( .asset(
'assets/img/icon/expand_more.svg', 'assets/img/icon/expand_more.svg',
color: Colors color: Colors
@@ -407,23 +404,16 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
), ),
], ],
), ),
)), ),
),
), ),
getLine(), getLine(),
Container( InkWell(
width: double.infinity,
height: 90.rpx,
margin: EdgeInsets.only(
left: 40.rpx,
right: 35.rpx),
decoration: BoxDecoration(),
child: InkWell(
onTap: () { onTap: () {
// Convert string height to int for initial value // Convert string height to int for initial value
final currentHeight = final currentHeight = controller
controller.model .model.peopleList[index]
.peopleList[ ['height'];
index]['height'];
final initialHeight = final initialHeight =
currentHeight != null currentHeight != null
? int.tryParse( ? int.tryParse(
@@ -433,31 +423,34 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
: 170; : 170;
FocusScope.of(context) FocusScope.of(context)
.requestFocus( .requestFocus(FocusNode());
FocusNode());
Future.delayed( Future.delayed(
const Duration( const Duration(
milliseconds: 250), milliseconds: 250), () {
() {
showHeightPickerDialog( showHeightPickerDialog(
context, context,
initialHeight: initialHeight:
initialHeight, initialHeight,
onConfirm: (int onConfirm:
selectedHeight) { (int selectedHeight) {
controller.model.peopleList[ controller.model.peopleList[
index] index]['height'] =
['height'] =
selectedHeight selectedHeight
.toString(); .toString();
controller controller.updateAll();
.updateAll();
print( print(
"身高: $selectedHeight cm"); "身高: $selectedHeight cm");
}, },
); );
}); });
}, },
child: Container(
width: double.infinity,
height: 90.rpx,
margin: EdgeInsets.only(
left: 40.rpx,
right: 35.rpx),
decoration: BoxDecoration(),
child: Row( child: Row(
mainAxisSize: mainAxisSize:
MainAxisSize.max, MainAxisSize.max,
@@ -486,6 +479,94 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
null null
? "${controller.model.peopleList[index]['height']} cm" ? "${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',
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( style: TextStyle(
fontFamily: fontFamily:
'Readex Pro', 'Readex Pro',
@@ -509,113 +590,11 @@ 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(), getLine(),
Obx( Obx(() => InkWell(
() => Container(
width: double.infinity,
height: 90.rpx,
margin: EdgeInsets.only(
left: 40.rpx,
right: 35.rpx),
decoration: BoxDecoration(),
child: InkWell(
onTap: () { onTap: () {
// 延迟执行的代码 // 延迟执行的代码
FocusScope.of(context) FocusScope.of(context)
@@ -623,44 +602,38 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
FocusNode()); FocusNode());
Future.delayed( Future.delayed(
const Duration( const Duration(
milliseconds: milliseconds: 250),
250), () { () {
showDateSelectionDialog( showDateSelectionDialog(
context, context,
checkDate: controller checkDate: controller
.model .model
.peopleList[index]['birthday'] .peopleList[index]
['birthday']
is DateTime is DateTime
? controller ? controller.model
.model
.peopleList[index] .peopleList[index]
['birthday'] ['birthday']
: DateTime.tryParse( : DateTime.tryParse(
controller.model.peopleList[index]['birthday'] ?? controller.model.peopleList[index]['birthday'] ??
'') ?? '') ??
DateTime.now(), DateTime.now(),
checkChange: checkChange: (DateTime d) {
(DateTime d) {
controller.model controller.model
.peopleList[ .peopleList[
index] index]
['birthday'] = d; ['birthday'] = d;
controller controller.updateAll();
.updateAll();
print("$d");
// final String dateStr =
// "${d.year}-${d.month.toString().padLeft(2, '0')}";
// controller.model.peopleList[
// index]
// ['birthday'] =
// dateStr;
// controller
// .updateAll();
// print(dateStr);
}); });
}); });
}, },
child: Container(
width: double.infinity,
height: 90.rpx,
margin: EdgeInsets.only(
left: 40.rpx,
right: 35.rpx),
decoration: BoxDecoration(),
child: Row( child: Row(
mainAxisSize: mainAxisSize:
MainAxisSize.max, MainAxisSize.max,
@@ -732,8 +705,8 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
), ),
], ],
), ),
)),
), ),
)),
getLine(), getLine(),
Container( Container(
width: double.infinity, width: double.infinity,