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 @override
void onClose() { void onClose() {
searchController.dispose(); searchController.dispose();

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

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

Loading…
Cancel
Save