194 lines
6.4 KiB
Dart
194 lines
6.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:starwork_flutter/api/model/team/response/person_list_response.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/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 'package:starwork_flutter/routes/app_routes.dart';
|
|
import 'face_info_controller.dart';
|
|
|
|
class FaceInfoView extends GetView<FaceInfoController> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: CustomAppBarWidget(
|
|
title: '人脸信息'.tr,
|
|
backgroundColor: AppColors.scaffoldBackgroundColor,
|
|
),
|
|
backgroundColor: AppColors.scaffoldBackgroundColor,
|
|
body: Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 10.h),
|
|
child: Column(
|
|
children: [
|
|
_buildSearchBar(),
|
|
SizedBox(
|
|
height: 10.h,
|
|
),
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(8.0.r),
|
|
),
|
|
child: CustomCellListWidget(
|
|
children: [
|
|
CustomCellWidget(
|
|
onTap: () {
|
|
Get.toNamed(AppRoutes.teamFaceAudit);
|
|
},
|
|
leftText: '人脸审核'.tr,
|
|
rightWidget: Icon(
|
|
Icons.arrow_forward_ios_rounded,
|
|
size: 16.sp,
|
|
color: Colors.grey,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 10.h,
|
|
),
|
|
Obx(
|
|
() => Expanded(
|
|
child: SingleChildScrollView(
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(8.0.r),
|
|
),
|
|
child: CustomCellListWidget(
|
|
children: (controller.personList.value.list ?? [])
|
|
.map<CustomCellWidget>((e) => _buildPersonItem(e))
|
|
.toList(),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 10.h,
|
|
),
|
|
Obx(
|
|
() => Visibility(
|
|
visible: controller.personList.value.list?.isNotEmpty ?? false,
|
|
child: SizedBox(
|
|
width: double.infinity,
|
|
child: ElevatedButton(
|
|
onPressed: () {}.debounce(),
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: Colors.blue,
|
|
padding: EdgeInsets.symmetric(vertical: 10.h),
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.r)),
|
|
),
|
|
child: Text(
|
|
'一键提醒录入人脸(${controller.personList.value.list?.length}人)'.tr,
|
|
style: TextStyle(
|
|
fontSize: 16.sp,
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
_buildSearchBar() {
|
|
return TextField(
|
|
controller: controller.searchInputController,
|
|
textInputAction: TextInputAction.search,
|
|
decoration: InputDecoration(
|
|
hintText: '搜索'.tr,
|
|
hintStyle: TextStyle(
|
|
fontSize: 14.sp,
|
|
color: const Color(0xFF999999),
|
|
),
|
|
prefixIcon: const Icon(
|
|
Icons.search,
|
|
color: Color(0xFF999999),
|
|
),
|
|
filled: true,
|
|
// 启用背景填充
|
|
fillColor: Colors.white,
|
|
// 灰色背景(可调整色值)
|
|
border: InputBorder.none,
|
|
// 设置内边距
|
|
contentPadding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 10.h),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: const BorderSide(
|
|
color: Colors.blue,
|
|
width: 1.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0.r),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderSide: const BorderSide(color: Colors.transparent),
|
|
borderRadius: BorderRadius.circular(8.0.r),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
_buildPersonItem(PersonItem personItem) {
|
|
return CustomCellWidget(
|
|
onTap: () {
|
|
Get.toNamed(AppRoutes.teamEnterFace, arguments: personItem);
|
|
},
|
|
leftText: personItem.personName ?? '',
|
|
leftWidget: 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],
|
|
);
|
|
},
|
|
),
|
|
),
|
|
),
|
|
rightWidget: Row(
|
|
children: [
|
|
Text(
|
|
personItem.faceCount == 0 ? '未录入'.tr : '已录入'.tr,
|
|
style: TextStyle(
|
|
fontSize: 16.sp,
|
|
color: personItem.faceCount == 0 ? Colors.orange : Colors.grey,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
Icon(
|
|
Icons.arrow_forward_ios_rounded,
|
|
size: 16.sp,
|
|
color: Colors.grey,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|