Browse Source

fix: 在多个视图的Scaffold body中包裹SafeArea防止内容被状态栏遮挡

为多个视图的Scaffold body添加SafeArea包装,设置top: false以避免内容被系统状态栏遮挡,确保UI在不同设备上正确显示
newdev_shunjiawei
lxm 8 months ago
parent
commit
cd94daef52
  1. 81
      lib/modules/agent/views/agent_view.dart
  2. 5
      lib/modules/eq_settings/views/eq_settings_view.dart
  3. 5
      lib/modules/eq_settings/views/widgets/select_equalizer_widget.dart
  4. 5
      lib/modules/meeting/views/meeting_record_view.dart
  5. 5
      lib/modules/meeting/views/meeting_view.dart
  6. 5
      lib/modules/meeting/views/mine/meeting_member_view.dart
  7. 5
      lib/modules/meeting/views/mine/meeting_transcription_view.dart
  8. 5
      lib/modules/meeting/views/template/template_view.dart
  9. 5
      lib/modules/translation/views/translation_detail_view.dart
  10. 8
      lib/modules/translation/views/translation_history_view.dart
  11. 9
      lib/modules/translation/views/translation_list_view.dart
  12. 10
      lib/modules/translation/views/translation_view.dart

81
lib/modules/agent/views/agent_view.dart

@ -376,7 +376,9 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
), ),
], ],
), ),
body: Stack( body: SafeArea(
top: false,
child: Stack(
children: [ children: [
IntroStepBuilder( IntroStepBuilder(
group: 'ai', group: 'ai',
@ -429,8 +431,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
return _buildLoadMoreIndicator(); return _buildLoadMoreIndicator();
} }
final message = controller final message = controller.messages[
.messages[controller.messages.length - 1 - index]; controller.messages.length - 1 - index];
return index == 0 return index == 0
? IntroStepBuilder( ? IntroStepBuilder(
group: 'ai', group: 'ai',
@ -450,8 +452,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
milliseconds: 300)); milliseconds: 300));
controller controller
.noviceGuideService.aiStep++; .noviceGuideService.aiStep++;
Intro.of(Get.context!) Intro.of(Get.context!).start(
.start(group: 'ai', reset: true); group: 'ai', reset: true);
} }
}, },
onTap: () async { onTap: () async {
@ -463,8 +465,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
milliseconds: 300)); milliseconds: 300));
controller controller
.noviceGuideService.aiStep++; .noviceGuideService.aiStep++;
Intro.of(Get.context!) Intro.of(Get.context!).start(
.start(group: 'ai', reset: true); group: 'ai', reset: true);
} }
}, },
); );
@ -530,7 +532,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
// 输入区域 // 输入区域
Container( Container(
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h), padding:
EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: backgroundColor, color: backgroundColor,
boxShadow: [ boxShadow: [
@ -562,7 +565,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular(12.w), borderRadius: BorderRadius.circular(12.w),
child: Image.file( child: Image.file(
File(controller.selectedImagePath.value!), File(controller
.selectedImagePath.value!),
height: 150.h, height: 150.h,
width: double.infinity, width: double.infinity,
fit: BoxFit.cover, fit: BoxFit.cover,
@ -572,7 +576,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
top: 8.h, top: 8.h,
right: 8.w, right: 8.w,
child: GestureDetector( child: GestureDetector(
onTap: () => controller.clearImageInput(), onTap: () =>
controller.clearImageInput(),
child: Container( child: Container(
padding: EdgeInsets.all(4.w), padding: EdgeInsets.all(4.w),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -601,7 +606,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
context: context, context: context,
label: label:
'summarizeImageContent'.tr, //总结图片内容 'summarizeImageContent'.tr, //总结图片内容
onTap: () => controller.summarizeImage(), onTap: () =>
controller.summarizeImage(),
), ),
SizedBox(width: 8.w), SizedBox(width: 8.w),
_buildPromptChip( _buildPromptChip(
@ -753,8 +759,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
controller.noviceGuideService controller.noviceGuideService
.startAIGuide(); .startAIGuide();
}, },
builder: builder: (BuildContext context,
(BuildContext context, GlobalKey key) => GlobalKey key) =>
Container( Container(
key: key, key: key,
constraints: BoxConstraints( constraints: BoxConstraints(
@ -781,25 +787,28 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
), ),
child: Obx(() { child: Obx(() {
// 图片模式下使用更高的输入框 // 图片模式下使用更高的输入框
final isImageActive = final isImageActive = controller
controller.isImageInputActive.value; .isImageInputActive.value;
return TextField( return TextField(
focusNode: _textFocusNode, // 绑定焦点节点 focusNode: _textFocusNode, // 绑定焦点节点
controller: controller.textController, controller:
controller.textController,
maxLines: isImageActive maxLines: isImageActive
? 3 ? 3
: 5, // 设置合理的最大行数 : 5, // 设置合理的最大行数
minLines: isImageActive ? 2 : 1, minLines: isImageActive ? 2 : 1,
keyboardType: keyboardType: TextInputType
TextInputType.multiline, // 启用多行键盘 .multiline, // 启用多行键盘
textInputAction: textInputAction: TextInputAction
TextInputAction.newline, // 支持回车换行 .newline, // 支持回车换行
onTap: () { onTap: () {
// 当点击输入框时,如果'+'选项已展开,则收缩 // 当点击输入框时,如果'+'选项已展开,则收缩
if (controller if (controller
.isPlusOptionsExpanded.value) { .isPlusOptionsExpanded
controller.collapsePlusOptions(); .value) {
controller
.collapsePlusOptions();
} }
}, },
style: TextStyle( style: TextStyle(
@ -812,7 +821,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
hintText: isImageActive hintText: isImageActive
? 'addQuestionAboutImage' ? 'addQuestionAboutImage'
.tr // 添加对图片的问题或描述... .tr // 添加对图片的问题或描述...
: 'inputMessage'.tr, // 输入消息... : 'inputMessage'
.tr, // 输入消息...
hintStyle: TextStyle( hintStyle: TextStyle(
color: Colors.grey[500], color: Colors.grey[500],
fontSize: 15.sp, fontSize: 15.sp,
@ -938,9 +948,11 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
fontSize: 14, fontSize: 14,
fontWeight: fontWeight:
FontWeight.w500, FontWeight.w500,
color: isPushToTalkActive color:
isPushToTalkActive
? Colors.blue ? Colors.blue
: Colors.grey[600], : Colors
.grey[600],
), ),
), ),
], ],
@ -978,11 +990,13 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
}, },
); );
}, },
builder: (BuildContext context, GlobalKey key) => builder:
(BuildContext context, GlobalKey key) =>
Obx( Obx(
key: key, key: key,
() { () {
final hasText = controller.hasTextInput.value; final hasText =
controller.hasTextInput.value;
final hasImage = final hasImage =
controller.isImageInputActive.value; controller.isImageInputActive.value;
final shouldShowSend = hasText || hasImage; final shouldShowSend = hasText || hasImage;
@ -1001,7 +1015,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
// 打开底部弹出编辑模式 // 打开底部弹出编辑模式
controller.openFullScreenEdit(); controller
.openFullScreenEdit();
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
@ -1038,7 +1053,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
), ),
// 发送按钮 // 发送按钮
GestureDetector( GestureDetector(
onTap: () => controller.sendMessage(), onTap: () =>
controller.sendMessage(),
child: Container( child: Container(
width: 44.w, width: 44.w,
height: 44.w, height: 44.w,
@ -1134,7 +1150,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
label: 'takePhoto'.tr, // 拍照 label: 'takePhoto'.tr, // 拍照
onTap: () async { onTap: () async {
//controller.collapsePlusOptions(); //controller.collapsePlusOptions();
await controller.takePhoto(); await controller
.takePhoto();
}, },
isDarkMode: isDarkMode, isDarkMode: isDarkMode,
), ),
@ -1145,7 +1162,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
label: 'photoAlbum'.tr, // 相册 label: 'photoAlbum'.tr, // 相册
onTap: () async { onTap: () async {
//controller.collapsePlusOptions(); //controller.collapsePlusOptions();
await controller.pickImage(); await controller
.pickImage();
}, },
isDarkMode: isDarkMode, isDarkMode: isDarkMode,
), ),
@ -1197,6 +1215,7 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
}), }),
], ],
), ),
),
); );
} }

5
lib/modules/eq_settings/views/eq_settings_view.dart

@ -14,7 +14,10 @@ class EqSettingsView extends GetView<EqSettingsController> {
return Scaffold( return Scaffold(
backgroundColor: isDarkMode ? Colors.black : Colors.grey[50], backgroundColor: isDarkMode ? Colors.black : Colors.grey[50],
appBar: _buildAppBar(isDarkMode), appBar: _buildAppBar(isDarkMode),
body: _buildBody(isDarkMode), body: SafeArea(
top: false,
child: _buildBody(isDarkMode),
),
); );
} }

5
lib/modules/eq_settings/views/widgets/select_equalizer_widget.dart

@ -41,7 +41,10 @@ class _SelectEqualizerWidgetState extends State<SelectEqualizerWidget> {
return Scaffold( return Scaffold(
backgroundColor: isDarkMode ? Colors.black : Colors.grey[50], backgroundColor: isDarkMode ? Colors.black : Colors.grey[50],
appBar: _buildAppBar(isDarkMode), appBar: _buildAppBar(isDarkMode),
body: _buildBody(isDarkMode), body: SafeArea(
top: false,
child: _buildBody(isDarkMode),
),
); );
} }

5
lib/modules/meeting/views/meeting_record_view.dart

@ -307,7 +307,9 @@ class MeetingRecordView extends GetView<MeetingRecordController> {
}), }),
], ],
), ),
body: Column( body: SafeArea(
top: false,
child: Column(
children: [ children: [
// 简化为单一音频界面,移除不必要的TabBar // 简化为单一音频界面,移除不必要的TabBar
Expanded( Expanded(
@ -316,6 +318,7 @@ class MeetingRecordView extends GetView<MeetingRecordController> {
], ],
), ),
), ),
),
); );
} }

5
lib/modules/meeting/views/meeting_view.dart

@ -35,7 +35,9 @@ class MeetingView extends GetView<MeetingController> {
left: 0, left: 0,
right: 0, right: 0,
child: Obx( child: Obx(
() => BottomNavigationBar( () => SafeArea(
top: false,
child: BottomNavigationBar(
items: [ items: [
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Icon(Icons.folder_outlined), icon: Icon(Icons.folder_outlined),
@ -74,6 +76,7 @@ class MeetingView extends GetView<MeetingController> {
), ),
), ),
), ),
),
Positioned( Positioned(
bottom: ScreenUtil().bottomBarHeight + 10, bottom: ScreenUtil().bottomBarHeight + 10,
child: GestureDetector( child: GestureDetector(

5
lib/modules/meeting/views/mine/meeting_member_view.dart

@ -24,7 +24,10 @@ class _MeetingMemberViewState extends State<MeetingMemberView> {
return Scaffold( return Scaffold(
backgroundColor: Colors.black, backgroundColor: Colors.black,
appBar: _buildAppBar(), appBar: _buildAppBar(),
body: _buildBody(), body: SafeArea(
top: false,
child: _buildBody(),
),
); );
} }

5
lib/modules/meeting/views/mine/meeting_transcription_view.dart

@ -18,7 +18,10 @@ class MeetingTranscriptionView extends GetView<MeetingHomeController> {
return Scaffold( return Scaffold(
backgroundColor: MeetingUIUtils.getBackgroundColor(isDarkMode), backgroundColor: MeetingUIUtils.getBackgroundColor(isDarkMode),
appBar: _buildAppBar(isDarkMode), appBar: _buildAppBar(isDarkMode),
body: _buildBody(isDarkMode), body: SafeArea(
top: false,
child: _buildBody(isDarkMode),
),
); );
} }

5
lib/modules/meeting/views/template/template_view.dart

@ -104,7 +104,10 @@ class _TemplateViewState extends State<TemplateView> {
return Scaffold( return Scaffold(
backgroundColor: isDarkMode ? Colors.black : Colors.grey[50], backgroundColor: isDarkMode ? Colors.black : Colors.grey[50],
appBar: _buildAppBar(isDarkMode), appBar: _buildAppBar(isDarkMode),
body: _buildBody(isDarkMode), body: SafeArea(
top: false,
child: _buildBody(isDarkMode),
),
); );
} }

5
lib/modules/translation/views/translation_detail_view.dart

@ -41,7 +41,9 @@ class TranslationDetailView extends GetView<TranslationDetailController> {
backgroundColor: backgroundColor:
isDarkMode ? AppColors.darkBackground : Color(0xFFF5F5F8), isDarkMode ? AppColors.darkBackground : Color(0xFFF5F5F8),
appBar: _buildAppBar(isDarkMode), appBar: _buildAppBar(isDarkMode),
body: Obx(() { body: SafeArea(
top: false,
child: Obx(() {
// 显示加载状态 // 显示加载状态
if (controller.isLoading.value) { if (controller.isLoading.value) {
return Center( return Center(
@ -58,6 +60,7 @@ class TranslationDetailView extends GetView<TranslationDetailController> {
], ],
); );
}), }),
),
); );
} }

8
lib/modules/translation/views/translation_history_view.dart

@ -23,7 +23,9 @@ class TranslationHistoryView
backgroundColor: backgroundColor:
isDarkMode ? AppColors.darkBackground : Color(0xFFF5F5F8), isDarkMode ? AppColors.darkBackground : Color(0xFFF5F5F8),
appBar: _buildAppBar(isDarkMode), appBar: _buildAppBar(isDarkMode),
body: Obx(() { body: SafeArea(
top: false,
child: Obx(() {
if (!controller.hasHistory) { if (!controller.hasHistory) {
return Center( return Center(
child: Text( child: Text(
@ -55,7 +57,8 @@ class TranslationHistoryView
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only(top: 24.h, bottom: 12.h, left: 12.w), padding:
EdgeInsets.only(top: 24.h, bottom: 12.h, left: 12.w),
child: Text( child: Text(
date, date,
style: TextStyle( style: TextStyle(
@ -72,6 +75,7 @@ class TranslationHistoryView
}, },
); );
}), }),
),
); );
} }

9
lib/modules/translation/views/translation_list_view.dart

@ -19,7 +19,10 @@ class TranslationListView extends GetView<TranslationListController> {
return Scaffold( return Scaffold(
backgroundColor: isDarkMode ? Colors.black : Colors.grey[50], backgroundColor: isDarkMode ? Colors.black : Colors.grey[50],
appBar: _buildAppBar(context, isDarkMode), appBar: _buildAppBar(context, isDarkMode),
body: _buildAudioList(context, isDarkMode), body: SafeArea(
top: false,
child: _buildAudioList(context, isDarkMode),
),
); );
} }
@ -216,7 +219,9 @@ class TranslationListView extends GetView<TranslationListController> {
// 播放状态文本 // 播放状态文本
Text( Text(
isCurrentFile isCurrentFile
? (isPlaying ? 'playing'.tr : 'paused'.tr) // 播放中... : 已暂停 ? (isPlaying
? 'playing'.tr
: 'paused'.tr) // 播放中... : 已暂停
: 'clickToPlay'.tr, // 点击播放 : 'clickToPlay'.tr, // 点击播放
style: TextStyle( style: TextStyle(
color: Colors.blue, color: Colors.blue,

10
lib/modules/translation/views/translation_view.dart

@ -54,7 +54,9 @@ class TranslationView extends GetView<TranslationController> {
backgroundColor: backgroundColor:
isDarkMode ? AppColors.darkBackground : Colors.grey[50], isDarkMode ? AppColors.darkBackground : Colors.grey[50],
appBar: _buildAppBar(isDarkMode), appBar: _buildAppBar(isDarkMode),
body: Stack( body: SafeArea(
top: false,
child: Stack(
children: [ children: [
_buildBody(isDarkMode), _buildBody(isDarkMode),
// 可拖拽的悬浮按钮 // 可拖拽的悬浮按钮
@ -64,6 +66,7 @@ class TranslationView extends GetView<TranslationController> {
// ), // ),
], ],
), ),
),
); );
}); });
} }
@ -72,7 +75,9 @@ class TranslationView extends GetView<TranslationController> {
Widget _buildFaceToFaceScaffold(bool isDarkMode) { Widget _buildFaceToFaceScaffold(bool isDarkMode) {
return Scaffold( return Scaffold(
backgroundColor: isDarkMode ? AppColors.darkBackground : Colors.grey[50], backgroundColor: isDarkMode ? AppColors.darkBackground : Colors.grey[50],
body: Stack( body: SafeArea(
top: false,
child: Stack(
children: [ children: [
// 主要内容区域 // 主要内容区域
FaceToFaceLayout( FaceToFaceLayout(
@ -131,6 +136,7 @@ class TranslationView extends GetView<TranslationController> {
// ), // ),
], ],
), ),
),
); );
} }

Loading…
Cancel
Save