Browse Source

Merge branch 'lxm' of https://github.com/deepcloud2048/deep_voice

newdev_shunjiawei
lxm 1 year ago
parent
commit
e6c2f3f3ae
  1. 25
      lib/modules/agent/controllers/agent_controller.dart
  2. 42
      lib/modules/agent/views/message_bubble.dart
  3. 12
      lib/modules/explore/controllers/explore_controller.dart
  4. 2
      lib/modules/explore/views/explore_view.dart
  5. 1
      pubspec.yaml

25
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),
),
),
),
),
);
}
}

42
lib/modules/agent/views/message_bubble.dart

@ -215,13 +215,20 @@ class MessageBubble extends GetView<AgentController> {
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<AgentController>()
.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<AgentController> {
),
),
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<AgentController>()
.openImageViewer(context, imagePath ?? '');
},
child: ClipRRect(
borderRadius: BorderRadius.circular(12),
child: Image.file(
File(imagePath!),
width: 200,
height: 200,
fit: BoxFit.cover,
),
),
),
],

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

@ -54,19 +54,19 @@ class ExploreController extends GetxController {
// AI功能列表
final List<AIFeature> 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);
}
}

2
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';

1
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:

Loading…
Cancel
Save