Browse Source

refactor(探索): 重构探索页面布局并移除无用代码

- 将商务会议助手改为单行显示并移除用量统计区块
- 删除探索控制器中未使用的aiFeaturesWide列表和相关方法
- 统一使用onAIFeatureTap方法处理点击事件
weicu
lxm 10 months ago
parent
commit
fb399bb853
  1. 46
      lib/modules/explore/controllers/explore_controller.dart
  2. 31
      lib/modules/explore/views/explore_view.dart
  3. 6
      lib/modules/settings/views/settings_view.dart

46
lib/modules/explore/controllers/explore_controller.dart

@ -76,20 +76,6 @@ class ExploreController extends GetxController {
) )
]; ];
final List<AIFeature> aiFeaturesWide = [
AIFeature(
title: 'conferenceAssistant'.tr, // 商务会议助手
description: 'conferenceAssistantInfo'.tr, // 实时记录会议纪要,多语言翻译
icon: Icons.people,
startColor: const Color(0xFFab47bc),
endColor: const Color(0xFFec407a),
iconBgColor: const Color(0xFFd81b60).withOpacity(0.2),
iconColor: const Color(0xFFd81b60),
agentId: 'meeting_assistant',
targetRoute: Routes.meeting,
),
];
// 点击AI功能 // 点击AI功能
void onAIFeatureTap(int index) { void onAIFeatureTap(int index) {
if (index < 0 || index >= aiFeatures.length) return; if (index < 0 || index >= aiFeatures.length) return;
@ -100,36 +86,4 @@ class ExploreController extends GetxController {
// 根据目标路由进行跳转 // 根据目标路由进行跳转
Get.toNamed(feature.targetRoute); Get.toNamed(feature.targetRoute);
} }
// 点击AI功能(宽版本)
void onAIFeatureWideTap(int index) {
if (index < 0 || index >= aiFeaturesWide.length) return;
final feature = aiFeaturesWide[index];
// 直接根据目标路由进行跳转
if (feature.targetRoute == Routes.meeting) {
Get.toNamed(feature.targetRoute);
} else if (feature.targetRoute == Routes.chat) {
final agent = AgentProvider.getAgentById(feature.agentId);
if (agent != null) {
Get.toNamed(feature.targetRoute, arguments: {
'agentId': agent.id,
'agentName': agent.name,
'agentVoice': agent.voice,
'agentAvatar': agent.avatarUrl,
'agentSubtitle': agent.description,
'systemPrompt': agent.systemPrompt,
'welcomeMessage': agent.welcomeMessage,
});
}
} else if (feature.targetRoute.isNotEmpty) {
Get.toNamed(feature.targetRoute);
}
}
// 跳转到用量统计页面
void goToUsageStats() {
Get.toNamed(Routes.usageStats);
}
} }

31
lib/modules/explore/views/explore_view.dart

@ -261,36 +261,15 @@ class ExploreView extends GetView<ExploreController> {
SizedBox(height: 16.h), SizedBox(height: 16.h),
// 下层:商务会议助手+用量统计 // 下层:商务会议助手(占据一行)
Row( AspectRatio(
children: [ aspectRatio: 2.0, // 正方形
// 左下角:商务会议助手 child: _buildAIFeatureItemWide(
Expanded(
child: AspectRatio(
aspectRatio: 1.0, // 正方形
child: _buildAIFeatureItem(
controller.aiFeatures[2], controller.aiFeatures[2],
2, 2,
isDarkMode, isDarkMode,
), ),
), ),
),
SizedBox(width: 16.w),
// 右下角:用量统计
Expanded(
child: AspectRatio(
aspectRatio: 1.0, // 正方形
child: _buildAIFeatureItem(
controller.aiFeatures[3],
3,
isDarkMode,
),
),
),
],
),
], ],
), ),
], ],
@ -384,7 +363,7 @@ class ExploreView extends GetView<ExploreController> {
Widget _buildAIFeatureItemWide( Widget _buildAIFeatureItemWide(
AIFeature feature, int index, bool isDarkMode) { AIFeature feature, int index, bool isDarkMode) {
return GestureDetector( return GestureDetector(
onTap: () => controller.onAIFeatureWideTap(index), onTap: () => controller.onAIFeatureTap(index),
child: Container( child: Container(
padding: EdgeInsets.all(20.w), padding: EdgeInsets.all(20.w),
decoration: BoxDecoration( decoration: BoxDecoration(

6
lib/modules/settings/views/settings_view.dart

@ -290,14 +290,14 @@ class SettingsView extends GetView<SettingsController> {
onTap: () => Get.toNamed(Routes.goodsmeet), onTap: () => Get.toNamed(Routes.goodsmeet),
), ),
_buildCategoryItem( _buildCategoryItem(
icon: Icons.cloud, icon: Icons.analytics_outlined,
label: 'cloudSync'.tr, //云端同步 label: 'usageStats'.tr, //用量统计
iconBg: isDarkMode iconBg: isDarkMode
? Colors.teal[900]!.withOpacity(0.3) ? Colors.teal[900]!.withOpacity(0.3)
: Colors.teal[100]!, : Colors.teal[100]!,
iconColor: isDarkMode ? Colors.teal[300]! : Colors.teal[600]!, iconColor: isDarkMode ? Colors.teal[300]! : Colors.teal[600]!,
textColor: isDarkMode ? Colors.white : Colors.black87, textColor: isDarkMode ? Colors.white : Colors.black87,
onTap: () => {}, onTap: () => Get.toNamed(Routes.usageStats),
), ),
], ],
), ),

Loading…
Cancel
Save