466 lines
20 KiB
Dart
466 lines
20 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:starwork_flutter/common/constant/app_colors.dart';
|
||
import 'package:starwork_flutter/common/widgets/custom_cell_list_widget.dart';
|
||
import 'package:starwork_flutter/common/widgets/custom_cell_widget.dart';
|
||
import 'package:starwork_flutter/common/widgets/custome_app_bar_wdiget.dart';
|
||
import 'package:starwork_flutter/extension/function_extension.dart';
|
||
import 'add_person_controller.dart';
|
||
|
||
class AddPersonView extends GetView<AddPersonController> {
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return Scaffold(
|
||
backgroundColor: AppColors.scaffoldBackgroundColor,
|
||
appBar: CustomAppBarWidget(
|
||
title: '添加人员'.tr,
|
||
backgroundColor: AppColors.scaffoldBackgroundColor,
|
||
),
|
||
body: SafeArea(
|
||
child: SingleChildScrollView(
|
||
child: Padding(
|
||
padding: EdgeInsets.only(
|
||
left: 10.w,
|
||
right: 10.w,
|
||
bottom: 10.h,
|
||
),
|
||
child: Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Text(
|
||
'基本信息'.tr,
|
||
style: TextStyle(
|
||
fontSize: 12.sp,
|
||
color: Colors.black54,
|
||
fontWeight: FontWeight.w400,
|
||
),
|
||
),
|
||
SizedBox(
|
||
height: 6.h,
|
||
),
|
||
CustomCellListWidget(
|
||
children: [
|
||
CustomCellWidget(
|
||
onTap: () {},
|
||
leftText: '组织'.tr,
|
||
leftIcon: Icon(
|
||
Icons.circle,
|
||
size: 4.w,
|
||
color: Colors.red,
|
||
),
|
||
rightWidget: Row(
|
||
crossAxisAlignment: CrossAxisAlignment.center,
|
||
children: [
|
||
Text(
|
||
'请选择',
|
||
style: TextStyle(
|
||
fontSize: 14.sp,
|
||
color: Colors.black54,
|
||
fontWeight: FontWeight.w400,
|
||
),
|
||
),
|
||
SizedBox(
|
||
width: 4.w,
|
||
),
|
||
Icon(
|
||
Icons.arrow_forward_ios_rounded,
|
||
size: 16.sp,
|
||
color: Colors.grey[300],
|
||
)
|
||
],
|
||
),
|
||
),
|
||
CustomCellWidget(
|
||
onTap: () {},
|
||
leftText: '姓名'.tr,
|
||
leftIcon: Icon(
|
||
Icons.circle,
|
||
size: 4.w,
|
||
color: Colors.red,
|
||
),
|
||
rightWidget: Expanded(
|
||
flex: 3,
|
||
child: TextField(
|
||
keyboardType: TextInputType.text,
|
||
textInputAction: TextInputAction.next,
|
||
textAlign: TextAlign.end,
|
||
style: TextStyle(
|
||
fontSize: 14.sp,
|
||
),
|
||
decoration: InputDecoration(
|
||
isCollapsed: true,
|
||
hintText: '请输入姓名'.tr,
|
||
hintStyle: TextStyle(
|
||
fontSize: 14.sp,
|
||
color: Colors.black54,
|
||
fontWeight: FontWeight.w400,
|
||
),
|
||
// 设置无边框
|
||
border: InputBorder.none,
|
||
contentPadding: EdgeInsets.zero,
|
||
// 获取焦点时的边框
|
||
focusedBorder: InputBorder.none,
|
||
enabledBorder: InputBorder.none,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
CustomCellWidget(
|
||
onTap: () {},
|
||
leftText: '开通账号'.tr,
|
||
leftSubText: '可登录并使用应用或管理功能',
|
||
leftIcon: Icon(
|
||
Icons.circle,
|
||
size: 4.w,
|
||
color: Colors.red,
|
||
),
|
||
rightWidget: CupertinoSwitch(
|
||
value: false,
|
||
onChanged: (bool value) {},
|
||
activeColor: Colors.blue, // 可选:打开时的颜色(iOS 默认为系统蓝色,可自定义)
|
||
trackColor: Colors.grey, // 可选:关闭时的背景轨道颜色
|
||
),
|
||
),
|
||
CustomCellWidget(
|
||
onTap: () {},
|
||
leftText: '分配权限'.tr,
|
||
leftIcon: Icon(
|
||
Icons.circle,
|
||
size: 4.w,
|
||
color: Colors.red,
|
||
),
|
||
rightWidget: Row(
|
||
crossAxisAlignment: CrossAxisAlignment.center,
|
||
children: [
|
||
Text(
|
||
'企业员工',
|
||
style: TextStyle(
|
||
fontSize: 14.sp,
|
||
color: Colors.black54,
|
||
fontWeight: FontWeight.w400,
|
||
),
|
||
),
|
||
SizedBox(
|
||
width: 4.w,
|
||
),
|
||
Icon(
|
||
Icons.arrow_forward_ios_rounded,
|
||
size: 16.sp,
|
||
color: Colors.grey[300],
|
||
)
|
||
],
|
||
),
|
||
)
|
||
],
|
||
),
|
||
SizedBox(
|
||
height: 10.h,
|
||
),
|
||
Text(
|
||
'扩展信息'.tr,
|
||
style: TextStyle(
|
||
fontSize: 12.sp,
|
||
color: Colors.black54,
|
||
fontWeight: FontWeight.w400,
|
||
),
|
||
),
|
||
SizedBox(
|
||
height: 10.h,
|
||
),
|
||
CustomCellListWidget(
|
||
children: [
|
||
CustomCellWidget(
|
||
onTap: () {},
|
||
leftText: '工号'.tr,
|
||
rightWidget: Expanded(
|
||
flex: 3,
|
||
child: TextField(
|
||
keyboardType: TextInputType.text,
|
||
textInputAction: TextInputAction.next,
|
||
textAlign: TextAlign.end,
|
||
style: TextStyle(
|
||
fontSize: 14.sp,
|
||
),
|
||
decoration: InputDecoration(
|
||
isCollapsed: true,
|
||
hintText: '选填'.tr,
|
||
hintStyle: TextStyle(
|
||
fontSize: 14.sp,
|
||
color: Colors.black54,
|
||
fontWeight: FontWeight.w400,
|
||
),
|
||
// 设置无边框
|
||
border: InputBorder.none,
|
||
contentPadding: EdgeInsets.zero,
|
||
// 获取焦点时的边框
|
||
focusedBorder: InputBorder.none,
|
||
enabledBorder: InputBorder.none,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
CustomCellWidget(
|
||
onTap: () {},
|
||
leftText: '性别'.tr,
|
||
rightWidget: Obx(
|
||
() => Row(
|
||
children: [
|
||
Radio<String>(
|
||
value: 'male',
|
||
activeColor: Colors.blue,
|
||
groupValue: controller.selectedGender.value,
|
||
visualDensity: VisualDensity.compact,
|
||
onChanged: (value) {
|
||
controller.selectedGender.value = value!;
|
||
},
|
||
),
|
||
Text('男'),
|
||
Radio<String>(
|
||
value: 'female',
|
||
activeColor: Colors.blue,
|
||
groupValue: controller.selectedGender.value,
|
||
visualDensity: VisualDensity.compact,
|
||
onChanged: (value) {
|
||
controller.selectedGender.value = value!;
|
||
},
|
||
),
|
||
Text('女'),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
CustomCellWidget(
|
||
onTap: () {},
|
||
leftText: '有效期'.tr,
|
||
rightWidget: Row(
|
||
crossAxisAlignment: CrossAxisAlignment.center,
|
||
children: [
|
||
Text(
|
||
'请选择',
|
||
style: TextStyle(
|
||
fontSize: 14.sp,
|
||
color: Colors.black54,
|
||
fontWeight: FontWeight.w400,
|
||
),
|
||
),
|
||
SizedBox(
|
||
width: 4.w,
|
||
),
|
||
Icon(
|
||
Icons.arrow_forward_ios_rounded,
|
||
size: 16.sp,
|
||
color: Colors.grey[300],
|
||
)
|
||
],
|
||
),
|
||
),
|
||
CustomCellWidget(
|
||
onTap: () {},
|
||
leftText: '职务'.tr,
|
||
rightWidget: Expanded(
|
||
flex: 3,
|
||
child: TextField(
|
||
keyboardType: TextInputType.text,
|
||
textInputAction: TextInputAction.next,
|
||
textAlign: TextAlign.end,
|
||
style: TextStyle(
|
||
fontSize: 14.sp,
|
||
),
|
||
decoration: InputDecoration(
|
||
isCollapsed: true,
|
||
hintText: '选填'.tr,
|
||
hintStyle: TextStyle(
|
||
fontSize: 14.sp,
|
||
color: Colors.black54,
|
||
fontWeight: FontWeight.w400,
|
||
),
|
||
// 设置无边框
|
||
border: InputBorder.none,
|
||
contentPadding: EdgeInsets.zero,
|
||
// 获取焦点时的边框
|
||
focusedBorder: InputBorder.none,
|
||
enabledBorder: InputBorder.none,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
CustomCellWidget(
|
||
onTap: () {},
|
||
leftText: '备注'.tr,
|
||
rightWidget: Expanded(
|
||
flex: 3,
|
||
child: TextField(
|
||
keyboardType: TextInputType.text,
|
||
textInputAction: TextInputAction.next,
|
||
textAlign: TextAlign.end,
|
||
style: TextStyle(
|
||
fontSize: 14.sp,
|
||
),
|
||
decoration: InputDecoration(
|
||
isCollapsed: true,
|
||
hintText: '选填'.tr,
|
||
hintStyle: TextStyle(
|
||
fontSize: 14.sp,
|
||
color: Colors.black54,
|
||
fontWeight: FontWeight.w400,
|
||
),
|
||
// 设置无边框
|
||
border: InputBorder.none,
|
||
contentPadding: EdgeInsets.zero,
|
||
// 获取焦点时的边框
|
||
focusedBorder: InputBorder.none,
|
||
enabledBorder: InputBorder.none,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
CustomCellWidget(
|
||
onTap: () {},
|
||
leftText: '身份证号码'.tr,
|
||
rightWidget: Expanded(
|
||
flex: 3,
|
||
child: TextField(
|
||
keyboardType: TextInputType.text,
|
||
textInputAction: TextInputAction.next,
|
||
textAlign: TextAlign.end,
|
||
style: TextStyle(
|
||
fontSize: 14.sp,
|
||
),
|
||
decoration: InputDecoration(
|
||
isCollapsed: true,
|
||
hintText: '选填'.tr,
|
||
hintStyle: TextStyle(
|
||
fontSize: 14.sp,
|
||
color: Colors.black54,
|
||
fontWeight: FontWeight.w400,
|
||
),
|
||
// 设置无边框
|
||
border: InputBorder.none,
|
||
contentPadding: EdgeInsets.zero,
|
||
// 获取焦点时的边框
|
||
focusedBorder: InputBorder.none,
|
||
enabledBorder: InputBorder.none,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
SizedBox(
|
||
height: 10.h,
|
||
),
|
||
SizedBox(
|
||
width: double.infinity,
|
||
child: Text(
|
||
textAlign: TextAlign.center,
|
||
'温馨提示:人脸/指纹/卡片信息需先保存后录入',
|
||
style: TextStyle(
|
||
fontSize: 12.sp,
|
||
color: Colors.grey,
|
||
fontWeight: FontWeight.w400,
|
||
),
|
||
),
|
||
),
|
||
SizedBox(
|
||
height: 10.h,
|
||
),
|
||
CustomCellListWidget(
|
||
children: [
|
||
CustomCellWidget(
|
||
onTap: () {
|
||
controller.showFunctionNotOpen();
|
||
},
|
||
leftText: '其他添加方式'.tr,
|
||
rightWidget: Icon(
|
||
Icons.arrow_forward_ios_rounded,
|
||
size: 16.sp,
|
||
color: Colors.grey,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
],
|
||
),
|
||
Column(
|
||
children: [
|
||
Row(
|
||
children: [
|
||
Checkbox(
|
||
value: true,
|
||
// 转换为 bool
|
||
onChanged: (bool? value) {},
|
||
),
|
||
Text(
|
||
'向用户发送短信邀请通知',
|
||
style: TextStyle(
|
||
fontSize: 12.sp,
|
||
color: Colors.grey,
|
||
fontWeight: FontWeight.w400,
|
||
),
|
||
)
|
||
],
|
||
),
|
||
SizedBox(
|
||
width: double.infinity,
|
||
child: Row(
|
||
children: [
|
||
Expanded(
|
||
child: ElevatedButton(
|
||
onPressed: () {}.debounce(),
|
||
style: ElevatedButton.styleFrom(
|
||
backgroundColor: Colors.grey[100],
|
||
padding: EdgeInsets.symmetric(vertical: 12.h),
|
||
shape: RoundedRectangleBorder(
|
||
borderRadius: BorderRadius.circular(8.r),
|
||
),
|
||
),
|
||
child: Text(
|
||
'保存'.tr,
|
||
style: TextStyle(
|
||
fontSize: 16.sp,
|
||
color: Colors.blue,
|
||
fontWeight: FontWeight.w500,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
SizedBox(
|
||
width: 10.w,
|
||
),
|
||
Expanded(
|
||
child: ElevatedButton(
|
||
onPressed: () {}.debounce(),
|
||
style: ElevatedButton.styleFrom(
|
||
backgroundColor: Colors.blue,
|
||
padding: EdgeInsets.symmetric(vertical: 12.h),
|
||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.r)),
|
||
),
|
||
child: Text(
|
||
'保存并继续添加'.tr,
|
||
style: TextStyle(
|
||
fontSize: 16.sp,
|
||
color: Colors.white,
|
||
fontWeight: FontWeight.w500,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
],
|
||
)
|
||
],
|
||
),
|
||
),
|
||
),
|
||
),
|
||
);
|
||
}
|
||
}
|