Browse Source

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

为多个视图的Scaffold body添加SafeArea包装,设置top: false以避免内容被系统状态栏遮挡,确保UI在不同设备上正确显示
weicu
lxm 8 months ago
parent
commit
5dc93ccb8e
  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: [
IntroStepBuilder(
group: 'ai',
@ -429,8 +431,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
return _buildLoadMoreIndicator();
}
final message = controller
.messages[controller.messages.length - 1 - index];
final message = controller.messages[
controller.messages.length - 1 - index];
return index == 0
? IntroStepBuilder(
group: 'ai',
@ -450,8 +452,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
milliseconds: 300));
controller
.noviceGuideService.aiStep++;
Intro.of(Get.context!)
.start(group: 'ai', reset: true);
Intro.of(Get.context!).start(
group: 'ai', reset: true);
}
},
onTap: () async {
@ -463,8 +465,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
milliseconds: 300));
controller
.noviceGuideService.aiStep++;
Intro.of(Get.context!)
.start(group: 'ai', reset: true);
Intro.of(Get.context!).start(
group: 'ai', reset: true);
}
},
);
@ -530,7 +532,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
// 输入区域
Container(
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
padding:
EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
decoration: BoxDecoration(
color: backgroundColor,
boxShadow: [
@ -562,7 +565,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
ClipRRect(
borderRadius: BorderRadius.circular(12.w),
child: Image.file(
File(controller.selectedImagePath.value!),
File(controller
.selectedImagePath.value!),
height: 150.h,
width: double.infinity,
fit: BoxFit.cover,
@ -572,7 +576,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
top: 8.h,
right: 8.w,
child: GestureDetector(
onTap: () => controller.clearImageInput(),
onTap: () =>
controller.clearImageInput(),
child: Container(
padding: EdgeInsets.all(4.w),
decoration: BoxDecoration(
@ -601,7 +606,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
context: context,
label:
'summarizeImageContent'.tr, //总结图片内容
onTap: () => controller.summarizeImage(),
onTap: () =>
controller.summarizeImage(),
),
SizedBox(width: 8.w),
_buildPromptChip(
@ -753,8 +759,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
controller.noviceGuideService
.startAIGuide();
},
builder:
(BuildContext context, GlobalKey key) =>
builder: (BuildContext context,
GlobalKey key) =>
Container(
key: key,
constraints: BoxConstraints(
@ -781,25 +787,28 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
),
child: Obx(() {
// 图片模式下使用更高的输入框
final isImageActive =
controller.isImageInputActive.value;
final isImageActive = controller
.isImageInputActive.value;
return TextField(
focusNode: _textFocusNode, // 绑定焦点节点
controller: controller.textController,
controller:
controller.textController,
maxLines: isImageActive
? 3
: 5, // 设置合理的最大行数
minLines: isImageActive ? 2 : 1,
keyboardType:
TextInputType.multiline, // 启用多行键盘
textInputAction:
TextInputAction.newline, // 支持回车换行
keyboardType: TextInputType
.multiline, // 启用多行键盘
textInputAction: TextInputAction
.newline, // 支持回车换行
onTap: () {
// 当点击输入框时,如果'+'选项已展开,则收缩
if (controller
.isPlusOptionsExpanded.value) {
controller.collapsePlusOptions();
.isPlusOptionsExpanded
.value) {
controller
.collapsePlusOptions();
}
},
style: TextStyle(
@ -812,7 +821,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
hintText: isImageActive
? 'addQuestionAboutImage'
.tr // 添加对图片的问题或描述...
: 'inputMessage'.tr, // 输入消息...
: 'inputMessage'
.tr, // 输入消息...
hintStyle: TextStyle(
color: Colors.grey[500],
fontSize: 15.sp,
@ -938,9 +948,11 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
fontSize: 14,
fontWeight:
FontWeight.w500,
color: isPushToTalkActive
color:
isPushToTalkActive
? 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(
key: key,
() {
final hasText = controller.hasTextInput.value;
final hasText =
controller.hasTextInput.value;
final hasImage =
controller.isImageInputActive.value;
final shouldShowSend = hasText || hasImage;
@ -1001,7 +1015,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
child: GestureDetector(
onTap: () {
// 打开底部弹出编辑模式
controller.openFullScreenEdit();
controller
.openFullScreenEdit();
showModalBottomSheet(
context: context,
isScrollControlled: true,
@ -1038,7 +1053,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
),
// 发送按钮
GestureDetector(
onTap: () => controller.sendMessage(),
onTap: () =>
controller.sendMessage(),
child: Container(
width: 44.w,
height: 44.w,
@ -1134,7 +1150,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
label: 'takePhoto'.tr, // 拍照
onTap: () async {
//controller.collapsePlusOptions();
await controller.takePhoto();
await controller
.takePhoto();
},
isDarkMode: isDarkMode,
),
@ -1145,7 +1162,8 @@ class _AgentViewState extends State<AgentView> with WidgetsBindingObserver {
label: 'photoAlbum'.tr, // 相册
onTap: () async {
//controller.collapsePlusOptions();
await controller.pickImage();
await controller
.pickImage();
},
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(
backgroundColor: isDarkMode ? Colors.black : Colors.grey[50],
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(
backgroundColor: isDarkMode ? Colors.black : Colors.grey[50],
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: [
// 简化为单一音频界面,移除不必要的TabBar
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,
right: 0,
child: Obx(
() => BottomNavigationBar(
() => SafeArea(
top: false,
child: BottomNavigationBar(
items: [
BottomNavigationBarItem(
icon: Icon(Icons.folder_outlined),
@ -74,6 +76,7 @@ class MeetingView extends GetView<MeetingController> {
),
),
),
),
Positioned(
bottom: ScreenUtil().bottomBarHeight + 10,
child: GestureDetector(

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

@ -24,7 +24,10 @@ class _MeetingMemberViewState extends State<MeetingMemberView> {
return Scaffold(
backgroundColor: Colors.black,
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(
backgroundColor: MeetingUIUtils.getBackgroundColor(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(
backgroundColor: isDarkMode ? Colors.black : Colors.grey[50],
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:
isDarkMode ? AppColors.darkBackground : Color(0xFFF5F5F8),
appBar: _buildAppBar(isDarkMode),
body: Obx(() {
body: SafeArea(
top: false,
child: Obx(() {
// 显示加载状态
if (controller.isLoading.value) {
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:
isDarkMode ? AppColors.darkBackground : Color(0xFFF5F5F8),
appBar: _buildAppBar(isDarkMode),
body: Obx(() {
body: SafeArea(
top: false,
child: Obx(() {
if (!controller.hasHistory) {
return Center(
child: Text(
@ -55,7 +57,8 @@ class TranslationHistoryView
crossAxisAlignment: CrossAxisAlignment.start,
children: [
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(
date,
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(
backgroundColor: isDarkMode ? Colors.black : Colors.grey[50],
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(
isCurrentFile
? (isPlaying ? 'playing'.tr : 'paused'.tr) // 播放中... : 已暂停
? (isPlaying
? 'playing'.tr
: 'paused'.tr) // 播放中... : 已暂停
: 'clickToPlay'.tr, // 点击播放
style: TextStyle(
color: Colors.blue,

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

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

Loading…
Cancel
Save