Browse Source

feat(explore): 添加翻译统计页面跳转功能

- 在探索控制器中添加跳转到翻译统计页面的方法
- 将设置页面的翻译统计入口移动到探索页面
- 修改探索页面图标并绑定跳转事件
weicu
lxm 1 year ago
parent
commit
42a771db83
  1. 5
      lib/modules/explore/controllers/explore_controller.dart
  2. 72
      lib/modules/explore/views/explore_view.dart
  3. 23
      lib/modules/settings/views/settings_view.dart

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

@ -263,6 +263,11 @@ class ExploreController extends GetxController {
// 实际应用中,这里应该跳转到新功能页面
}
// 跳转到翻译统计页面
void goToTranslationStats() {
Get.toNamed(Routes.translationStats);
}
@override
void onClose() {
searchController.dispose();

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

@ -115,12 +115,12 @@ class ExploreView extends GetView<ExploreController> {
),
child: IconButton(
icon: Icon(
Icons.more_vert,
Icons.analytics_outlined,
size: 16.sp,
color: isDarkMode ? Colors.white : Colors.grey[700],
),
padding: EdgeInsets.zero,
onPressed: () {},
onPressed: controller.goToTranslationStats,
),
),
],
@ -419,37 +419,38 @@ class ExploreView extends GetView<ExploreController> {
//整行布局
Widget _buildAIFeaturesWideSection(bool isDarkMode) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Text(
// 'aiFunction'.tr, // AI功能
// style: TextStyle(
// fontSize: 18.sp,
// fontWeight: FontWeight.w600,
// color: isDarkMode ? Colors.white : Colors.grey[800],
// ),
// ),
// SizedBox(height: 16.h),
// 直接使用 Column 包裹宽版卡片
Column(
children: controller.aiFeaturesWide.map((feature) {
return Padding(
padding: EdgeInsets.only(bottom: 16.h), // 卡片间距
child: _buildAIFeatureItemWide(
feature,
controller.aiFeatures.indexOf(feature),
isDarkMode,
),
);
}).toList(),
),
],
);
}
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Text(
// 'aiFunction'.tr, // AI功能
// style: TextStyle(
// fontSize: 18.sp,
// fontWeight: FontWeight.w600,
// color: isDarkMode ? Colors.white : Colors.grey[800],
// ),
// ),
// SizedBox(height: 16.h),
// 直接使用 Column 包裹宽版卡片
Column(
children: controller.aiFeaturesWide.map((feature) {
return Padding(
padding: EdgeInsets.only(bottom: 16.h), // 卡片间距
child: _buildAIFeatureItemWide(
feature,
controller.aiFeatures.indexOf(feature),
isDarkMode,
),
);
}).toList(),
),
],
);
}
// AI功能项(宽版本,用于横跨整行的AI全能助手)
Widget _buildAIFeatureItemWide(AIFeature feature, int index, bool isDarkMode) {
// AI功能项(宽版本,用于横跨整行的AI全能助手)
Widget _buildAIFeatureItemWide(
AIFeature feature, int index, bool isDarkMode) {
return GestureDetector(
onTap: () => controller.onAIFeatureTap(index),
child: Container(
@ -529,7 +530,8 @@ class ExploreView extends GetView<ExploreController> {
}
// AI功能项(宽版本,专门用于商务会议助手)
Widget _buildAIFeatureItemWideForMeeting(AIFeature feature, int index, bool isDarkMode) {
Widget _buildAIFeatureItemWideForMeeting(
AIFeature feature, int index, bool isDarkMode) {
return GestureDetector(
onTap: () => controller.onAIFeatureWideTap(index),
child: Container(
@ -646,7 +648,9 @@ class ExploreView extends GetView<ExploreController> {
child: Container(
padding: EdgeInsets.all(16.w),
decoration: BoxDecoration(
color: isDarkMode ? Colors.white.withValues(alpha: 0.05) : Colors.grey[100],
color: isDarkMode
? Colors.white.withValues(alpha: 0.05)
: Colors.grey[100],
borderRadius: BorderRadius.circular(16.r),
boxShadow: [
BoxShadow(

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

@ -407,28 +407,7 @@ class SettingsView extends GetView<SettingsController> {
? Colors.white.withOpacity(0.1)
: Colors.grey[200]),
// 翻译统计
_buildSimpleNavigationSetting(
title: '翻译统计', // translationStats
subtitle: '查看翻译使用量和成本统计', // translationStatsInfo
icon: Icons.analytics_outlined,
iconBgColor: isDarkMode
? Colors.green[900]!.withOpacity(0.3)
: Colors.green[100]!,
iconColor:
isDarkMode ? Colors.green[300]! : Colors.green[600]!,
titleColor: isDarkMode ? Colors.white : null,
subtitleColor: isDarkMode ? Colors.white70 : null,
onTap: () {
Get.toNamed(Routes.translationStats);
},
isDarkMode: isDarkMode,
),
Divider(
height: 1,
color: isDarkMode
? Colors.white.withOpacity(0.1)
: Colors.grey[200]),
// 用户反馈
_buildSimpleNavigationSetting(

Loading…
Cancel
Save