345 lines
18 KiB
Dart
345 lines
18 KiB
Dart
import 'package:ef/ef.dart';
|
||
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/appFontsize.dart';
|
||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||
import 'package:vbvs_app/pages/common/selectDialog.dart';
|
||
import 'package:vbvs_app/pages/mh_page/user/controller/mht_login_controller.dart';
|
||
|
||
class LogoutPage extends GetView {
|
||
BoxConstraints? bodysize;
|
||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return LayoutBuilder(builder: (context, cc) {
|
||
bodysize = cc;
|
||
|
||
return GestureDetector(
|
||
// onTap: () => FocusScope.of(context).unfocus(),,
|
||
child: Container(
|
||
decoration: BoxDecoration(
|
||
image: DecorationImage(
|
||
image: AssetImage(getBackgroundImageNoImage()), // 本地图片
|
||
fit: BoxFit.fill, // 填满整个 Container
|
||
),
|
||
),
|
||
child: Scaffold(
|
||
appBar: AppBar(
|
||
backgroundColor: themeController.currentColor.sc17,
|
||
automaticallyImplyLeading: false,
|
||
iconTheme: const IconThemeData(color: Colors.white),
|
||
titleSpacing: 0,
|
||
title: SizedBox(
|
||
width: double.infinity,
|
||
height: 180.rpx,
|
||
child: Stack(
|
||
alignment: Alignment.center,
|
||
children: [
|
||
// 中间居中的标题
|
||
Text(
|
||
'注销账号'.tr,
|
||
textAlign: TextAlign.center,
|
||
style: TextStyle(
|
||
color: Colors.white,
|
||
fontSize: 30.rpx,
|
||
),
|
||
),
|
||
// 左侧图标
|
||
Positioned(
|
||
left: 0.rpx,
|
||
child: returnIconButtom,
|
||
),
|
||
],
|
||
),
|
||
),
|
||
centerTitle: false,
|
||
),
|
||
key: scaffoldKey,
|
||
backgroundColor: Colors.transparent,
|
||
body: Container(
|
||
width: bodysize!.maxWidth,
|
||
height: bodysize!.maxHeight * 1,
|
||
decoration: const BoxDecoration(),
|
||
child: Column(
|
||
mainAxisSize: MainAxisSize.max,
|
||
children: [
|
||
Expanded(
|
||
child: Container(
|
||
width: MediaQuery.sizeOf(context).width,
|
||
height: 100,
|
||
child: SingleChildScrollView(
|
||
child: Column(
|
||
mainAxisSize: MainAxisSize.max,
|
||
children: [
|
||
Padding(
|
||
padding: const EdgeInsetsDirectional.fromSTEB(
|
||
0, 33, 0, 0),
|
||
child: Container(
|
||
width: MediaQuery.sizeOf(context).width,
|
||
decoration: BoxDecoration(
|
||
borderRadius: BorderRadius.circular(12),
|
||
),
|
||
child: Padding(
|
||
padding: EdgeInsetsDirectional.fromSTEB(
|
||
38.rpx, 0, 39.rpx, 0),
|
||
child: Container(
|
||
width: MediaQuery.sizeOf(context).width,
|
||
child: SingleChildScrollView(
|
||
child: Column(
|
||
mainAxisSize: MainAxisSize.max,
|
||
mainAxisAlignment:
|
||
MainAxisAlignment.spaceBetween,
|
||
crossAxisAlignment:
|
||
CrossAxisAlignment.center,
|
||
children: [
|
||
Container(
|
||
width: 50,
|
||
height: 50,
|
||
child: Image.asset(
|
||
'assets/images/delete_account.png',
|
||
fit: BoxFit.cover,
|
||
color: themeController
|
||
.currentColor.sc3,
|
||
),
|
||
),
|
||
Text(
|
||
"申请注销账号".tr,
|
||
style: TextStyle(
|
||
fontSize: 20, // 设置字体大小
|
||
color: Color(0xFFFFFFFF),
|
||
// decoration: TextDecoration.underline, // 添加下划线
|
||
),
|
||
),
|
||
Container(
|
||
child: Column(
|
||
mainAxisAlignment:
|
||
MainAxisAlignment.spaceBetween,
|
||
crossAxisAlignment:
|
||
CrossAxisAlignment.start,
|
||
children: [
|
||
RichText(
|
||
text: TextSpan(
|
||
text: "注意!账号注销后,你将无法使用以下功能,".tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.normal_text_size, // 设置字体大小
|
||
color: themeController
|
||
.currentColor
|
||
.sc3 // 默认颜色
|
||
),
|
||
children: [
|
||
TextSpan(
|
||
text:
|
||
"并且当前有绑定体征监测设备、智能床/床垫、AI摄像头等设备的账号不能注销,"
|
||
.tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.normal_text_size,
|
||
color: themeController
|
||
.currentColor
|
||
.sc14 // 设置为#E45E91的颜色
|
||
),
|
||
),
|
||
TextSpan(
|
||
text: "可先进行解绑后再进行注销操作。".tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.normal_text_size,
|
||
color: themeController
|
||
.currentColor.sc3),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
const SizedBox(
|
||
height: 24,
|
||
),
|
||
Text(
|
||
"无法查询睡眠报告".tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.title_size, // 设置字体大小
|
||
color: themeController
|
||
.currentColor.sc14),
|
||
),
|
||
const SizedBox(
|
||
height: 6,
|
||
),
|
||
Text(
|
||
"注销账号后你将无法查看体征消息,您以前的睡报告等数据记录也将被清空。"
|
||
.tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.normal_text_size, // 设置字体大小
|
||
color: themeController
|
||
.currentColor.sc3),
|
||
),
|
||
const SizedBox(
|
||
height: 24,
|
||
),
|
||
Text(
|
||
"无法控制智能设备".tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.title_size, // 设置字体大小
|
||
color: themeController
|
||
.currentColor.sc14),
|
||
),
|
||
const SizedBox(
|
||
height: 6,
|
||
),
|
||
RichText(
|
||
text: TextSpan(
|
||
text: "你将无法控制你的".tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.normal_text_size, // 设置字体大小
|
||
color: themeController
|
||
.currentColor
|
||
.sc3 // 默认颜色
|
||
),
|
||
children: [
|
||
TextSpan(
|
||
text: "体征监测设备、智能床/床垫、AI摄像头"
|
||
.tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.normal_text_size,
|
||
color: themeController
|
||
.currentColor
|
||
.sc14 // 设置为#E45E91的颜色
|
||
),
|
||
),
|
||
TextSpan(
|
||
text: "等设备,以及与其相关的各种操作。".tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.normal_text_size,
|
||
color: themeController
|
||
.currentColor.sc3),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
const SizedBox(
|
||
height: 24,
|
||
),
|
||
Text(
|
||
"无法使用的其他功能".tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.title_size, // 设置字体大小
|
||
color: themeController
|
||
.currentColor.sc14,
|
||
),
|
||
),
|
||
const SizedBox(
|
||
height: 6,
|
||
),
|
||
Text(
|
||
"包含设备报修记录、AI大模型分析记录等".tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.normal_text_size, // 设置字体大小
|
||
color: themeController
|
||
.currentColor.sc3),
|
||
),
|
||
],
|
||
)),
|
||
]
|
||
.divide(const SizedBox(height: 24))
|
||
.addToStart(
|
||
const SizedBox(height: 14))
|
||
.addToEnd(const SizedBox(height: 17)),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
),
|
||
Padding(
|
||
padding: EdgeInsetsDirectional.fromSTEB(
|
||
100.rpx, 0, 100.rpx, 60.rpx),
|
||
child: Container(
|
||
width: bodysize!.maxWidth,
|
||
height: bodysize!.maxHeight * 0.056,
|
||
child: Container(
|
||
width: bodysize!.maxWidth,
|
||
height: bodysize!.maxHeight * 0.056,
|
||
decoration: BoxDecoration(
|
||
borderRadius: BorderRadius.circular(12),
|
||
),
|
||
child: FFButtonWidget(
|
||
onPressed: () async {
|
||
showCustomConfirmDialogTH(context, "是否确认注销?".tr)
|
||
.then((v) async {
|
||
if (v != "confirm") {
|
||
return;
|
||
}
|
||
MHTLoginController loginController = Get.find();
|
||
UserInfoController userInfoController =
|
||
Get.find<UserInfoController>();
|
||
int code = await loginController.deletedAccount();
|
||
if (code == 1) {
|
||
userInfoController.logOut();
|
||
Get.offAllNamed("/mianPageBottomChange");
|
||
TopSlideNotification.show(context,
|
||
text: "注销账号成功".tr,
|
||
textColor: themeController.currentColor.sc2);
|
||
} else {
|
||
TopSlideNotification.show(context,
|
||
text: "注销账号失败".tr,
|
||
textColor: themeController.currentColor.sc9);
|
||
}
|
||
});
|
||
},
|
||
text: '已知晓,确定注销'.tr,
|
||
options: FFButtonOptions(
|
||
height: 40,
|
||
padding: const EdgeInsetsDirectional.fromSTEB(
|
||
24, 0, 24, 0),
|
||
iconPadding:
|
||
const EdgeInsetsDirectional.fromSTEB(0, 0, 0, 0),
|
||
color: themeController.currentColor.sc14,
|
||
textStyle: TextStyle(
|
||
fontFamily: 'Readex Pro',
|
||
color: themeController.currentColor.sc3,
|
||
fontSize: AppFontsize.normal_text_size,
|
||
letterSpacing: 0,
|
||
),
|
||
elevation: 0,
|
||
borderSide: const BorderSide(
|
||
color: Colors.transparent,
|
||
width: 1,
|
||
),
|
||
borderRadius: BorderRadius.circular(
|
||
AppConstants().button_container_radius),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
));
|
||
});
|
||
}
|
||
|
||
Future<void> _copyToClipboard(String text) async {
|
||
await Clipboard.setData(ClipboardData(text: text));
|
||
}
|
||
}
|