376 lines
16 KiB
Dart
376 lines
16 KiB
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/constant/app_images.dart';
|
||
import 'package:starwork_flutter/common/widgets/custome_app_bar_wdiget.dart';
|
||
import 'package:starwork_flutter/extension/function_extension.dart';
|
||
import 'enter_face_controller.dart';
|
||
|
||
class EnterFaceView extends GetView<EnterFaceController> {
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
// 即使不使用,只是引用一下 controller 就能触发初始化
|
||
final _ = controller; // 添加这一行
|
||
|
||
return Scaffold(
|
||
appBar: CustomAppBarWidget(
|
||
title: '人脸信息'.tr,
|
||
backgroundColor: AppColors.scaffoldBackgroundColor,
|
||
),
|
||
backgroundColor: AppColors.scaffoldBackgroundColor,
|
||
body: Container(
|
||
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 10.h),
|
||
child: SingleChildScrollView(
|
||
child: Column(
|
||
children: [
|
||
Container(
|
||
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 10.h),
|
||
decoration: BoxDecoration(
|
||
color: Colors.white,
|
||
borderRadius: BorderRadius.circular(8.r),
|
||
),
|
||
child: Row(
|
||
children: [
|
||
Container(
|
||
width: 34.w,
|
||
height: 34.w,
|
||
margin: EdgeInsets.only(right: 10.w),
|
||
decoration: BoxDecoration(
|
||
color: Colors.grey[200],
|
||
borderRadius: BorderRadius.circular(8.r),
|
||
),
|
||
child: ClipRRect(
|
||
borderRadius: BorderRadius.circular(8.r),
|
||
child: Image(
|
||
image: const AssetImage(AppImages.defaultAvatar),
|
||
width: 22.w,
|
||
height: 22.w,
|
||
fit: BoxFit.cover,
|
||
gaplessPlayback: true,
|
||
filterQuality: FilterQuality.medium,
|
||
errorBuilder: (context, error, stackTrace) {
|
||
return Icon(
|
||
Icons.person,
|
||
size: 30.sp,
|
||
color: Colors.grey[400],
|
||
);
|
||
},
|
||
),
|
||
),
|
||
),
|
||
Text(controller.selectedPersonItem.value?.personName ?? ''),
|
||
const Spacer(),
|
||
Text(
|
||
'未录入'.tr,
|
||
style: TextStyle(
|
||
color: Colors.orange,
|
||
fontSize: 16.sp,
|
||
),
|
||
)
|
||
],
|
||
),
|
||
),
|
||
SizedBox(
|
||
height: 10.h,
|
||
),
|
||
Container(
|
||
decoration: BoxDecoration(
|
||
color: Colors.white,
|
||
borderRadius: BorderRadius.circular(8.r),
|
||
),
|
||
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 20.h),
|
||
child: Column(
|
||
children: [
|
||
Container(
|
||
width: 118.w,
|
||
height: 118.w,
|
||
margin: EdgeInsets.only(right: 10.w),
|
||
decoration: BoxDecoration(
|
||
color: Colors.grey[200],
|
||
borderRadius: BorderRadius.circular(8.r),
|
||
),
|
||
child: ClipRRect(
|
||
borderRadius: BorderRadius.circular(8.r),
|
||
child: Image(
|
||
image: const AssetImage(AppImages.iconShotFace),
|
||
width: 118.w,
|
||
height: 118.w,
|
||
fit: BoxFit.cover,
|
||
gaplessPlayback: true,
|
||
filterQuality: FilterQuality.medium,
|
||
errorBuilder: (context, error, stackTrace) {
|
||
return Icon(
|
||
Icons.person,
|
||
size: 30.sp,
|
||
color: Colors.grey[400],
|
||
);
|
||
},
|
||
),
|
||
),
|
||
),
|
||
SizedBox(
|
||
height: 10.h,
|
||
),
|
||
Text(
|
||
'拍摄须知'.tr,
|
||
style: TextStyle(
|
||
fontSize: 16.sp,
|
||
fontWeight: FontWeight.w500,
|
||
),
|
||
),
|
||
SizedBox(
|
||
height: 10.h,
|
||
),
|
||
Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Text(
|
||
'1、露出额头、耳朵,人脸正面、不戴帽子'.tr,
|
||
style: TextStyle(
|
||
fontSize: 12.sp,
|
||
fontWeight: FontWeight.w500,
|
||
),
|
||
),
|
||
Text(
|
||
'2、面部光线均匀、无逆光无美颜处理'.tr,
|
||
style: TextStyle(
|
||
fontSize: 12.sp,
|
||
fontWeight: FontWeight.w500,
|
||
),
|
||
),
|
||
Text(
|
||
'3、背部尽量简洁单一,建议均为白色'.tr,
|
||
style: TextStyle(
|
||
fontSize: 12.sp,
|
||
fontWeight: FontWeight.w500,
|
||
),
|
||
),
|
||
Text(
|
||
'4、确保开启APP的相机与存储权限'.tr,
|
||
style: TextStyle(
|
||
fontSize: 12.sp,
|
||
fontWeight: FontWeight.w500,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
SizedBox(
|
||
height: 10.h,
|
||
),
|
||
Divider(
|
||
height: 0.5.h,
|
||
),
|
||
SizedBox(
|
||
height: 10.h,
|
||
),
|
||
Column(
|
||
crossAxisAlignment: CrossAxisAlignment.center,
|
||
children: [
|
||
Text(
|
||
'错误示例',
|
||
style: TextStyle(
|
||
fontSize: 12.sp,
|
||
fontWeight: FontWeight.w500,
|
||
color: Colors.grey,
|
||
),
|
||
),
|
||
SizedBox(
|
||
height: 10.h,
|
||
),
|
||
Row(
|
||
mainAxisAlignment: MainAxisAlignment.center,
|
||
children: [
|
||
Column(
|
||
children: [
|
||
Container(
|
||
width: 88.w,
|
||
height: 88.w,
|
||
margin: EdgeInsets.only(right: 10.w),
|
||
decoration: BoxDecoration(
|
||
color: Colors.grey[200],
|
||
borderRadius: BorderRadius.circular(8.r),
|
||
),
|
||
child: ClipRRect(
|
||
borderRadius: BorderRadius.circular(8.r),
|
||
child: Image(
|
||
image: const AssetImage(AppImages.iconShotFaceError1),
|
||
width: 88.w,
|
||
height: 88.w,
|
||
fit: BoxFit.cover,
|
||
gaplessPlayback: true,
|
||
filterQuality: FilterQuality.medium,
|
||
errorBuilder: (context, error, stackTrace) {
|
||
return Icon(
|
||
Icons.person,
|
||
size: 30.sp,
|
||
color: Colors.grey[400],
|
||
);
|
||
},
|
||
),
|
||
),
|
||
),
|
||
SizedBox(
|
||
height: 5.h,
|
||
),
|
||
Text(
|
||
'人脸过小'.tr,
|
||
style: TextStyle(
|
||
fontSize: 12.sp,
|
||
fontWeight: FontWeight.w500,
|
||
color: Colors.grey,
|
||
),
|
||
)
|
||
],
|
||
),
|
||
Column(
|
||
children: [
|
||
Container(
|
||
width: 88.w,
|
||
height: 88.w,
|
||
margin: EdgeInsets.only(right: 10.w),
|
||
decoration: BoxDecoration(
|
||
color: Colors.grey[200],
|
||
borderRadius: BorderRadius.circular(8.r),
|
||
),
|
||
child: ClipRRect(
|
||
borderRadius: BorderRadius.circular(8.r),
|
||
child: Image(
|
||
image: const AssetImage(AppImages.iconShotFaceError2),
|
||
width: 88.w,
|
||
height: 88.w,
|
||
fit: BoxFit.cover,
|
||
gaplessPlayback: true,
|
||
filterQuality: FilterQuality.medium,
|
||
errorBuilder: (context, error, stackTrace) {
|
||
return Icon(
|
||
Icons.person,
|
||
size: 30.sp,
|
||
color: Colors.grey[400],
|
||
);
|
||
},
|
||
),
|
||
),
|
||
),
|
||
SizedBox(
|
||
height: 5.h,
|
||
),
|
||
Text(
|
||
'背景复杂'.tr,
|
||
style: TextStyle(
|
||
fontSize: 12.sp,
|
||
fontWeight: FontWeight.w500,
|
||
color: Colors.grey,
|
||
),
|
||
)
|
||
],
|
||
),
|
||
Column(
|
||
children: [
|
||
Container(
|
||
width: 88.w,
|
||
height: 88.w,
|
||
decoration: BoxDecoration(
|
||
color: Colors.grey[200],
|
||
borderRadius: BorderRadius.circular(8.r),
|
||
),
|
||
child: ClipRRect(
|
||
borderRadius: BorderRadius.circular(8.r),
|
||
child: Image(
|
||
image: const AssetImage(AppImages.iconShotFaceError3),
|
||
width: 88.w,
|
||
height: 88.w,
|
||
fit: BoxFit.cover,
|
||
gaplessPlayback: true,
|
||
filterQuality: FilterQuality.medium,
|
||
errorBuilder: (context, error, stackTrace) {
|
||
return Icon(
|
||
Icons.person,
|
||
size: 30.sp,
|
||
color: Colors.grey[400],
|
||
);
|
||
},
|
||
),
|
||
),
|
||
),
|
||
SizedBox(
|
||
height: 5.h,
|
||
),
|
||
Text(
|
||
'光线太暗'.tr,
|
||
style: TextStyle(
|
||
fontSize: 12.sp,
|
||
fontWeight: FontWeight.w500,
|
||
color: Colors.grey,
|
||
),
|
||
)
|
||
],
|
||
),
|
||
],
|
||
)
|
||
],
|
||
)
|
||
],
|
||
),
|
||
),
|
||
SizedBox(
|
||
height: 10.h,
|
||
),
|
||
Container(
|
||
margin: EdgeInsets.symmetric(
|
||
horizontal: 10.w,
|
||
),
|
||
child: Row(
|
||
children: [
|
||
Expanded(
|
||
child: ElevatedButton(
|
||
onPressed: () {
|
||
|
||
}.debounce(),
|
||
style: ElevatedButton.styleFrom(
|
||
backgroundColor: Colors.grey[50],
|
||
padding: EdgeInsets.symmetric(vertical: 10.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: () {
|
||
controller.showFunctionNotOpen();
|
||
}.debounce(),
|
||
style: ElevatedButton.styleFrom(
|
||
backgroundColor: Colors.blue,
|
||
padding: EdgeInsets.symmetric(vertical: 10.h),
|
||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.r)),
|
||
),
|
||
child: Text(
|
||
'录入人脸'.tr,
|
||
style: TextStyle(
|
||
fontSize: 16.sp,
|
||
color: Colors.white,
|
||
fontWeight: FontWeight.w500,
|
||
),
|
||
),
|
||
),
|
||
)
|
||
],
|
||
),
|
||
)
|
||
],
|
||
),
|
||
),
|
||
),
|
||
);
|
||
}
|
||
}
|