From c1a68306149aa1581c43bf1b66c5da30b93158e3 Mon Sep 17 00:00:00 2001 From: liyi Date: Thu, 11 Sep 2025 15:31:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=9B=A2=E9=98=9F?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/routes/app_pages.dart | 7 + lib/routes/app_routes.dart | 1 + lib/views/home/home_view.dart | 1 + .../home/widget/home_not_device_area.dart | 5 +- .../main/widget/main_left_drawer_widget.dart | 22 +- .../team/teamManage/team_manage_binding.dart | 9 + .../teamManage/team_manage_controller.dart | 5 + .../team/teamManage/team_manage_view.dart | 302 ++++++++++++++++++ 8 files changed, 343 insertions(+), 9 deletions(-) create mode 100644 lib/views/team/teamManage/team_manage_binding.dart create mode 100644 lib/views/team/teamManage/team_manage_controller.dart create mode 100644 lib/views/team/teamManage/team_manage_view.dart diff --git a/lib/routes/app_pages.dart b/lib/routes/app_pages.dart index 75b8f5e..737ccd1 100644 --- a/lib/routes/app_pages.dart +++ b/lib/routes/app_pages.dart @@ -18,6 +18,8 @@ import 'package:starwork_flutter/views/main/main_binding.dart'; import 'package:starwork_flutter/views/main/main_view.dart'; import 'package:starwork_flutter/views/team/joinTeam/join_team_binding.dart'; import 'package:starwork_flutter/views/team/joinTeam/join_team_view.dart'; +import 'package:starwork_flutter/views/team/teamManage/team_manage_binding.dart'; +import 'package:starwork_flutter/views/team/teamManage/team_manage_view.dart'; import 'package:starwork_flutter/views/team/teamNotice/teamNoticeDetails/team_notice_details_binding.dart'; import 'package:starwork_flutter/views/messages/messages_binding.dart'; import 'package:starwork_flutter/views/messages/messages_view.dart'; @@ -109,5 +111,10 @@ class AppPages { page: () => JoinTeamView(), binding: JoinTeamBinding(), ), + GetPage( + name: AppRoutes.teamManage, + page: () => TeamManageView(), + binding: TeamManageBinding(), + ), ]; } diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart index f22e71a..138551f 100644 --- a/lib/routes/app_routes.dart +++ b/lib/routes/app_routes.dart @@ -15,4 +15,5 @@ class AppRoutes{ static const String teamUseCaseSetting = '/team/useCaseSetting'; static const String teamCreateTeam = '/team/createTeam'; static const String teamJoinTeam = '/team/joinTeam'; + static const String teamManage = '/team/teamManage'; } \ No newline at end of file diff --git a/lib/views/home/home_view.dart b/lib/views/home/home_view.dart index ede4fa6..94d0f34 100644 --- a/lib/views/home/home_view.dart +++ b/lib/views/home/home_view.dart @@ -364,6 +364,7 @@ class HomeView extends GetView { Get.toNamed(AppRoutes.searchDevice); break; case 1: + Get.toNamed(AppRoutes.teamJoinTeam); break; } } diff --git a/lib/views/home/widget/home_not_device_area.dart b/lib/views/home/widget/home_not_device_area.dart index 7927357..33b7fab 100644 --- a/lib/views/home/widget/home_not_device_area.dart +++ b/lib/views/home/widget/home_not_device_area.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:starwork_flutter/routes/app_routes.dart'; class HomeNotDeviceArea extends StatefulWidget { const HomeNotDeviceArea({super.key}); @@ -63,7 +64,9 @@ class _HomeNotDeviceAreaState extends State { ), elevation: 0, ), - onPressed: () {}, + onPressed: () { + Get.toNamed(AppRoutes.searchDevice); + }, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ diff --git a/lib/views/main/widget/main_left_drawer_widget.dart b/lib/views/main/widget/main_left_drawer_widget.dart index 607fcd9..88370ff 100644 --- a/lib/views/main/widget/main_left_drawer_widget.dart +++ b/lib/views/main/widget/main_left_drawer_widget.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -159,14 +160,19 @@ class _MainLeftDrawerWidgetState extends State { ), // 设置图标 - GestureDetector( - onTap: () {}, - child: Container( - padding: EdgeInsets.all(8.w), - child: Icon( - Icons.settings, - size: 20.sp, - color: isSelected ? const Color(0xFF2196F3) : Colors.grey[600], + Visibility( + visible: team.isOwner ?? false, + child: GestureDetector( + onTap: () { + Get.toNamed(AppRoutes.teamManage); + }, + child: Container( + padding: EdgeInsets.all(8.w), + child: Icon( + Icons.settings, + size: 20.sp, + color: isSelected ? const Color(0xFF2196F3) : Colors.grey[600], + ), ), ), ), diff --git a/lib/views/team/teamManage/team_manage_binding.dart b/lib/views/team/teamManage/team_manage_binding.dart new file mode 100644 index 0000000..8c6697e --- /dev/null +++ b/lib/views/team/teamManage/team_manage_binding.dart @@ -0,0 +1,9 @@ +import 'package:get/get.dart'; +import 'package:starwork_flutter/views/team/teamManage/team_manage_controller.dart'; + +class TeamManageBinding extends Bindings { + @override + void dependencies() { + Get.lazyPut(() => TeamManageController()); + } +} diff --git a/lib/views/team/teamManage/team_manage_controller.dart b/lib/views/team/teamManage/team_manage_controller.dart new file mode 100644 index 0000000..57eb01d --- /dev/null +++ b/lib/views/team/teamManage/team_manage_controller.dart @@ -0,0 +1,5 @@ +import 'package:starwork_flutter/base/base_controller.dart'; + +class TeamManageController extends BaseController{ + +} \ No newline at end of file diff --git a/lib/views/team/teamManage/team_manage_view.dart b/lib/views/team/teamManage/team_manage_view.dart new file mode 100644 index 0000000..099e86d --- /dev/null +++ b/lib/views/team/teamManage/team_manage_view.dart @@ -0,0 +1,302 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/src/widgets/framework.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_app_bar_widget.dart'; +import 'package:starwork_flutter/extension/function_extension.dart'; +import 'package:starwork_flutter/views/team/teamManage/team_manage_controller.dart'; + +class TeamManageView extends GetView { + @override + Widget build(BuildContext context) { + 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, + ), + 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.grey[200], + 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 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( + '团队名称', + 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( + '小区/公寓'.tr, + style: TextStyle( + fontSize: 10.sp, + fontWeight: FontWeight.w500, + color: Colors.white, + ), + ), + ), + SizedBox( + width: 4.w, + ), + Text( + 'TD01022881', + style: TextStyle( + fontSize: 10.sp, + fontWeight: FontWeight.w500, + color: Colors.white, + ), + ) + ], + ) + ], + ), + const Icon( + Icons.arrow_forward_ios_rounded, + color: Colors.white, + ) + ], + ), + ); + } + + _buildOther() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '其他', + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.w500, + color: Colors.grey[400], + ), + ), + SizedBox( + height: 10.h, + ), + Container( + width: double.infinity, + padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 10.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.r), + color: Colors.white, + ), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + children: [ + Icon( + Icons.assignment_outlined, + color: Colors.blue.withOpacity(0.8), + ), + SizedBox( + width: 8.w, + ), + Text( + '运维服务', + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.w500, + color: Colors.black87, + ), + ), + ], + ), + Icon( + Icons.arrow_forward_ios_rounded, + color: Colors.grey, + size: 14.sp, + ) + ], + ), + + SizedBox(height: 10.h), + // 分割线 + Divider( + height: 1.h, + color: Colors.grey.withOpacity(0.2), + ), + SizedBox(height: 10.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + children: [ + Icon( + Icons.assignment_outlined, + color: Colors.blue.withOpacity(0.8), + ), + SizedBox( + width: 8.w, + ), + Text( + '操作日志', + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.w500, + color: Colors.black87, + ), + ), + ], + ), + Icon( + Icons.arrow_forward_ios_rounded, + color: Colors.grey, + size: 14.sp, + ) + ], + ), + SizedBox(height: 10.h), + Divider( + height: 1.h, + color: Colors.grey.withOpacity(0.2), + ), + SizedBox(height: 10.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + children: [ + Icon( + Icons.assignment_outlined, + color: Colors.blue.withOpacity(0.8), + ), + SizedBox( + width: 8.w, + ), + Text( + '团队二维码', + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.w500, + color: Colors.black87, + ), + ), + ], + ), + Icon( + Icons.arrow_forward_ios_rounded, + color: Colors.grey, + size: 14.sp, + ) + ], + ) + ], + ), + ) + ], + ); + } +}