diff --git a/lib/modules/agent/controllers/agent_controller.dart b/lib/modules/agent/controllers/agent_controller.dart index 990daad8c..b2a387879 100644 --- a/lib/modules/agent/controllers/agent_controller.dart +++ b/lib/modules/agent/controllers/agent_controller.dart @@ -15,6 +15,7 @@ import 'package:permission_handler/permission_handler.dart'; import 'package:app_settings/app_settings.dart'; import 'package:deep_voice/core/utils/logger.dart'; import 'package:path_provider/path_provider.dart'; +import 'package:photo_view/photo_view.dart'; class Message { final bool isUser; //标识信息是否来自用户还是AI @@ -959,4 +960,28 @@ class AgentController extends GetxController { void openNavigation(String start, String end, String ntype) { _navigationManager.open(start, end, ntype); } + + // 打开图片查看器 + void openImageViewer(BuildContext context, String imagePath) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => Scaffold( + appBar: AppBar( + backgroundColor: Colors.black, + iconTheme: IconThemeData(color: Colors.white), + ), + body: Container( + color: Colors.black, + child: PhotoView( + imageProvider: FileImage(File(imagePath)), + minScale: PhotoViewComputedScale.contained, + maxScale: PhotoViewComputedScale.covered * 2, + backgroundDecoration: BoxDecoration(color: Colors.black), + ), + ), + ), + ), + ); + } } diff --git a/lib/modules/agent/views/message_bubble.dart b/lib/modules/agent/views/message_bubble.dart index 14964195b..94bbb5415 100644 --- a/lib/modules/agent/views/message_bubble.dart +++ b/lib/modules/agent/views/message_bubble.dart @@ -215,13 +215,20 @@ class MessageBubble extends GetView { if (message == '[图片]') { return Container( padding: const EdgeInsets.all(8), - child: ClipRRect( - borderRadius: BorderRadius.circular(12), - child: Image.file( - File(imagePath!), - width: 200, - height: 200, - fit: BoxFit.cover, + child: GestureDetector( + onTap: () { + // 点击图片时打开图片查看器 + Get.find() + .openImageViewer(context, imagePath ?? ''); + }, + child: ClipRRect( + borderRadius: BorderRadius.circular(12), + child: Image.file( + File(imagePath!), + width: 200, + height: 200, + fit: BoxFit.cover, + ), ), ), ); @@ -241,13 +248,20 @@ class MessageBubble extends GetView { ), ), const SizedBox(height: 8), - ClipRRect( - borderRadius: BorderRadius.circular(12), - child: Image.file( - File(imagePath!), - width: 200, - height: 200, - fit: BoxFit.cover, + GestureDetector( + onTap: () { + // 点击图片时打开图片查看器 + Get.find() + .openImageViewer(context, imagePath ?? ''); + }, + child: ClipRRect( + borderRadius: BorderRadius.circular(12), + child: Image.file( + File(imagePath!), + width: 200, + height: 200, + fit: BoxFit.cover, + ), ), ), ], diff --git a/lib/modules/explore/controllers/explore_controller.dart b/lib/modules/explore/controllers/explore_controller.dart index f250cc7e3..3d0af7ee9 100644 --- a/lib/modules/explore/controllers/explore_controller.dart +++ b/lib/modules/explore/controllers/explore_controller.dart @@ -54,19 +54,19 @@ class ExploreController extends GetxController { // AI功能列表 final List aiFeatures = [ AIFeature( - title: 'allRoundAssistant'.tr, // 全能助理 - description: 'allRoundAssistantInfo'.tr, // 帮你解决各类问题 + title: 'aiAssistant'.tr, // AI全能助手 + description: 'aiAssistantInfo'.tr, // 帮你解决各类问题 icon: Icons.assistant, startColor: const Color(0xFF0066CC), endColor: const Color(0xFF5E5CE6), iconBgColor: const Color(0xFF0066CC).withOpacity(0.2), iconColor: const Color(0xFF0066CC), agentId: 'personal_assistant', - targetRoute: Routes.chat, + targetRoute: Routes.agent, ), AIFeature( - title: 'simultaneousTranslation'.tr, // 同声翻译 - description: 'simultaneousTranslationInfo'.tr, // 实时翻译80+种语言 + title: 'simultaneousInterpretation'.tr, // 同声翻译 + description: 'simultaneousInterpretationInfo'.tr, // 实时翻译80+种语言 icon: Icons.translate, startColor: const Color(0xFF4CAF50), endColor: const Color(0xFF009688), @@ -175,6 +175,8 @@ class ExploreController extends GetxController { } else if (feature.targetRoute == Routes.translation) { // 跳转到翻译页面 Get.toNamed(feature.targetRoute); + } else if (feature.targetRoute == Routes.agent) { + Get.toNamed(feature.targetRoute); } } diff --git a/lib/modules/explore/views/explore_view.dart b/lib/modules/explore/views/explore_view.dart index df227549b..0f076f6e9 100644 --- a/lib/modules/explore/views/explore_view.dart +++ b/lib/modules/explore/views/explore_view.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'dart:ui'; +//import 'dart:ui'; import '../controllers/explore_controller.dart'; import '../../../core/widgets/common_bottom_nav.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index 640beb9e1..f32b631d5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -37,6 +37,7 @@ dependencies: file_picker: ^10.1.5 haptic_feedback: ^0.5.1+1 tencentcloud_cos_sdk_plugin: ^1.2.3 + photo_view: ^0.15.0 window_size: git: