130 lines
4.0 KiB
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/tools/commonItem.dart';
import 'package:star_lock/tools/submitBtn.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/titleAppBar.dart';
class AddFamilyPage extends StatefulWidget {
const AddFamilyPage({Key? key}) : super(key: key);
@override
State<AddFamilyPage> createState() => _AddFamilyPageState();
}
class _AddFamilyPageState extends State<AddFamilyPage> {
@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);
}),
CommonItem(
leftTitel: '家人',
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
isHaveDirection: false,
rightWidget: getFamilyWidget('请输入'),
),
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: '保存',
isDisabled: false,
onClick: () {},
),
SizedBox(
height: 60.h,
)
],
),
),
);
}
// 接受者邮箱输入框
Widget getFamilyWidget(String tfStr) {
TextEditingController emailController = TextEditingController();
return SizedBox(
height: 50.h,
width: 360.w,
child: Row(
children: [
Expanded(
child: TextField(
controller: emailController,
//输入框一行
maxLines: 1,
autofocus: false,
textAlign: TextAlign.end,
decoration: InputDecoration(
//输入里面输入文字内边距设置
contentPadding: const EdgeInsets.only(top: -12.0, bottom: 0.0),
hintText: tfStr,
hintStyle: TextStyle(fontSize: 22.sp),
//不需要输入框下划线
border: InputBorder.none,
),
),
),
],
),
);
}
}