From fb6d68b5a9a08b4f6157a274be8a97c1913f42bb Mon Sep 17 00:00:00 2001 From: tanlongsheng <252620078@qq.com> Date: Sat, 26 Jul 2025 12:59:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=92=BB=E5=99=B6=E4=BC=9A=E8=AE=AE=E5=8A=A9?= =?UTF-8?q?=E6=89=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../import_audio_bottom_sheet.dart | 159 -------------- .../navigation_bar_bottom_sheet.dart | 70 ++++++- .../meeting/views/meeting_home_view.dart | 20 +- lib/modules/meeting/views/meeting_view.dart | 194 +++++++++--------- 4 files changed, 160 insertions(+), 283 deletions(-) delete mode 100644 lib/modules/meeting/views/bottomSheet/import_audio_bottom_sheet.dart diff --git a/lib/modules/meeting/views/bottomSheet/import_audio_bottom_sheet.dart b/lib/modules/meeting/views/bottomSheet/import_audio_bottom_sheet.dart deleted file mode 100644 index f62cf7944..000000000 --- a/lib/modules/meeting/views/bottomSheet/import_audio_bottom_sheet.dart +++ /dev/null @@ -1,159 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../../../routes/app_routes.dart'; -import '../../controllers/meeting_home_controller.dart'; - -class ImportAudioBottomSheet extends GetView { - const ImportAudioBottomSheet({super.key}); - - @override - Widget build(BuildContext context) { - final isDarkMode = Theme.of(context).brightness == Brightness.dark; - return Padding( - padding: EdgeInsets.symmetric(horizontal: 12.w), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - padding: EdgeInsets.symmetric(vertical: 10.w), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - '添加音频', - style: TextStyle( - fontSize: 16.sp, - color: isDarkMode ? Colors.white : Colors.black87, - fontWeight: FontWeight.bold, - ), - ), - GestureDetector( - onTap: () => Get.back(), - child: Container( - width: 26.w, - height: 26.w, - decoration: BoxDecoration( - color: isDarkMode ? Colors.grey[800] : Colors.white, - borderRadius: BorderRadius.circular(26.r), - ), - child: Icon( - Icons.close, - size: 18.w, - color: Colors.grey[400], - ), - ), - ) - ], - ), - ), - Divider( - height: 1, - color: isDarkMode ? Colors.grey[700] : Colors.grey[300], - ), - SizedBox(height: 16.w), - _importAudioItem(Icons.mic, '现场录音', onTap: () async { - Get.back(); - await Get.toNamed(Routes.meetingRecord, arguments: { - 'audioTypes': 0, - }); - controller.addMeetingAudio(); - }), - _importAudioItem( - Icons.videocam, - '音、视频录音', - onTap: controller.bleManager.isConnected - ? () async { - Get.back(); - await Get.toNamed(Routes.meetingRecord, arguments: { - 'audioTypes': 1, - }); - controller.addMeetingAudio(); - } - : null, - ), - _importAudioItem( - Icons.phone, - '通话录音', - onTap: controller.bleManager.isConnected - ? () async { - Get.back(); - await Get.toNamed(Routes.meetingRecord, arguments: { - 'audioTypes': 2, - }); - controller.addMeetingAudio(); - } - : null, - ), - _importAudioItem(Icons.library_music, '导入本地音频', onTap: () { - Get.back(); - controller.addAudio(); - }), - Padding( - padding: EdgeInsets.symmetric(vertical: 16.w), - child: Text( - '支持导入单文件时长不超过5小时的音频', - style: TextStyle( - fontSize: 14.sp, - color: isDarkMode ? Colors.grey[400] : Colors.grey[600], - ), - ), - ), - SizedBox(height: 4.w), - ], - ), - ); - } - - Widget _importAudioItem( - IconData icon, - String title, { - VoidCallback? onTap, - }) { - return Builder( - builder: (context) { - final isDarkMode = Theme.of(context).brightness == Brightness.dark; - return GestureDetector( - onTap: onTap, - child: Container( - height: 48.w, - padding: EdgeInsets.symmetric(horizontal: 12.w), - margin: EdgeInsets.symmetric(vertical: 4.w), - decoration: BoxDecoration( - color: isDarkMode - ? Colors.grey[800]!.withValues(alpha: onTap != null ? 1 : 0.5) - : Colors.grey[50]!.withValues(alpha: onTap != null ? 1 : 0.5), - borderRadius: BorderRadius.circular(12.w), - ), - child: Row( - children: [ - Opacity( - opacity: onTap != null ? 1.0 : 0.5, - child: Icon(icon, size: 20.w), - ), - 10.horizontalSpace, - Expanded( - child: Text( - title, - style: TextStyle( - fontSize: 14.sp, - color: isDarkMode - ? Colors.white.withValues(alpha: onTap != null ? 1 : 0.5) - : Colors.black87.withValues(alpha: onTap != null ? 1 : 0.5), - ), - ), - ), - Icon( - Icons.arrow_forward_ios, - size: 16.w, - color: Colors.grey.withValues(alpha: onTap != null ? 1 : 0.5), - ), - ], - ), - ), - ); - }, - ); - } -} diff --git a/lib/modules/meeting/views/bottomSheet/navigation_bar_bottom_sheet.dart b/lib/modules/meeting/views/bottomSheet/navigation_bar_bottom_sheet.dart index 020c1da6b..5e92df93a 100644 --- a/lib/modules/meeting/views/bottomSheet/navigation_bar_bottom_sheet.dart +++ b/lib/modules/meeting/views/bottomSheet/navigation_bar_bottom_sheet.dart @@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_navigation/src/extension_navigation.dart'; import 'package:get/state_manager.dart'; +import '../../../../routes/app_routes.dart'; import '../../controllers/meeting_home_controller.dart'; class NavigationBarBottomSheet extends GetView { @@ -14,13 +15,59 @@ class NavigationBarBottomSheet extends GetView { child: Column( mainAxisSize: MainAxisSize.min, children: [ - _buildItem( - context, // 传递 context 参数 - '开始录音', - Icons.mic_rounded, - Colors.red, - ), - SizedBox(height: 15.w), + if (controller.meetingController.type == 0) + _buildItem( + context, // 传递 context 参数 + '开始录音', + Icons.mic_rounded, + Colors.red, + ), + if (controller.meetingController.type == 1) + _buildItem( + context, // 传递 context 参数 + '现场录音', + Icons.mic_rounded, + Colors.red, + onTap: () async { + Get.back(); + await Get.toNamed(Routes.meetingRecord, arguments: { + 'audioTypes': 0, + }); + controller.addMeetingAudio(); + }, + ), + if (controller.meetingController.type == 1) + _buildItem( + context, // 传递 context 参数 + '音、视频录音', + Icons.videocam, + Colors.green, + onTap: controller.bleManager.isConnected + ? () async { + Get.back(); + await Get.toNamed(Routes.meetingRecord, arguments: { + 'audioTypes': 1, + }); + controller.addMeetingAudio(); + } + : null, + ), + if (controller.meetingController.type == 1) + _buildItem( + context, // 传递 context 参数 + '通话录音', + Icons.phone, + Colors.orange, + onTap: controller.bleManager.isConnected + ? () async { + Get.back(); + await Get.toNamed(Routes.meetingRecord, arguments: { + 'audioTypes': 2, + }); + controller.addMeetingAudio(); + } + : null, + ), _buildItem( context, // 传递 context 参数 '导入音频', @@ -35,16 +82,16 @@ class NavigationBarBottomSheet extends GetView { GestureDetector( onTap: () => Get.back(), child: Container( - width: 45.w, - height: 45.w, + width: 42, + height: 42, decoration: BoxDecoration( color: Colors.black.withValues(alpha: 0.8), - borderRadius: BorderRadius.circular(50.w), + borderRadius: BorderRadius.circular(50), ), child: const Icon(Icons.close, color: Colors.white), ), ), - SizedBox(height: 24.w), + const SizedBox(height: 19), ], ), ); @@ -65,6 +112,7 @@ class NavigationBarBottomSheet extends GetView { width: 220.w, height: 60.w, padding: EdgeInsets.all(5.w), + margin: EdgeInsets.only(top: 15.w), decoration: BoxDecoration( color: isDarkMode ? Colors.grey[800]!.withValues(alpha: onTap != null ? 1 : 0.5) diff --git a/lib/modules/meeting/views/meeting_home_view.dart b/lib/modules/meeting/views/meeting_home_view.dart index 9c4d4ee84..6a6e1ec5f 100644 --- a/lib/modules/meeting/views/meeting_home_view.dart +++ b/lib/modules/meeting/views/meeting_home_view.dart @@ -10,7 +10,6 @@ import '../controllers/meeting_home_controller.dart'; import '../model/meeting_model.dart'; import '../utils/meeting_ui_utils.dart'; import 'bottomSheet/edit_title_bottom_sheet.dart'; -import 'bottomSheet/import_audio_bottom_sheet.dart'; class MeetingHomeView extends StatefulWidget { const MeetingHomeView({super.key}); @@ -43,7 +42,8 @@ class _MeetingHomeViewState extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ _buildFiltrate(isDarkMode), - _buildConnect(isDarkMode), + if (_controller.meetingController.type == 0) + _buildConnect(isDarkMode), ], ), Expanded( @@ -51,22 +51,6 @@ class _MeetingHomeViewState extends State ), ], ), - floatingActionButton: FloatingActionButton( - heroTag: "addAudio", - onPressed: () { - Get.bottomSheet( - const ImportAudioBottomSheet(), - isScrollControlled: true, - backgroundColor: isDarkMode ? Colors.grey[800] : Colors.grey[100], - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.vertical( - top: Radius.circular(12.r), - ), - ), - ); - }, - child: const Icon(Icons.add), - ), ), ); } diff --git a/lib/modules/meeting/views/meeting_view.dart b/lib/modules/meeting/views/meeting_view.dart index e433fc38c..c7d9c7688 100644 --- a/lib/modules/meeting/views/meeting_view.dart +++ b/lib/modules/meeting/views/meeting_view.dart @@ -19,10 +19,105 @@ class MeetingView extends GetView { return Scaffold( key: controller.scaffoldKey, backgroundColor: MeetingUIUtils.getBackgroundColor(isDarkMode), - body: PageView( - physics: const NeverScrollableScrollPhysics(), - controller: controller.pageController, - children: controller.pageList, + body: Stack( + alignment: Alignment.center, + clipBehavior: Clip.none, + children: [ + PageView( + physics: const NeverScrollableScrollPhysics(), + controller: controller.pageController, + children: controller.pageList, + ), + if (controller.type == 0) + Positioned( + bottom: 0, + left: 0, + right: 0, + child: Obx( + () => BottomNavigationBar( + items: const [ + BottomNavigationBarItem( + icon: Icon(Icons.folder_outlined), + activeIcon: Icon(Icons.folder), + label: '文件', + ), + BottomNavigationBarItem( + icon: SizedBox(), + label: '', + ), + BottomNavigationBarItem( + icon: Icon(Icons.person_outline), + activeIcon: Icon(Icons.person), + label: '我的', + ), + ], + backgroundColor: + isDarkMode ? const Color(0xFF1A1A1A) : Colors.white, + currentIndex: controller.pageIndex.value, + unselectedItemColor: Colors.grey, + selectedItemColor: isDarkMode ? Colors.white : Colors.blue, + unselectedFontSize: 10.sp, + selectedFontSize: 10.sp, + onTap: (int index) { + if (index == 1 || index == controller.pageIndex.value) { + return; + } + if (index == 0) { + controller.pageIndex.value = 0; + controller.pageController.jumpToPage(0); + } else { + controller.pageIndex.value = 2; + controller.pageController.jumpToPage(1); + } + }, + ), + ), + ), + Positioned( + bottom: 10, + child: GestureDetector( + onTap: () { + Get.bottomSheet( + BackdropFilter( + filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0), + child: const NavigationBarBottomSheet(), + ), + isScrollControlled: true, + ); + }, + child: Container( + width: 60, + height: 60, + padding: const EdgeInsets.all(5), + alignment: Alignment.center, + decoration: BoxDecoration( + color: isDarkMode ? const Color(0xFF1A1A1A) : Colors.white, + borderRadius: BorderRadius.circular(60), + boxShadow: [ + BoxShadow( + color: Colors.black + .withValues(alpha: isDarkMode ? 0.3 : 0.1), + blurRadius: 8, + offset: const Offset(0, 2), + ), + ], + ), + child: Container( + alignment: Alignment.center, + decoration: BoxDecoration( + color: MeetingUIUtils.getButtonColor(isDarkMode), + borderRadius: BorderRadius.circular(60), + ), + child: const Icon( + Icons.add, + color: Colors.white, + size: 30, + ), + ), + ), + ), + ), + ], ), drawer: Drawer( width: 260.w, @@ -30,97 +125,6 @@ class MeetingView extends GetView { child: const FiltrateDrawer(), ), drawerEnableOpenDragGesture: false, - bottomNavigationBar: controller.type == 0 - ? Stack( - alignment: Alignment.center, - clipBehavior: Clip.none, - children: [ - Obx( - () => BottomNavigationBar( - items: const [ - BottomNavigationBarItem( - icon: Icon(Icons.folder_outlined), - activeIcon: Icon(Icons.folder), - label: '文件', - ), - BottomNavigationBarItem( - icon: SizedBox(), - label: '', - ), - BottomNavigationBarItem( - icon: Icon(Icons.person_outline), - activeIcon: Icon(Icons.person), - label: '我的', - ), - ], - backgroundColor: - isDarkMode ? const Color(0xFF1A1A1A) : Colors.white, - currentIndex: controller.pageIndex.value, - unselectedItemColor: Colors.grey, - selectedItemColor: isDarkMode ? Colors.white : Colors.blue, - unselectedFontSize: 10.sp, - selectedFontSize: 10.sp, - onTap: (int index) { - if (index == 1 || index == controller.pageIndex.value) - return; - if (index == 0) { - controller.pageIndex.value = 0; - controller.pageController.jumpToPage(0); - } else { - controller.pageIndex.value = 2; - controller.pageController.jumpToPage(1); - } - }, - ), - ), - Positioned( - top: -18.w, - child: GestureDetector( - onTap: () { - Get.bottomSheet( - BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0), - child: const NavigationBarBottomSheet(), - ), - isScrollControlled: true, - ); - }, - child: Container( - width: 60.w, - height: 60.w, - padding: EdgeInsets.all(5.w), - alignment: Alignment.center, - decoration: BoxDecoration( - color: - isDarkMode ? const Color(0xFF1A1A1A) : Colors.white, - borderRadius: BorderRadius.circular(60.w), - boxShadow: [ - BoxShadow( - color: Colors.black - .withValues(alpha: isDarkMode ? 0.3 : 0.1), - blurRadius: 8, - offset: const Offset(0, 2), - ), - ], - ), - child: Container( - alignment: Alignment.center, - decoration: BoxDecoration( - color: MeetingUIUtils.getButtonColor(isDarkMode), - borderRadius: BorderRadius.circular(60.w), - ), - child: Icon( - Icons.add, - color: Colors.white, - size: 30.w, - ), - ), - ), - ), - ), - ], - ) - : null, ); } }