starwork_flutter/lib/views/team/teamManage/team_manage_view.dart
2025-09-12 18:04:14 +08:00

334 lines
10 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:starwork_flutter/api/model/team/response/team_info_response.dart';
import 'package:starwork_flutter/base/app_logger.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 'package:starwork_flutter/routes/app_routes.dart';
import 'package:starwork_flutter/views/team/teamManage/team_manage_controller.dart';
class TeamManageView extends GetView<TeamManageController> {
const TeamManageView({super.key});
@override
Widget build(BuildContext context) {
// 获取传递的参数
final arguments = Get.arguments as Map<String, dynamic>?;
final teamInfo = arguments?['teamInfo'] as Map<String, dynamic>?;
if (teamInfo != null) {
controller.teamInfo.value = TeamInfoResponse.fromJson(teamInfo);
}
return Scaffold(
backgroundColor: AppColors.scaffoldBackgroundColor,
appBar: CustomAppBarWidget(
title: '团队管理'.tr,
),
body: Padding(
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 10.h),
child: Column(
children: [
_buildHeadRow(),
SizedBox(
height: 10.h,
),
_buildOrganizationalStructure(),
SizedBox(
height: 10.h,
),
Expanded(
child: _buildOther(),
),
// 分割线
Divider(
height: 1.h,
color: Colors.grey.withOpacity(0.2),
),
SizedBox(
height: 10.h,
),
SizedBox(
width: double.infinity,
child: Row(
children: [
Expanded(
child: ElevatedButton(
onPressed: () {}.debounce(),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.white,
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,
),
),
),
),
],
),
),
SizedBox(
height: 20.h,
),
],
),
),
);
}
_buildHeadRow() {
return GestureDetector(
onTap: () {
Get.toNamed(
AppRoutes.teamInfo,
arguments: {
'teamInfo': controller.teamInfo.value!.toJson(),
},
);
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 10.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.r),
color: Colors.blue,
boxShadow: [
BoxShadow(
color: Colors.blue.withOpacity(0.2),
spreadRadius: 2,
blurRadius: 3,
offset: const Offset(0, 3), // changes position of shadow
),
],
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
controller.teamInfo.value!.teamName!,
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.w500,
color: Colors.white,
),
),
SizedBox(
height: 8.h,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
padding: EdgeInsets.symmetric(horizontal: 4.w, vertical: 2.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.r),
color: Colors.white.withOpacity(0.3),
),
child: Text(
controller.teamInfo.value!.sceneName!,
style: TextStyle(
fontSize: 10.sp,
fontWeight: FontWeight.w500,
color: Colors.white,
),
),
),
SizedBox(
width: 4.w,
),
Text(
controller.teamInfo.value!.teamNo!,
style: TextStyle(
fontSize: 10.sp,
fontWeight: FontWeight.w500,
color: Colors.white,
),
)
],
)
],
),
const Icon(
Icons.arrow_forward_ios_rounded,
color: Colors.white,
)
],
),
),
);
}
_buildOrganizationalStructure() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'组织架构',
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w500,
color: Colors.grey[500],
),
),
SizedBox(
height: 10.h,
),
CustomCellListWidget(
children: [
CustomCellWidget(
onTap: () {},
leftText: '人员配置'.tr,
leftIcon: Icon(
Icons.perm_contact_calendar_rounded,
color: Colors.blue.withOpacity(0.8),
),
rightWidget: Icon(
Icons.arrow_forward_ios_rounded,
size: 16.sp,
color: Colors.grey[300],
),
),
CustomCellWidget(
onTap: () {},
leftText: '权限分配'.tr,
leftIcon: Icon(
Icons.person,
color: Colors.blue.withOpacity(0.8),
),
rightWidget: Icon(
Icons.arrow_forward_ios_rounded,
size: 16.sp,
color: Colors.grey[300],
),
),
CustomCellWidget(
onTap: () {},
leftText: '新用户审核'.tr,
leftIcon: Icon(
Icons.switch_account_rounded,
color: Colors.blue.withOpacity(0.8),
),
rightWidget: Icon(
Icons.arrow_forward_ios_rounded,
size: 16.sp,
color: Colors.grey[300],
),
),
],
),
],
);
}
_buildOther() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'其他',
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w500,
color: Colors.grey[500],
),
),
SizedBox(
height: 10.h,
),
CustomCellListWidget(
children: [
CustomCellWidget(
onTap: () {
Get.toNamed(AppRoutes.deviceManage);
},
leftText: '设备管理'.tr,
leftIcon: Icon(
Icons.storage_rounded,
color: Colors.blue.withOpacity(0.8),
),
rightWidget: Icon(
Icons.arrow_forward_ios_rounded,
size: 16.sp,
color: Colors.grey[300],
),
),
CustomCellWidget(
onTap: () {},
leftText: '运维服务'.tr,
leftIcon: Icon(
Icons.assessment_rounded,
color: Colors.blue.withOpacity(0.8),
),
rightWidget: Icon(
Icons.arrow_forward_ios_rounded,
size: 16.sp,
color: Colors.grey[300],
),
),
CustomCellWidget(
onTap: () {},
leftText: '操作日志'.tr,
leftIcon: Icon(
Icons.assignment,
color: Colors.blue.withOpacity(0.8),
),
rightWidget: Icon(
Icons.arrow_forward_ios_rounded,
size: 16.sp,
color: Colors.grey[300],
),
),
CustomCellWidget(
onTap: () {},
leftText: '团队二维码'.tr,
leftIcon: Icon(
Icons.qr_code_2_outlined,
color: Colors.blue.withOpacity(0.8),
),
rightWidget: Icon(
Icons.arrow_forward_ios_rounded,
size: 16.sp,
color: Colors.grey[300],
),
),
],
),
],
);
}
}