diff --git a/lib/pages/device_bind/device_share_page.dart b/lib/pages/device_bind/device_share_page.dart index 545900e..f785d98 100644 --- a/lib/pages/device_bind/device_share_page.dart +++ b/lib/pages/device_bind/device_share_page.dart @@ -318,6 +318,7 @@ class _DeviceSharePageState extends State { text: apiResponse.msg!, textColor: themeController.currentColor.sc9); } + }, colors: [ // 渐变色 @@ -350,56 +351,6 @@ class _DeviceSharePageState extends State { ), ), ), - - // 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)), - // ), - // ), - // ), - // ), ], ), ), diff --git a/lib/pages/mh_page/device_share_page.dart b/lib/pages/mh_page/device_share_page.dart index 6136d13..591804c 100644 --- a/lib/pages/mh_page/device_share_page.dart +++ b/lib/pages/mh_page/device_share_page.dart @@ -22,12 +22,17 @@ class ShareDeviceWidget extends GetView { final _formKey = GlobalKey(); final _phoneController = TextEditingController(); + fetchData() async { + await controller.shareDeviceList(data["mac"]); + } + @override Widget build(BuildContext context) { controller.model.msg = ""; controller.model.code = 0; controller.model.type = 1; controller.model.account = ''; + fetchData(); return GestureDetector( // onTap: () => FocusScope.of(context).unfocus(),, child: Container( @@ -278,135 +283,6 @@ class ShareDeviceWidget extends GetView { ), ), ), - - // 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( - // // 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( onTap: () { controller.model.type = 2; @@ -476,7 +352,6 @@ class ShareDeviceWidget extends GetView { ), ), ), - Align( alignment: const AlignmentDirectional(0, 0), child: Padding( diff --git a/lib/pages/mh_page/people_info.dart b/lib/pages/mh_page/people_info.dart index dc640fc..b9bd9aa 100644 --- a/lib/pages/mh_page/people_info.dart +++ b/lib/pages/mh_page/people_info.dart @@ -309,155 +309,38 @@ class PeopleInfoPage extends GetView { ), 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 { .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 { 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 { ), ], ), - )), - 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 { ), ], ), - )), - ), + ), + )), getLine(), Container( width: double.infinity,