168 lines
5.4 KiB
Dart
168 lines
5.4 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:star_lock/appRouters.dart';
|
|
import 'package:star_lock/main/lockDetail/lockSet/familyDetails/familyDetails_logic.dart';
|
|
import 'package:star_lock/tools/commonItem.dart';
|
|
import 'package:star_lock/tools/showTFView.dart';
|
|
import 'package:star_lock/tools/submitBtn.dart';
|
|
import 'package:star_lock/translations/trans_lib.dart';
|
|
|
|
import '../../../../../app_settings/app_colors.dart';
|
|
import '../../../../../tools/titleAppBar.dart';
|
|
|
|
class FamilyDetailsPage extends StatefulWidget {
|
|
const FamilyDetailsPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<FamilyDetailsPage> createState() => _FamilyDetailsPageState();
|
|
}
|
|
|
|
class _FamilyDetailsPageState extends State<FamilyDetailsPage> {
|
|
final logic = Get.put(FamilyDetailsLogic());
|
|
final state = Get.find<FamilyDetailsLogic>().state;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: AppColors.mainBackgroundColor,
|
|
appBar: TitleAppBar(
|
|
barTitle: '家人详情',
|
|
haveBack: true,
|
|
backgroundColor: AppColors.mainColor),
|
|
body: Container(
|
|
padding: EdgeInsets.all(30.w),
|
|
child: Column(
|
|
children: [
|
|
CommonItem(
|
|
leftTitel: '开门方式',
|
|
rightTitle: '电子钥匙',
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
//锁用户
|
|
Get.toNamed(Routers.lockUserPage);
|
|
}),
|
|
Obx(() => CommonItem(
|
|
leftTitel: '家人',
|
|
rightTitle: state.familyName.value,
|
|
isHaveLine: true,
|
|
isHaveRightWidget: false,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
state.changeNameController.text = state.familyName.value;
|
|
_showEditNameAlert(context);
|
|
},
|
|
)),
|
|
SizedBox(
|
|
height: 20.h,
|
|
),
|
|
Container(
|
|
color: Colors.white,
|
|
margin: EdgeInsets.only(bottom: 10.h),
|
|
child: Column(
|
|
children: [
|
|
CommonItem(
|
|
leftTitel: '提醒方式',
|
|
rightTitle: "",
|
|
isHaveLine: false,
|
|
isHaveRightWidget: false,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Get.toNamed(Routers.notificationModePage);
|
|
},
|
|
),
|
|
Container(
|
|
padding: EdgeInsets.only(
|
|
left: 10.w, right: 10.w, top: 12.h, bottom: 12.h),
|
|
margin: EdgeInsets.only(bottom: 20.h, top: 10.h),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.mainBackgroundColor,
|
|
borderRadius: BorderRadius.circular(6.0.w),
|
|
),
|
|
child: Text(
|
|
'APP推送 管理员',
|
|
style: TextStyle(color: Colors.black, fontSize: 20.sp),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Expanded(
|
|
child: SizedBox(
|
|
height: 40.h,
|
|
)),
|
|
SubmitBtn(
|
|
btnName: '删除',
|
|
isDelete: true,
|
|
onClick: () {
|
|
_showDialog(context);
|
|
},
|
|
),
|
|
SizedBox(
|
|
height: 60.h,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
//确认弹窗
|
|
void _showDialog(widgetContext) {
|
|
showCupertinoDialog(
|
|
context: widgetContext,
|
|
builder: (context) {
|
|
return CupertinoAlertDialog(
|
|
title: Text(
|
|
'是否删除家人',
|
|
style: TextStyle(color: Colors.black, fontSize: 24.sp),
|
|
),
|
|
content: Text('删除家人后,你将不会收到他到家的消息。',
|
|
style: TextStyle(
|
|
color: AppColors.darkGrayTextColor, fontSize: 22.sp)),
|
|
actions: [
|
|
CupertinoDialogAction(
|
|
child: Text(
|
|
'取消',
|
|
style: TextStyle(color: AppColors.mainColor),
|
|
),
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
),
|
|
CupertinoDialogAction(
|
|
child: Text('删除', style: TextStyle(color: AppColors.mainColor)),
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
void _showEditNameAlert(BuildContext context) {
|
|
showDialog(
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
return ShowTFView(
|
|
title:
|
|
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
|
|
tipTitle: "请输入",
|
|
controller: state.changeNameController,
|
|
sureClick: () {
|
|
Navigator.pop(context);
|
|
state.familyName.value = state.changeNameController.text;
|
|
},
|
|
cancelClick: () {
|
|
Navigator.pop(context);
|
|
},
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|