330 lines
17 KiB
Dart
330 lines
17 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:get_storage/get_storage.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/login/login_controller.dart';
|
||
import 'package:vbvs_app/controller/main_bottom/global_controller.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 DeletedAccountPage 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: const BoxDecoration(
|
||
image: DecorationImage(
|
||
image: AssetImage('assets/images/new_background.png'), // 本地图片
|
||
fit: BoxFit.fill, // 填满整个 Container
|
||
),
|
||
),
|
||
child: Scaffold(
|
||
appBar: AppBar(
|
||
systemOverlayStyle: SystemUiOverlayStyle(
|
||
statusBarColor: Colors.transparent, // 状态栏背景色
|
||
statusBarIconBrightness: Brightness.light, // 图标颜色(Android)
|
||
statusBarBrightness: Brightness.light, // 图标颜色(iOS)
|
||
),
|
||
backgroundColor: Colors.transparent,
|
||
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: returnIconButtomNew(),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
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(
|
||
15, 33, 15, 0),
|
||
child: Container(
|
||
width: MediaQuery.sizeOf(context).width,
|
||
decoration: BoxDecoration(
|
||
borderRadius: BorderRadius.circular(12),
|
||
),
|
||
child: Padding(
|
||
padding: const EdgeInsetsDirectional.fromSTEB(
|
||
21, 0, 22, 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: Color(0XFF84F5FF),
|
||
),
|
||
),
|
||
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:
|
||
Color(0xFF9AA0B3), // 默认颜色
|
||
),
|
||
children: [
|
||
TextSpan(
|
||
text:
|
||
"并且当前有绑定以及被分享的智能床、智能床垫等设备的账号不能注销"
|
||
.tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.normal_text_size,
|
||
color: const Color(
|
||
0xFFFF7159), // 设置为#E45E91的颜色
|
||
),
|
||
),
|
||
TextSpan(
|
||
text: ",可先进行解绑后再进行注销操作。".tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.normal_text_size,
|
||
color: Color(0xFF9AA0B3),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
const SizedBox(
|
||
height: 24,
|
||
),
|
||
Text(
|
||
"无法控制智能床、智能床垫等设备".tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.title_size, // 设置字体大小
|
||
color: const Color(0xFFFFFFFF),
|
||
),
|
||
),
|
||
const SizedBox(
|
||
height: 6,
|
||
),
|
||
Text(
|
||
"你将无法控制你的智能床、智能床垫等设备,以及与其相关的各种操作。"
|
||
.tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.normal_text_size, // 设置字体大小
|
||
color: Color(0xFF9AA0B3),
|
||
),
|
||
),
|
||
const SizedBox(
|
||
height: 24,
|
||
),
|
||
Text(
|
||
"无法查询睡眠报告和体征数据".tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.title_size, // 设置字体大小
|
||
color: const Color(0xFFFFFFFF),
|
||
),
|
||
),
|
||
const SizedBox(
|
||
height: 6,
|
||
),
|
||
Text(
|
||
"注销账号后你将查询不到你以前的睡眠报告和实时数据。".tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.normal_text_size, // 设置字体大小
|
||
color: Color(0xFF9AA0B3),
|
||
),
|
||
),
|
||
const SizedBox(
|
||
height: 24,
|
||
),
|
||
Text(
|
||
"无法使用的其他功能".tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.title_size, // 设置字体大小
|
||
color: const Color(0xFFFFFFFF),
|
||
),
|
||
),
|
||
const SizedBox(
|
||
height: 6,
|
||
),
|
||
Text(
|
||
"包含设备报修、门店体验预约等。".tr,
|
||
style: TextStyle(
|
||
fontSize: AppFontsize
|
||
.normal_text_size, // 设置字体大小
|
||
color: Color(0xFF9AA0B3),
|
||
),
|
||
),
|
||
],
|
||
)),
|
||
]
|
||
.divide(const SizedBox(height: 24))
|
||
.addToStart(
|
||
const SizedBox(height: 14))
|
||
.addToEnd(const SizedBox(height: 17)),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
),
|
||
Padding(
|
||
padding: EdgeInsetsDirectional.fromSTEB(
|
||
15, 0, 15, AppConstants.page_button_bottom_padding),
|
||
child: Container(
|
||
width: bodysize!.maxWidth,
|
||
height: bodysize!.maxHeight * 0.056,
|
||
// decoration: BoxDecoration(
|
||
// color:
|
||
// FlutterFlowTheme.of(context).secondaryBackground,
|
||
// ),
|
||
child: Container(
|
||
width: bodysize!.maxWidth,
|
||
height: bodysize!.maxHeight * 0.056,
|
||
decoration: BoxDecoration(
|
||
// color: FlutterFlowTheme.of(context)
|
||
// .secondaryBackground,
|
||
borderRadius: BorderRadius.circular(12),
|
||
),
|
||
child: FFButtonWidget(
|
||
onPressed: () async {
|
||
showCustomConfirmDialog(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: const Color(0xFFFF7159),
|
||
textStyle: TextStyle(
|
||
fontFamily: 'Readex Pro',
|
||
color: Colors.white,
|
||
fontSize: AppFontsize.normal_text_size,
|
||
letterSpacing: 0,
|
||
),
|
||
elevation: 0,
|
||
borderSide: const BorderSide(
|
||
color: Colors.transparent,
|
||
width: 1,
|
||
),
|
||
borderRadius: BorderRadius.circular(8),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
));
|
||
});
|
||
}
|
||
|
||
Future<void> _copyToClipboard(String text) async {
|
||
await Clipboard.setData(ClipboardData(text: text));
|
||
}
|
||
}
|