4 changed files with 158 additions and 26 deletions
@ -1,17 +1,10 @@ |
|||
import 'package:get/get.dart'; |
|||
import '../controllers/chat_controller.dart'; |
|||
import '../../../data/services/speech_impl/azure_asr_service.dart'; |
|||
import '../../../data/services/speech_impl/azure_tts_service.dart'; |
|||
import '../../../data/services/asr_service.dart'; |
|||
import '../../../data/services/tts_service.dart'; |
|||
import '../../../data/services/volcano_ai_service.dart'; |
|||
import '../../../data/services/chat_history_service.dart'; |
|||
|
|||
class ChatBinding extends Bindings { |
|||
@override |
|||
void dependencies() { |
|||
|
|||
// 注册控制器 |
|||
Get.lazyPut<ChatController>(() => ChatController()); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,90 @@ |
|||
import 'package:flutter/material.dart'; |
|||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|||
import 'package:get/get.dart'; |
|||
|
|||
import '../controllers/chat_controller.dart'; |
|||
|
|||
class ChatMusicCard extends GetView<ChatController> { |
|||
final Map? data; |
|||
final bool isDarkMode; |
|||
|
|||
const ChatMusicCard(this.data, this.isDarkMode, {super.key}); |
|||
|
|||
@override |
|||
Widget build(BuildContext context) { |
|||
final Map musiccards = data?['musiccards'].first; |
|||
final Map musicaudio = data?['musicaudio']; |
|||
|
|||
return Row( |
|||
children: [ |
|||
Container( |
|||
width: 60.w, |
|||
height: 60.w, |
|||
clipBehavior: Clip.hardEdge, |
|||
decoration: BoxDecoration( |
|||
borderRadius: BorderRadius.circular(6.r), |
|||
), |
|||
child: Image.network( |
|||
musiccards['image'], |
|||
fit: BoxFit.cover, |
|||
), |
|||
), |
|||
10.horizontalSpace, |
|||
Expanded( |
|||
child: Text( |
|||
musiccards['name'], |
|||
overflow: TextOverflow.ellipsis, |
|||
style: TextStyle( |
|||
color: isDarkMode ? Colors.white : Colors.black, |
|||
fontSize: 16.sp, |
|||
height: 1.5, |
|||
), |
|||
), |
|||
), |
|||
10.horizontalSpace, |
|||
Obx( |
|||
() => controller.audiourl == musicaudio['audiourl'] && |
|||
controller.isPlay.value |
|||
? GestureDetector( |
|||
onTap: () { |
|||
controller.pause(); |
|||
}, |
|||
child: Container( |
|||
width: 38.w, |
|||
height: 38.w, |
|||
decoration: BoxDecoration( |
|||
shape: BoxShape.circle, |
|||
border: Border.all( |
|||
color: |
|||
isDarkMode ? Colors.grey[700]! : Colors.grey[300]!, |
|||
width: 2, |
|||
), |
|||
), |
|||
child: Icon( |
|||
Icons.pause_rounded, |
|||
color: isDarkMode ? Colors.white : Colors.black, |
|||
), |
|||
), |
|||
) |
|||
: GestureDetector( |
|||
onTap: () { |
|||
controller.play(musicaudio); |
|||
}, |
|||
child: Container( |
|||
width: 38.w, |
|||
height: 38.w, |
|||
decoration: BoxDecoration( |
|||
color: isDarkMode ? Colors.white : Colors.black, |
|||
shape: BoxShape.circle, |
|||
), |
|||
child: Icon( |
|||
Icons.play_arrow_rounded, |
|||
color: isDarkMode ? Colors.black : Colors.white, |
|||
), |
|||
), |
|||
), |
|||
), |
|||
], |
|||
); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue