From 3f3fbde2a330929d43ccc87cfbfa63b5628e7c57 Mon Sep 17 00:00:00 2001 From: lxm <1274844347@qq.com> Date: Tue, 22 Jul 2025 17:58:42 +0800 Subject: [PATCH] =?UTF-8?q?feat(Meeting=20ui):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=9A=97=E9=BB=91=E6=A8=A1=E5=BC=8F=E6=94=AF=E6=8C=81=E5=B9=B6?= =?UTF-8?q?=E9=87=8D=E6=9E=84UI=E5=B7=A5=E5=85=B7=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 重构颜色和样式处理逻辑,新增MeetingUIUtils工具类统一管理UI样式 修改多个组件以支持暗黑模式,包括背景色、文本颜色和阴影效果 优化底部弹窗和页面布局在不同主题下的显示一致性 --- .gitignore | 2 +- .../meeting/utils/meeting_ui_utils.dart | 63 +++++++++++++++++++ .../views/bottomSheet/ai_bottom_sheet.dart | 4 +- .../bottomSheet/edit_title_bottom_sheet.dart | 2 +- .../views/bottomSheet/filtrate_drawer.dart | 4 +- .../import_audio_bottom_sheet.dart | 26 +++++--- .../views/bottomSheet/more_bottom_sheet.dart | 2 +- .../navigation_bar_bottom_sheet.dart | 21 +++++-- .../views/bottomSheet/share_bottom_sheet.dart | 4 +- .../bottomSheet/statistics_bottom_sheet.dart | 4 +- .../meeting/views/meeting_connect_view.dart | 60 ++++++++++-------- .../meeting/views/meeting_details_view.dart | 54 +++++++++------- .../meeting/views/meeting_home_view.dart | 53 ++++++---------- .../meeting/views/meeting_mine_view.dart | 30 +++++---- lib/modules/meeting/views/meeting_view.dart | 21 +++++-- .../meeting/views/tabs/overview_tab.dart | 39 ++++++------ .../meeting/views/tabs/speech_tab.dart | 16 ++--- .../meeting/views/tabs/summary_tab.dart | 10 +-- 18 files changed, 259 insertions(+), 156 deletions(-) create mode 100644 lib/modules/meeting/utils/meeting_ui_utils.dart diff --git a/.gitignore b/.gitignore index 80c4856c3..ac4aa4092 100644 --- a/.gitignore +++ b/.gitignore @@ -221,4 +221,4 @@ fastlane/test_output fastlane/readme.md .trae/rules/project_rules.md .augment/rules/imported/project_rules.md -.kiro/steering/flutter_project_standards.md +.kiro/ diff --git a/lib/modules/meeting/utils/meeting_ui_utils.dart b/lib/modules/meeting/utils/meeting_ui_utils.dart new file mode 100644 index 000000000..26ccb05a0 --- /dev/null +++ b/lib/modules/meeting/utils/meeting_ui_utils.dart @@ -0,0 +1,63 @@ +import 'package:flutter/material.dart'; + +/// 会议模块UI工具类 +/// 提供统一的颜色和样式方法,确保UI风格一致性 +class MeetingUIUtils { + /// 获取背景颜色 + static Color getBackgroundColor(bool isDarkMode) { + return isDarkMode ? Colors.black : Colors.grey[50]!; + } + + /// 获取卡片背景颜色 + static Color getCardColor(bool isDarkMode) { + return isDarkMode ? const Color(0xFF1A1A1A) : Colors.white; + } + + /// 获取半透明白色 + static Color getTranslucentWhite(double alpha) { + return Colors.white.withValues(alpha: alpha); + } + + /// 获取半透明黑色 + static Color getTranslucentBlack(double alpha) { + return Colors.black.withValues(alpha: alpha); + } + + /// 获取主文本颜色 + static Color getTextColor(bool isDarkMode) { + return isDarkMode ? Colors.white : Colors.grey[800]!; + } + + /// 获取次要文本颜色 + static Color getSecondaryTextColor(bool isDarkMode) { + return isDarkMode ? Colors.grey[400]! : Colors.grey[600]!; + } + + /// 获取卡片阴影 + static List getCardShadow(bool isDarkMode) { + return [ + BoxShadow( + color: isDarkMode + ? Colors.black.withValues(alpha: 0.2) + : Colors.black.withValues(alpha: 0.05), + blurRadius: 10, + offset: const Offset(0, 4), + ), + ]; + } + + /// 获取按钮颜色 + static Color getButtonColor(bool isDarkMode) { + return isDarkMode ? const Color(0xFF0066CC) : Colors.blue; + } + + /// 获取带透明度的颜色 + static Color getColorWithAlpha(Color color, double alpha) { + return color.withValues(alpha: alpha); + } + + /// 获取禁用状态的颜色 + static Color getDisabledColor(Color color, bool isEnabled) { + return isEnabled ? color : color.withValues(alpha: 0.5); + } +} \ No newline at end of file diff --git a/lib/modules/meeting/views/bottomSheet/ai_bottom_sheet.dart b/lib/modules/meeting/views/bottomSheet/ai_bottom_sheet.dart index cdbb8633c..ecf83a2e7 100644 --- a/lib/modules/meeting/views/bottomSheet/ai_bottom_sheet.dart +++ b/lib/modules/meeting/views/bottomSheet/ai_bottom_sheet.dart @@ -292,8 +292,8 @@ class _AIBottomSheetState extends State { begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [ - const Color(0xFFab47bc).withOpacity(0.1), // 薰衣草紫 - const Color(0xFFec407a).withOpacity(0.2), // 品红 + const Color(0xFFab47bc).withValues(alpha: 0.1), // 薰衣草紫 + const Color(0xFFec407a).withValues(alpha: 0.2), // 品红 ], ), ), diff --git a/lib/modules/meeting/views/bottomSheet/edit_title_bottom_sheet.dart b/lib/modules/meeting/views/bottomSheet/edit_title_bottom_sheet.dart index 10c9ceb96..eab7f98a3 100644 --- a/lib/modules/meeting/views/bottomSheet/edit_title_bottom_sheet.dart +++ b/lib/modules/meeting/views/bottomSheet/edit_title_bottom_sheet.dart @@ -60,7 +60,7 @@ class EditTitleBottomSheet extends GetView { borderRadius: BorderRadius.circular(12.w), boxShadow: [ BoxShadow( - color: Colors.black.withOpacity(0.05), + color: Colors.black.withValues(alpha: 0.05), blurRadius: 10, offset: const Offset(0, 2), ), diff --git a/lib/modules/meeting/views/bottomSheet/filtrate_drawer.dart b/lib/modules/meeting/views/bottomSheet/filtrate_drawer.dart index 5a988ec5d..b9b8df66f 100644 --- a/lib/modules/meeting/views/bottomSheet/filtrate_drawer.dart +++ b/lib/modules/meeting/views/bottomSheet/filtrate_drawer.dart @@ -93,7 +93,7 @@ class _FiltrateDrawerState extends State { borderRadius: BorderRadius.circular(12.w), boxShadow: [ BoxShadow( - color: Colors.black.withOpacity(0.06), + color: Colors.black.withValues(alpha: 0.06), blurRadius: 10, offset: const Offset(0, 2), ), @@ -154,7 +154,7 @@ class _FiltrateDrawerState extends State { borderRadius: BorderRadius.circular(12.w), boxShadow: [ BoxShadow( - color: Colors.black.withOpacity(0.06), + color: Colors.black.withValues(alpha: 0.06), blurRadius: 10, offset: const Offset(0, 2), ), diff --git a/lib/modules/meeting/views/bottomSheet/import_audio_bottom_sheet.dart b/lib/modules/meeting/views/bottomSheet/import_audio_bottom_sheet.dart index e08864223..f62cf7944 100644 --- a/lib/modules/meeting/views/bottomSheet/import_audio_bottom_sheet.dart +++ b/lib/modules/meeting/views/bottomSheet/import_audio_bottom_sheet.dart @@ -10,6 +10,7 @@ class ImportAudioBottomSheet extends GetView { @override Widget build(BuildContext context) { + final isDarkMode = Theme.of(context).brightness == Brightness.dark; return Padding( padding: EdgeInsets.symmetric(horizontal: 12.w), child: Column( @@ -24,7 +25,7 @@ class ImportAudioBottomSheet extends GetView { '添加音频', style: TextStyle( fontSize: 16.sp, - color: Colors.black87, + color: isDarkMode ? Colors.white : Colors.black87, fontWeight: FontWeight.bold, ), ), @@ -34,7 +35,7 @@ class ImportAudioBottomSheet extends GetView { width: 26.w, height: 26.w, decoration: BoxDecoration( - color: Colors.white, + color: isDarkMode ? Colors.grey[800] : Colors.white, borderRadius: BorderRadius.circular(26.r), ), child: Icon( @@ -49,7 +50,7 @@ class ImportAudioBottomSheet extends GetView { ), Divider( height: 1, - color: Colors.grey[300], + color: isDarkMode ? Colors.grey[700] : Colors.grey[300], ), SizedBox(height: 16.w), _importAudioItem(Icons.mic, '现场录音', onTap: () async { @@ -95,7 +96,7 @@ class ImportAudioBottomSheet extends GetView { '支持导入单文件时长不超过5小时的音频', style: TextStyle( fontSize: 14.sp, - color: Colors.grey[600], + color: isDarkMode ? Colors.grey[400] : Colors.grey[600], ), ), ), @@ -110,14 +111,19 @@ class ImportAudioBottomSheet extends GetView { String title, { VoidCallback? onTap, }) { - return GestureDetector( + 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: Colors.grey[50]!.withOpacity(onTap != null ? 1 : 0.5), + 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( @@ -132,18 +138,22 @@ class ImportAudioBottomSheet extends GetView { title, style: TextStyle( fontSize: 14.sp, - color: Colors.black87.withOpacity(onTap != null ? 1 : 0.5), + 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.withOpacity(onTap != null ? 1 : 0.5), + color: Colors.grey.withValues(alpha: onTap != null ? 1 : 0.5), ), ], ), ), ); + }, + ); } } diff --git a/lib/modules/meeting/views/bottomSheet/more_bottom_sheet.dart b/lib/modules/meeting/views/bottomSheet/more_bottom_sheet.dart index 187f4bd7f..a02fff599 100644 --- a/lib/modules/meeting/views/bottomSheet/more_bottom_sheet.dart +++ b/lib/modules/meeting/views/bottomSheet/more_bottom_sheet.dart @@ -85,7 +85,7 @@ class _MoreBottomSheetState extends State { title, style: TextStyle( fontSize: 14.sp, - color: Colors.black87.withOpacity(onTap != null ? 1 : 0.5), + color: Colors.black87.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 980ef0807..d4db457b4 100644 --- a/lib/modules/meeting/views/bottomSheet/navigation_bar_bottom_sheet.dart +++ b/lib/modules/meeting/views/bottomSheet/navigation_bar_bottom_sheet.dart @@ -4,6 +4,7 @@ import 'package:get/get_navigation/src/extension_navigation.dart'; import 'package:get/state_manager.dart'; import '../../controllers/meeting_home_controller.dart'; +import '../../utils/meeting_ui_utils.dart'; class NavigationBarBottomSheet extends GetView { const NavigationBarBottomSheet({super.key}); @@ -15,12 +16,14 @@ class NavigationBarBottomSheet extends GetView { mainAxisSize: MainAxisSize.min, children: [ _buildItem( + context, // 传递 context 参数 '开始录音', Icons.mic_rounded, Colors.red, ), SizedBox(height: 15.w), _buildItem( + context, // 传递 context 参数 '导入音频', Icons.file_upload_outlined, Colors.deepPurple, @@ -36,7 +39,7 @@ class NavigationBarBottomSheet extends GetView { width: 45.w, height: 45.w, decoration: BoxDecoration( - color: Colors.black.withOpacity(0.8), + color: Colors.black.withValues(alpha: 0.8), borderRadius: BorderRadius.circular(50.w), ), child: const Icon(Icons.close, color: Colors.white), @@ -49,11 +52,14 @@ class NavigationBarBottomSheet extends GetView { } Widget _buildItem( + BuildContext context, // 添加 context 参数 String title, IconData icon, Color color, { Function()? onTap, }) { + final isDarkMode = + Theme.of(context).brightness == Brightness.dark; // 在方法内部获取 isDarkMode return GestureDetector( onTap: onTap, child: Container( @@ -61,7 +67,9 @@ class NavigationBarBottomSheet extends GetView { height: 60.w, padding: EdgeInsets.all(5.w), decoration: BoxDecoration( - color: Colors.white.withOpacity(onTap != null ? 1 : 0.5), + color: isDarkMode + ? Colors.grey[800]!.withValues(alpha: onTap != null ? 1 : 0.5) + : Colors.white.withValues(alpha: onTap != null ? 1 : 0.5), borderRadius: BorderRadius.circular(60.w), ), child: Row( @@ -71,12 +79,12 @@ class NavigationBarBottomSheet extends GetView { height: 46.w, margin: EdgeInsets.only(right: 5.w), decoration: BoxDecoration( - color: color.withOpacity(onTap != null ? 0.3 : 0.2), + color: color.withValues(alpha: onTap != null ? 0.3 : 0.2), borderRadius: BorderRadius.circular(60.w), ), child: Icon( icon, - color: color.withOpacity(onTap != null ? 1 : 0.5), + color: color.withValues(alpha: onTap != null ? 1 : 0.5), ), ), Expanded( @@ -84,7 +92,10 @@ class NavigationBarBottomSheet extends GetView { title, style: TextStyle( fontSize: 15.sp, - color: Colors.black87.withOpacity(onTap != null ? 1 : 0.5), + color: isDarkMode + ? Colors.white.withValues(alpha: onTap != null ? 1 : 0.5) + : Colors.black87 + .withValues(alpha: onTap != null ? 1 : 0.5), fontWeight: FontWeight.bold, ), ), diff --git a/lib/modules/meeting/views/bottomSheet/share_bottom_sheet.dart b/lib/modules/meeting/views/bottomSheet/share_bottom_sheet.dart index bd5b1f26f..8dd0b3cbe 100644 --- a/lib/modules/meeting/views/bottomSheet/share_bottom_sheet.dart +++ b/lib/modules/meeting/views/bottomSheet/share_bottom_sheet.dart @@ -245,7 +245,7 @@ class _ShareBottomSheetState extends State { title, style: TextStyle( fontSize: 14.sp, - color: Colors.black87.withOpacity(onTap != null ? 1 : 0.5), + color: Colors.black87.withValues(alpha: onTap != null ? 1 : 0.5), ), ), ), @@ -272,7 +272,7 @@ class _ShareBottomSheetState extends State { (value) => Get.snackbar( 'success'.tr, // 成功 '复制成功', - backgroundColor: Colors.blue.withOpacity(0.8), + backgroundColor: Colors.blue.withValues(alpha: 0.8), colorText: Colors.white, ), ); diff --git a/lib/modules/meeting/views/bottomSheet/statistics_bottom_sheet.dart b/lib/modules/meeting/views/bottomSheet/statistics_bottom_sheet.dart index 1926ea821..eed48af63 100644 --- a/lib/modules/meeting/views/bottomSheet/statistics_bottom_sheet.dart +++ b/lib/modules/meeting/views/bottomSheet/statistics_bottom_sheet.dart @@ -307,7 +307,7 @@ class _StatisticsBottomSheetState extends State { height: 70.w, padding: EdgeInsets.all(10.w), decoration: BoxDecoration( - color: color.withOpacity(0.2), + color: color.withValues(alpha: 0.2), borderRadius: BorderRadius.circular(8.w), ), child: Column( @@ -346,7 +346,7 @@ class _StatisticsBottomSheetState extends State { child: Container( height: 60.w, decoration: BoxDecoration( - color: color.withOpacity(0.1), + color: color.withValues(alpha: 0.1), borderRadius: BorderRadius.circular(16.w), ), child: Row( diff --git a/lib/modules/meeting/views/meeting_connect_view.dart b/lib/modules/meeting/views/meeting_connect_view.dart index 82c3e3d97..e56d0ab1f 100644 --- a/lib/modules/meeting/views/meeting_connect_view.dart +++ b/lib/modules/meeting/views/meeting_connect_view.dart @@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import '../controllers/meeting_connect_controller.dart'; +import '../utils/meeting_ui_utils.dart'; class MeetingConnectView extends GetView { const MeetingConnectView({super.key}); @@ -12,7 +13,7 @@ class MeetingConnectView extends GetView { final isDarkMode = Theme.of(context).brightness == Brightness.dark; return Scaffold( - backgroundColor: isDarkMode ? Colors.black : Colors.grey[50], + backgroundColor: MeetingUIUtils.getBackgroundColor(isDarkMode), appBar: _buildAppBar(isDarkMode), body: _buildBody(isDarkMode), ); @@ -105,34 +106,39 @@ class MeetingConnectView extends GetView { } Widget _button(String text, IconData icon, {Function()? onTap}) { - return GestureDetector( - onTap: onTap, - child: Container( - width: 150.w, - height: 42.w, - decoration: BoxDecoration( - color: Colors.black, - borderRadius: BorderRadius.circular(42.w), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - icon, - color: Colors.white, - size: 20.sp, + return Builder( + builder: (context) { + final isDarkMode = Theme.of(context).brightness == Brightness.dark; + return GestureDetector( + onTap: onTap, + child: Container( + width: 150.w, + height: 42.w, + decoration: BoxDecoration( + color: MeetingUIUtils.getButtonColor(isDarkMode), + borderRadius: BorderRadius.circular(42.w), ), - 5.horizontalSpace, - Text( - text, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + icon, + color: Colors.white, + size: 20.sp, + ), + 5.horizontalSpace, + Text( + text, + style: TextStyle( + color: Colors.white, + fontSize: 14.sp, + ), + ), + ], ), - ], - ), - ), + ), + ); + }, ); } } diff --git a/lib/modules/meeting/views/meeting_details_view.dart b/lib/modules/meeting/views/meeting_details_view.dart index 53ffb10bc..0d8ae4769 100644 --- a/lib/modules/meeting/views/meeting_details_view.dart +++ b/lib/modules/meeting/views/meeting_details_view.dart @@ -9,6 +9,7 @@ import 'package:lottie/lottie.dart'; import '../../../core/theme/app_colors.dart'; import '../controllers/meeting_details_controller.dart'; +import '../utils/meeting_ui_utils.dart'; import 'tabs/mind_map_tab.dart'; import 'bottomSheet/more_bottom_sheet.dart'; import 'tabs/overview_tab.dart'; @@ -26,7 +27,7 @@ class MeetingDetailsView extends GetView { return PopScope( onPopInvokedWithResult: controller.popInvokedWithResult, child: Scaffold( - backgroundColor: isDarkMode ? Colors.black : Colors.grey[50], + backgroundColor: MeetingUIUtils.getBackgroundColor(isDarkMode), appBar: _buildAppBar(context, isDarkMode), body: _buildBody(isDarkMode), ), @@ -40,7 +41,9 @@ class MeetingDetailsView extends GetView { child: Obx( () => AppBar( backgroundColor: - controller.isTop.value ? Colors.grey[50] : Colors.grey[200], + isDarkMode + ? (controller.isTop.value ? Colors.black : Colors.grey[900]) + : (controller.isTop.value ? Colors.grey[50] : Colors.grey[200]), surfaceTintColor: Colors.transparent, elevation: 0.5, leading: controller.isSpeakerText.value @@ -199,7 +202,7 @@ class MeetingDetailsView extends GetView { Get.bottomSheet( const ShareBottomSheet(), isScrollControlled: true, - backgroundColor: Colors.grey[100], + backgroundColor: isDarkMode ? Colors.grey[800] : Colors.grey[100], shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(12.r), @@ -231,7 +234,7 @@ class MeetingDetailsView extends GetView { Get.bottomSheet( const MoreBottomSheet(), isScrollControlled: true, - backgroundColor: Colors.grey[100], + backgroundColor: isDarkMode ? Colors.grey[800] : Colors.grey[100], shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(12.r), @@ -360,24 +363,29 @@ class MeetingDetailsView extends GetView { } Widget _meetingWait(String title) { - return Stack( - alignment: Alignment.topCenter, - children: [ - Lottie.asset( - 'assets/lottie/meeting_wait.json', - ), - Positioned( - top: 320.w, - child: Text( - title, - style: TextStyle( - fontSize: 18.sp, - color: Colors.black87, - fontWeight: FontWeight.w500, + return Builder( + builder: (context) { + final isDarkMode = Theme.of(context).brightness == Brightness.dark; + return Stack( + alignment: Alignment.topCenter, + children: [ + Lottie.asset( + 'assets/lottie/meeting_wait.json', ), - ), - ), - ], + Positioned( + top: 320.w, + child: Text( + title, + style: TextStyle( + fontSize: 18.sp, + color: isDarkMode ? Colors.white : Colors.black87, + fontWeight: FontWeight.w500, + ), + ), + ), + ], + ); + }, ); } @@ -400,7 +408,7 @@ class MeetingDetailsView extends GetView { height: 200.w, margin: EdgeInsets.only(bottom: 10.w), decoration: BoxDecoration( - color: Colors.grey[200]!, + color: isDarkMode ? Colors.grey[900]! : Colors.grey[200]!, borderRadius: BorderRadius.vertical( bottom: Radius.circular(20.r), ), @@ -410,7 +418,7 @@ class MeetingDetailsView extends GetView { Container( margin: EdgeInsets.only(bottom: 5.w), decoration: BoxDecoration( - color: Colors.white, + color: isDarkMode ? Colors.grey[800] : Colors.white, borderRadius: BorderRadius.circular(8.r), ), child: AudioFileWaveforms( diff --git a/lib/modules/meeting/views/meeting_home_view.dart b/lib/modules/meeting/views/meeting_home_view.dart index 519273713..712078790 100644 --- a/lib/modules/meeting/views/meeting_home_view.dart +++ b/lib/modules/meeting/views/meeting_home_view.dart @@ -8,6 +8,7 @@ import '../../../core/theme/app_colors.dart'; import '../../../routes/app_routes.dart'; 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'; @@ -33,7 +34,7 @@ class _MeetingHomeViewState extends State return PopScope( onPopInvokedWithResult: _controller.onPopInvokedWithResult, child: Scaffold( - backgroundColor: isDarkMode ? Colors.black : Colors.grey[100], + backgroundColor: MeetingUIUtils.getBackgroundColor(isDarkMode), appBar: _buildAppBar(isDarkMode), body: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -56,7 +57,7 @@ class _MeetingHomeViewState extends State Get.bottomSheet( const ImportAudioBottomSheet(), isScrollControlled: true, - backgroundColor: Colors.grey[100], + backgroundColor: isDarkMode ? Colors.grey[800] : Colors.grey[100], shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(12.r), @@ -86,17 +87,11 @@ class _MeetingHomeViewState extends State vertical: 10.w, ), decoration: BoxDecoration( - color: isDarkMode ? Colors.white.withOpacity(0.05) : Colors.white, + color: isDarkMode + ? MeetingUIUtils.getTranslucentWhite(0.05) + : MeetingUIUtils.getCardColor(isDarkMode), borderRadius: BorderRadius.circular(12.w), - boxShadow: [ - BoxShadow( - color: isDarkMode - ? Colors.black.withOpacity(0.2) - : Colors.black.withOpacity(0.05), - blurRadius: 10, - offset: const Offset(0, 2), - ), - ], + boxShadow: MeetingUIUtils.getCardShadow(isDarkMode), ), child: Icon( Icons.format_list_bulleted, @@ -132,17 +127,11 @@ class _MeetingHomeViewState extends State vertical: 10.w, ), decoration: BoxDecoration( - color: isDarkMode ? Colors.white.withOpacity(0.05) : Colors.white, + color: isDarkMode + ? MeetingUIUtils.getTranslucentWhite(0.05) + : MeetingUIUtils.getCardColor(isDarkMode), borderRadius: BorderRadius.circular(50.w), - boxShadow: [ - BoxShadow( - color: isDarkMode - ? Colors.black.withOpacity(0.2) - : Colors.black.withOpacity(0.05), - blurRadius: 10, - offset: const Offset(0, 2), - ), - ], + boxShadow: MeetingUIUtils.getCardShadow(isDarkMode), ), child: Row( mainAxisSize: MainAxisSize.min, @@ -151,7 +140,7 @@ class _MeetingHomeViewState extends State width: 32.w, height: 32.w, decoration: BoxDecoration( - color: Colors.black, + color: MeetingUIUtils.getButtonColor(isDarkMode), borderRadius: BorderRadius.circular(50.w), ), child: Icon( @@ -231,17 +220,11 @@ class _MeetingHomeViewState extends State padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.w), margin: EdgeInsets.symmetric(vertical: 5.w), decoration: BoxDecoration( - color: isDarkMode ? Colors.white.withOpacity(0.05) : Colors.white, + color: isDarkMode + ? MeetingUIUtils.getTranslucentWhite(0.05) + : MeetingUIUtils.getCardColor(isDarkMode), borderRadius: BorderRadius.circular(12.w), - boxShadow: [ - BoxShadow( - color: isDarkMode - ? Colors.black.withOpacity(0.2) - : Colors.black.withOpacity(0.05), - blurRadius: 10, - offset: const Offset(0, 2), - ), - ], + boxShadow: MeetingUIUtils.getCardShadow(isDarkMode), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -249,7 +232,7 @@ class _MeetingHomeViewState extends State Text( data.title, style: TextStyle( - color: isDarkMode ? Colors.white : Colors.black87, + color: MeetingUIUtils.getTextColor(isDarkMode), fontSize: 18.sp, ), overflow: TextOverflow.ellipsis, @@ -422,7 +405,7 @@ class _MeetingHomeViewState extends State Get.bottomSheet( EditTitleBottomSheet(data.id), isScrollControlled: true, - backgroundColor: Colors.grey[100], + backgroundColor: isDarkMode ? Colors.grey[800] : Colors.grey[100], shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(12.r), diff --git a/lib/modules/meeting/views/meeting_mine_view.dart b/lib/modules/meeting/views/meeting_mine_view.dart index 6a7549973..de5e9e955 100644 --- a/lib/modules/meeting/views/meeting_mine_view.dart +++ b/lib/modules/meeting/views/meeting_mine_view.dart @@ -5,6 +5,7 @@ import '../../../routes/app_routes.dart'; import '../../profile/views/unified_avatar.dart'; import '../controllers/meeting_mine_controller.dart'; +import '../utils/meeting_ui_utils.dart'; import 'bottomSheet/statistics_bottom_sheet.dart'; class MeetingMineView extends StatefulWidget { @@ -21,11 +22,14 @@ class _MeetingMineViewState extends State @override bool get wantKeepAlive => true; + // 添加 isDarkMode 作为类的 getter + bool get isDarkMode => Theme.of(context).brightness == Brightness.dark; + @override Widget build(BuildContext context) { super.build(context); return Scaffold( - backgroundColor: Colors.grey[100], + backgroundColor: MeetingUIUtils.getBackgroundColor(isDarkMode), body: Container( decoration: const BoxDecoration( image: DecorationImage( @@ -121,7 +125,7 @@ class _MeetingMineViewState extends State backgroundColor: Colors.grey[200], iconColor: Colors.grey[600], iconSize: 25.r, - isDarkMode: false, + isDarkMode: isDarkMode, ), ), Expanded( @@ -129,7 +133,7 @@ class _MeetingMineViewState extends State () => Text( _controller.profileCtrl.userInfo.value.name, style: TextStyle( - color: Colors.black87, + color: isDarkMode ? Colors.white : Colors.black87, fontSize: 20.sp, fontWeight: FontWeight.bold, ), @@ -159,8 +163,9 @@ class _MeetingMineViewState extends State padding: EdgeInsets.all(8.w), margin: EdgeInsets.only(bottom: 15.w), decoration: BoxDecoration( - color: Colors.white, + color: MeetingUIUtils.getCardColor(isDarkMode), borderRadius: BorderRadius.circular(16.w), + boxShadow: MeetingUIUtils.getCardShadow(isDarkMode), ), child: Obx( () => Column( @@ -234,7 +239,7 @@ class _MeetingMineViewState extends State margin: EdgeInsets.symmetric(horizontal: 2.w), alignment: Alignment.center, decoration: BoxDecoration( - color: color.withOpacity(0.2), + color: color.withValues(alpha: 0.2), borderRadius: BorderRadius.circular(8.w), ), child: Row( @@ -245,7 +250,7 @@ class _MeetingMineViewState extends State amount, style: TextStyle( height: 0.1, - color: Colors.black87, + color: isDarkMode ? Colors.white : Colors.black87, fontSize: 16.sp, fontWeight: FontWeight.bold, ), @@ -269,7 +274,7 @@ class _MeetingMineViewState extends State return Container( margin: EdgeInsets.only(bottom: 15.w), decoration: BoxDecoration( - color: Colors.white, + color: MeetingUIUtils.getCardColor(isDarkMode), borderRadius: BorderRadius.circular(16.w), ), child: Column( @@ -282,7 +287,7 @@ class _MeetingMineViewState extends State Text( 'DEAPSOUND AI会员', style: TextStyle( - color: Colors.black87, + color: MeetingUIUtils.getTextColor(isDarkMode), fontSize: 16.sp, ), ), @@ -373,8 +378,9 @@ class _MeetingMineViewState extends State padding: EdgeInsets.symmetric(vertical: 5.w), margin: EdgeInsets.only(bottom: 15.w), decoration: BoxDecoration( - color: Colors.white, + color: MeetingUIUtils.getCardColor(isDarkMode), borderRadius: BorderRadius.circular(16.w), + boxShadow: MeetingUIUtils.getCardShadow(isDarkMode), ), child: Column( children: children, @@ -397,14 +403,14 @@ class _MeetingMineViewState extends State Icon( icon, size: 24.w, - color: Colors.grey, + color: isDarkMode ? Colors.grey[400] : Colors.grey, ), 8.horizontalSpace, Expanded( child: Text( title, style: TextStyle( - color: Colors.black87, + color: isDarkMode ? Colors.white : Colors.black87, fontSize: 16.sp, ), ), @@ -423,7 +429,7 @@ class _MeetingMineViewState extends State Icon( Icons.arrow_forward_ios, size: 16.w, - color: Colors.grey, + color: isDarkMode ? Colors.grey[400] : Colors.grey, ), ], ), diff --git a/lib/modules/meeting/views/meeting_view.dart b/lib/modules/meeting/views/meeting_view.dart index 3ff7508bf..045a92721 100644 --- a/lib/modules/meeting/views/meeting_view.dart +++ b/lib/modules/meeting/views/meeting_view.dart @@ -5,6 +5,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import '../controllers/meeting_controller.dart'; +import '../utils/meeting_ui_utils.dart'; import 'bottomSheet/filtrate_drawer.dart'; import 'bottomSheet/navigation_bar_bottom_sheet.dart'; @@ -13,8 +14,11 @@ class MeetingView extends GetView { @override Widget build(BuildContext context) { + final isDarkMode = Theme.of(context).brightness == Brightness.dark; + return Scaffold( key: controller.scaffoldKey, + backgroundColor: MeetingUIUtils.getBackgroundColor(isDarkMode), body: PageView( physics: const NeverScrollableScrollPhysics(), controller: controller.pageController, @@ -22,7 +26,7 @@ class MeetingView extends GetView { ), drawer: Drawer( width: 260.w, - backgroundColor: Colors.grey[50], + backgroundColor: isDarkMode ? const Color(0xFF1A1A1A) : Colors.grey[50], child: const FiltrateDrawer(), ), drawerEnableOpenDragGesture: false, @@ -48,10 +52,10 @@ class MeetingView extends GetView { label: '我的', ), ], - backgroundColor: Colors.white, + backgroundColor: isDarkMode ? const Color(0xFF1A1A1A) : Colors.white, currentIndex: controller.pageIndex.value, unselectedItemColor: Colors.grey, - selectedItemColor: Colors.red, + selectedItemColor: isDarkMode ? Colors.white : Colors.blue, unselectedFontSize: 10.sp, selectedFontSize: 10.sp, onTap: (int index) { @@ -84,13 +88,20 @@ class MeetingView extends GetView { padding: EdgeInsets.all(5.w), alignment: Alignment.center, decoration: BoxDecoration( - color: Colors.white, + 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: Colors.red, + color: MeetingUIUtils.getButtonColor(isDarkMode), borderRadius: BorderRadius.circular(60.w), ), child: Icon( diff --git a/lib/modules/meeting/views/tabs/overview_tab.dart b/lib/modules/meeting/views/tabs/overview_tab.dart index 68c441135..ca5f016bb 100644 --- a/lib/modules/meeting/views/tabs/overview_tab.dart +++ b/lib/modules/meeting/views/tabs/overview_tab.dart @@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import '../../controllers/meeting_details_controller.dart'; +import '../../utils/meeting_ui_utils.dart'; import '../bottomSheet/ai_bottom_sheet.dart'; import '../bottomSheet/generate_bottom_sheet.dart'; @@ -29,6 +30,7 @@ class _OverviewTabState extends State { @override Widget build(BuildContext context) { + final isDarkMode = Theme.of(context).brightness == Brightness.dark; return Stack( children: [ _dataList.isNotEmpty @@ -43,7 +45,7 @@ class _OverviewTabState extends State { format: DateFormats.y_mo_d_h_m, ), style: TextStyle( - color: Colors.black54, + color: isDarkMode ? Colors.grey[400] : Colors.black54, fontSize: 12.sp, ), ), @@ -55,6 +57,7 @@ class _OverviewTabState extends State { style: TextStyle( fontSize: 20.sp, fontWeight: FontWeight.bold, + color: isDarkMode ? Colors.white : Colors.black, ), ), ), @@ -62,7 +65,7 @@ class _OverviewTabState extends State { padding: EdgeInsets.symmetric(vertical: 10.w), child: Divider( height: 1, - color: Colors.grey[300], + color: isDarkMode ? Colors.grey[700] : Colors.grey[300], ), ), Padding( @@ -70,7 +73,7 @@ class _OverviewTabState extends State { child: Text( '分析出${_dataList.length}个关键事件。', style: TextStyle( - color: Colors.grey, + color: isDarkMode ? Colors.grey[400] : Colors.grey, fontSize: 12.sp, ), ), @@ -103,7 +106,7 @@ class _OverviewTabState extends State { Get.bottomSheet( const AIBottomSheet(), isScrollControlled: true, - backgroundColor: Colors.white, + backgroundColor: isDarkMode ? Colors.grey[800] : Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(12.r), @@ -122,7 +125,7 @@ class _OverviewTabState extends State { Get.bottomSheet( const GenerateBottomSheet(), isScrollControlled: true, - backgroundColor: Colors.grey[100], + backgroundColor: isDarkMode ? Colors.grey[800] : Colors.grey[100], shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(12.r), @@ -141,22 +144,21 @@ class _OverviewTabState extends State { } Widget _item(String data) { + final isDarkMode = Theme.of(context).brightness == Brightness.dark; return Container( padding: EdgeInsets.all(10.w), margin: EdgeInsets.symmetric(vertical: 5.w), decoration: BoxDecoration( - color: Colors.white, + color: MeetingUIUtils.getCardColor(isDarkMode), borderRadius: BorderRadius.circular(12.w), - boxShadow: const [ - BoxShadow( - color: Color(0x1A3045C8), - offset: Offset(0.0, 0.0), - blurRadius: 10, - spreadRadius: 0.0, - ), - ], + boxShadow: MeetingUIUtils.getCardShadow(isDarkMode), + ), + child: Text( + data, + style: TextStyle( + color: MeetingUIUtils.getTextColor(isDarkMode), + ), ), - child: Text(data), ); } @@ -194,6 +196,7 @@ class _OverviewTabState extends State { } Widget _empty() { + final isDarkMode = Theme.of(context).brightness == Brightness.dark; return Padding( padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 30.w), child: Column( @@ -202,14 +205,14 @@ class _OverviewTabState extends State { padding: EdgeInsets.only(bottom: 10.w), child: Icon( Icons.summarize, - color: Colors.grey, + color: isDarkMode ? Colors.grey[400] : Colors.grey, size: 40.sp, ), ), Text( '概览', style: TextStyle( - color: Colors.black87, + color: MeetingUIUtils.getTextColor(isDarkMode), fontSize: 18.sp, fontWeight: FontWeight.bold, ), @@ -217,7 +220,7 @@ class _OverviewTabState extends State { Text( 'AI分析识别录音中的关键事件,让你选择重要事件进行AI生成。', style: TextStyle( - color: Colors.grey, + color: MeetingUIUtils.getSecondaryTextColor(isDarkMode), fontSize: 14.sp, ), textAlign: TextAlign.center, diff --git a/lib/modules/meeting/views/tabs/speech_tab.dart b/lib/modules/meeting/views/tabs/speech_tab.dart index a2c730c9f..d0f2fa9ea 100644 --- a/lib/modules/meeting/views/tabs/speech_tab.dart +++ b/lib/modules/meeting/views/tabs/speech_tab.dart @@ -5,6 +5,7 @@ import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; import '../../controllers/meeting_details_controller.dart'; +import '../../utils/meeting_ui_utils.dart'; import '../bottomSheet/ai_bottom_sheet.dart'; import '../bottomSheet/generate_bottom_sheet.dart'; import '../bottomSheet/speaker_all_bottom_sheet.dart'; @@ -15,6 +16,7 @@ class SpeechTab extends GetView { @override Widget build(BuildContext context) { + final isDarkMode = Theme.of(context).brightness == Brightness.dark; return Stack( children: [ Obx( @@ -25,7 +27,7 @@ class SpeechTab extends GetView { Map item = controller.textList[index]; TextStyle textStyle = TextStyle( fontSize: 15.sp, - color: Colors.black87, + color: MeetingUIUtils.getTextColor(isDarkMode), letterSpacing: 0, height: 1.4, ); @@ -56,7 +58,7 @@ class SpeechTab extends GetView { Get.bottomSheet( SpeakerBottomSheet(item['id'], item['speaker']), isScrollControlled: true, - backgroundColor: Colors.grey[100], + backgroundColor: isDarkMode ? Colors.grey[800] : Colors.grey[100], shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(12.r), @@ -82,7 +84,7 @@ class SpeechTab extends GetView { isUtc: true, ), style: TextStyle( - color: Colors.grey, + color: MeetingUIUtils.getSecondaryTextColor(isDarkMode), fontSize: 13.sp, ), ), @@ -227,7 +229,7 @@ class SpeechTab extends GetView { item['content'], style: TextStyle( fontSize: 15.sp, - color: isActive ? Colors.red : Colors.black87, + color: isActive ? Colors.red : MeetingUIUtils.getTextColor(isDarkMode), letterSpacing: 0, height: 1.4, ), @@ -270,7 +272,7 @@ class SpeechTab extends GetView { Get.bottomSheet( const SpeakerAllBottomSheet(), isScrollControlled: true, - backgroundColor: Colors.grey[100], + backgroundColor: isDarkMode ? Colors.grey[800] : Colors.grey[100], shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(12.r), @@ -288,7 +290,7 @@ class SpeechTab extends GetView { Get.bottomSheet( const AIBottomSheet(), isScrollControlled: true, - backgroundColor: Colors.white, + backgroundColor: isDarkMode ? Colors.grey[800] : Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(12.r), @@ -307,7 +309,7 @@ class SpeechTab extends GetView { Get.bottomSheet( const GenerateBottomSheet(), isScrollControlled: true, - backgroundColor: Colors.grey[100], + backgroundColor: isDarkMode ? Colors.grey[800] : Colors.grey[100], shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(12.r), diff --git a/lib/modules/meeting/views/tabs/summary_tab.dart b/lib/modules/meeting/views/tabs/summary_tab.dart index d9f35d6d7..bd24e8c4f 100644 --- a/lib/modules/meeting/views/tabs/summary_tab.dart +++ b/lib/modules/meeting/views/tabs/summary_tab.dart @@ -248,7 +248,7 @@ class _SummaryTabState extends State { left: BorderSide( width: 2, color: isDarkMode - ? Colors.white.withOpacity(0.1) + ? Colors.white.withValues(alpha: 0.1) : Colors.grey[300]!, ), ), @@ -351,7 +351,7 @@ class _SummaryTabState extends State { Get.bottomSheet( const SpeakerAllBottomSheet(), isScrollControlled: true, - backgroundColor: Colors.grey[100], + backgroundColor: isDarkMode ? Colors.grey[800] : Colors.grey[100], shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(12.r), @@ -368,7 +368,7 @@ class _SummaryTabState extends State { Get.bottomSheet( const AIBottomSheet(), isScrollControlled: true, - backgroundColor: Colors.white, + backgroundColor: isDarkMode ? Colors.grey[800] : Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(12.r), @@ -387,7 +387,7 @@ class _SummaryTabState extends State { Get.bottomSheet( const GenerateBottomSheet(), isScrollControlled: true, - backgroundColor: Colors.grey[100], + backgroundColor: isDarkMode ? Colors.grey[800] : Colors.grey[100], shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(12.r), @@ -408,7 +408,7 @@ class _SummaryTabState extends State { right: -12.w, child: Container( height: 40, - color: Colors.white, + color: isDarkMode ? Colors.grey[800] : Colors.white, alignment: Alignment.center, child: FleatherToolbar.basic( controller: _fleatherController!,