解绑设备
This commit is contained in:
@@ -3,40 +3,34 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
||||
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/NullDataComponentWidget.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/mh_controller/mhdevice_share_controller.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/EmptyMessageWidget.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/ShareUserWidget.dart';
|
||||
|
||||
class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
||||
var data;
|
||||
ShareDeviceWidget({super.key, required this.data});
|
||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
final ScrollController scrollController = ScrollController();
|
||||
|
||||
// ShareDeviceWidget() {
|
||||
// controller.initData();
|
||||
// scrollController.addListener(() {
|
||||
// if (scrollController.position.pixels ==
|
||||
// scrollController.position.maxScrollExtent &&
|
||||
// controller.model.hasMore) {
|
||||
// controller.initData();
|
||||
// controller.updateAll();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
final _phoneController = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var deviceController = Get.find<GlobalController>();
|
||||
controller.model.msg = "";
|
||||
controller.model.show = 0;
|
||||
controller.model.code = 0;
|
||||
controller.model.type = 1;
|
||||
controller.model.account = '';
|
||||
return GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Container(
|
||||
@@ -122,7 +116,7 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'设备ID:${deviceController.model.deviceMain['mac']}',
|
||||
'设备ID:${data['mac']}',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: const Color(0xFF6BFDAC),
|
||||
@@ -192,82 +186,12 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
||||
color: Colors.white,
|
||||
fontSize: 36.rpx,
|
||||
),
|
||||
validator: (value) {
|
||||
if (value == null ||
|
||||
value.isEmpty) {
|
||||
return '手机号不能为空';
|
||||
}
|
||||
final phoneReg =
|
||||
RegExp(r'^1[3-9]\d{9}$');
|
||||
if (!phoneReg.hasMatch(value)) {
|
||||
return '请输入正确的手机号';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
onChanged: (value) {
|
||||
controller.model.phone = value;
|
||||
controller.model.account =
|
||||
value;
|
||||
},
|
||||
),
|
||||
)
|
||||
// TextFormField(
|
||||
// // controller: _model.textController,
|
||||
// // focusNode: _model.textFieldFocusNode,
|
||||
// // autofocus: true,
|
||||
// obscureText: false,
|
||||
// decoration: InputDecoration(
|
||||
// hintText: '请输入对方手机号',
|
||||
// hintStyle: FlutterFlowTheme.of(
|
||||
// context)
|
||||
// .labelMedium
|
||||
// .override(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color:
|
||||
// const Color(0xFFD2D2D2),
|
||||
// fontSize: 13,
|
||||
// letterSpacing: 0.0,
|
||||
// ),
|
||||
// enabledBorder:
|
||||
// const UnderlineInputBorder(
|
||||
// borderSide: BorderSide(
|
||||
// color: Color(0xFFCCCCCC),
|
||||
// width: 1),
|
||||
// ),
|
||||
// focusedBorder:
|
||||
// const UnderlineInputBorder(
|
||||
// borderSide: BorderSide(
|
||||
// color: Color(0xFF929699),
|
||||
// width: 0),
|
||||
// ),
|
||||
// errorBorder:
|
||||
// const UnderlineInputBorder(
|
||||
// borderSide: BorderSide(
|
||||
// color: Colors.red, width: 1),
|
||||
// ),
|
||||
// focusedErrorBorder:
|
||||
// const UnderlineInputBorder(
|
||||
// borderSide: BorderSide(
|
||||
// color: Colors.redAccent,
|
||||
// width: 1.5),
|
||||
// ),
|
||||
// contentPadding:
|
||||
// const EdgeInsets.only(
|
||||
// left: 10, bottom: 5),
|
||||
// ),
|
||||
// style: FlutterFlowTheme.of(context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// fontSize: 13,
|
||||
// letterSpacing: 0.0,
|
||||
// ),
|
||||
// onChanged: (value) {
|
||||
// controller.model.phone = value;
|
||||
// },
|
||||
// // validator: _model.textControllerValidator
|
||||
// // .asValidator(context),
|
||||
// ),
|
||||
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
ClickableContainer(
|
||||
@@ -292,117 +216,6 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
||||
),
|
||||
),
|
||||
)),
|
||||
// Container(
|
||||
// width: MediaQuery.sizeOf(context).width,
|
||||
// constraints: const BoxConstraints(
|
||||
// minHeight: 46,
|
||||
// ),
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(0),
|
||||
// ),
|
||||
// child: Align(
|
||||
// alignment:
|
||||
// const AlignmentDirectional(0, 0),
|
||||
// child: Obx(() {
|
||||
// if (controller.model.show == 0) {
|
||||
// return Container();
|
||||
// } else {
|
||||
// return GestureDetector(
|
||||
// onTap: controller
|
||||
// .model.msg!.isNotEmpty
|
||||
// ? () {
|
||||
// Clipboard.setData(
|
||||
// ClipboardData(
|
||||
// text: CommonVariables
|
||||
// .shareText));
|
||||
// showToast(
|
||||
// "复制成功,粘贴分享APP下载链接!",
|
||||
// color: color_success);
|
||||
// }
|
||||
// : null, // 不可点击时设置为 null
|
||||
// child: RichText(
|
||||
// textAlign: TextAlign
|
||||
// .center, // 设置整个 RichText 内容居中
|
||||
// text: TextSpan(
|
||||
// children:
|
||||
// controller.model.msg!
|
||||
// .isNotEmpty
|
||||
// ? [
|
||||
// TextSpan(
|
||||
// text: controller
|
||||
// .model
|
||||
// .msg! +
|
||||
// "!", // 第一部分文本
|
||||
// style: FlutterFlowTheme.of(
|
||||
// context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily:
|
||||
// 'Readex Pro',
|
||||
// color: const Color(
|
||||
// 0xFFE55E92), // 设置为粉红色
|
||||
// fontSize:
|
||||
// 26.rpx,
|
||||
// letterSpacing:
|
||||
// 0.0,
|
||||
// ),
|
||||
// ),
|
||||
// const TextSpan(
|
||||
// text:
|
||||
// '\n', // 添加换行
|
||||
// ),
|
||||
// WidgetSpan(
|
||||
// child: SizedBox(
|
||||
// height: 20
|
||||
// .rpx), // 添加间距
|
||||
// ),
|
||||
// TextSpan(
|
||||
// text:
|
||||
// '点击复制APP下载链接', // 第二部分文本
|
||||
// style: FlutterFlowTheme.of(
|
||||
// context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily:
|
||||
// 'Readex Pro',
|
||||
// color: const Color(
|
||||
// 0xFF1890FF), // 设置为蓝色
|
||||
// fontSize:
|
||||
// 20.rpx,
|
||||
// letterSpacing:
|
||||
// 0.0,
|
||||
// decoration:
|
||||
// TextDecoration
|
||||
// .underline, // 添加下划线
|
||||
// ),
|
||||
// ),
|
||||
// ]
|
||||
// : [
|
||||
// TextSpan(
|
||||
// text:
|
||||
// '发送成功!', // 当 msg 为空时显示的文本
|
||||
// style: FlutterFlowTheme.of(
|
||||
// context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily:
|
||||
// 'Readex Pro',
|
||||
// color: const Color(
|
||||
// 0xFF07C160), // 设置为绿色
|
||||
// fontSize:
|
||||
// 20.rpx,
|
||||
// letterSpacing:
|
||||
// 0.0,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// })),
|
||||
// ),
|
||||
|
||||
Obx(
|
||||
() => GestureDetector(
|
||||
onTap: () {
|
||||
@@ -534,16 +347,19 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
||||
child: FFButtonWidget(
|
||||
onPressed: () async {
|
||||
//todo 1:验证用户是否存在 2:发送邀请
|
||||
// controller.model.show = 1;
|
||||
// String msg =
|
||||
// await controller.sendInvite(
|
||||
// controller.model.phone,
|
||||
// deviceController
|
||||
// .model.deviceMain['mac']);
|
||||
// if (msg != null && msg.isNotEmpty) {
|
||||
// controller.model.msg = msg;
|
||||
// }
|
||||
// controller.updateAll();
|
||||
ApiResponse apiResponse =
|
||||
await controller
|
||||
.shareDevice(data['mac']);
|
||||
if (apiResponse.code ==
|
||||
HttpStatusCodes.ok) {
|
||||
TopSlideNotification.show(context,
|
||||
text: apiResponse.msg!);
|
||||
} else {
|
||||
TopSlideNotification.show(context,
|
||||
text: apiResponse.msg!,
|
||||
textColor: themeController
|
||||
.currentColor.sc9);
|
||||
}
|
||||
},
|
||||
text: '发送邀请',
|
||||
options: FFButtonOptions(
|
||||
@@ -617,10 +433,11 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
||||
// .bodyMedium, // 可根据需要自定义样式
|
||||
// ),
|
||||
// );
|
||||
return EmptyMessageWidget(
|
||||
imagePath:
|
||||
"assets/images/emptyUser.png",
|
||||
);
|
||||
return NullDataWidget();
|
||||
// EmptyMessageWidget(
|
||||
// imagePath:
|
||||
// "assets/images/emptyUser.png",
|
||||
// );
|
||||
}
|
||||
|
||||
// 否则显示正常的 ListView
|
||||
|
||||
Reference in New Issue
Block a user