37 changed files with 1638 additions and 322 deletions
|
After Width: | Height: | Size: 592 KiB |
|
After Width: | Height: | Size: 653 KiB |
|
After Width: | Height: | Size: 123 KiB |
|
After Width: | Height: | Size: 110 KiB |
@ -0,0 +1,8 @@ |
|||
/// AI回复服务接口 |
|||
abstract class AiService { |
|||
/// 流式输出方法 |
|||
Stream<String> sendMessageStream({ |
|||
required List<Map<String, String>> messages, |
|||
required String systemPrompt, |
|||
}); |
|||
} |
|||
@ -0,0 +1,71 @@ |
|||
import 'dart:convert'; |
|||
|
|||
import 'package:get_storage/get_storage.dart'; |
|||
import 'package:http/http.dart' as http; |
|||
|
|||
import '../../core/utils/logger.dart'; |
|||
import 'ai_service.dart'; |
|||
|
|||
class DeapsoundAIService implements AiService { |
|||
late final String apiKey; |
|||
|
|||
DeapsoundAIService() { |
|||
final GetStorage storage = GetStorage(); |
|||
apiKey = storage.read('logintoken'); |
|||
} |
|||
|
|||
@override |
|||
Stream<String> sendMessageStream({ |
|||
required List<Map<String, String>> messages, |
|||
required String systemPrompt, |
|||
}) async* { |
|||
final client = http.Client(); |
|||
final url = Uri.parse('https://www.deapsound.com/ai/chat'); |
|||
|
|||
final headers = { |
|||
'Content-Type': 'application/json', |
|||
'Authorization': apiKey, |
|||
}; |
|||
|
|||
final requestBody = { |
|||
"msg": messages.last['content'], |
|||
}; |
|||
|
|||
try { |
|||
final request = http.Request('POST', url) |
|||
..headers.addAll(headers) |
|||
..body = jsonEncode(requestBody); |
|||
final response = await client.send(request); |
|||
|
|||
//流式处理响应数据 |
|||
await for (final chunk in response.stream |
|||
.transform(utf8.decoder) |
|||
.transform(const LineSplitter())) { |
|||
if (chunk.isEmpty) continue; |
|||
|
|||
if (chunk.startsWith('data:')) { |
|||
final jsonStr = chunk.substring(5).trim(); |
|||
|
|||
try { |
|||
final data = jsonDecode(jsonStr); |
|||
if (data['event'] == 'workflow_finished') { |
|||
break; |
|||
} |
|||
if (data['event'] == 'text_chunk') { |
|||
String content = data['data']['text'] ?? ''; |
|||
if (content.isNotEmpty) { |
|||
yield content; |
|||
} |
|||
} |
|||
} catch (e) { |
|||
Logger.error('JSON解析错误: $e'); |
|||
} |
|||
} |
|||
} |
|||
} catch (e) { |
|||
Logger.error('请求异常: $e'); |
|||
} finally { |
|||
client.close(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,85 @@ |
|||
import 'dart:convert'; |
|||
|
|||
import 'package:http/http.dart' as http; |
|||
|
|||
import '../../core/utils/logger.dart'; |
|||
import 'ai_service.dart'; |
|||
|
|||
class KouziAIService implements AiService { |
|||
final String apiKey = |
|||
'pat_QGDh6UGm3PaeL9GRS95JxrJ9aoU92ehMLQQ2NCre1TeBC5YeTcjpDmlz3efsJ8lh'; |
|||
final String modelId = '7481292724306657316'; |
|||
|
|||
@override |
|||
Stream<String> sendMessageStream({ |
|||
required List<Map<String, String>> messages, |
|||
required String systemPrompt, |
|||
}) async* { |
|||
final client = http.Client(); |
|||
final url = Uri.parse('https://api.coze.cn/v3/chat'); |
|||
|
|||
final headers = { |
|||
'Content-Type': 'application/json', |
|||
'Authorization': 'Bearer $apiKey', |
|||
}; |
|||
|
|||
final requestBody = { |
|||
"bot_id": modelId, |
|||
"user_id": "3422", |
|||
"additional_messages": [ |
|||
{ |
|||
"content": messages.last['content'], |
|||
"content_type": "text", |
|||
"role": "user", |
|||
"type": "question", |
|||
}, |
|||
], |
|||
"shortcut_command": {"command_id": "0"}, |
|||
"stream": true, |
|||
}; |
|||
|
|||
try { |
|||
final request = http.Request('POST', url) |
|||
..headers.addAll(headers) |
|||
..body = jsonEncode(requestBody); |
|||
final response = await client.send(request); |
|||
final regex = RegExp(r'(?<=[。!?;:.:;?!\n])'); |
|||
|
|||
String allContent = ''; |
|||
//流式处理响应数据 |
|||
await for (final chunk in response.stream |
|||
.transform(utf8.decoder) |
|||
.transform(const LineSplitter())) { |
|||
if (chunk.isEmpty) continue; |
|||
|
|||
if (chunk.startsWith('data:')) { |
|||
final jsonStr = chunk.substring(5).trim(); |
|||
if (jsonStr == '[DONE]') { |
|||
break; |
|||
} |
|||
|
|||
try { |
|||
final data = jsonDecode(jsonStr); |
|||
if (data['type'] == 'answer') { |
|||
String content = data['content'] ?? ''; |
|||
if (content.isNotEmpty && allContent != content) { |
|||
allContent += content; |
|||
List splitText = |
|||
content.split(regex).where((s) => s.isNotEmpty).toList(); |
|||
for (var element in splitText) { |
|||
yield element; |
|||
} |
|||
} |
|||
} |
|||
} catch (e) { |
|||
Logger.error('JSON解析错误: $e'); |
|||
} |
|||
} |
|||
} |
|||
} catch (e) { |
|||
Logger.error('请求异常: $e'); |
|||
} finally { |
|||
client.close(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
import 'package:get/get.dart'; |
|||
import '../controllers/meeting_details_controller.dart'; |
|||
|
|||
class MeetingDetailsBinding extends Bindings { |
|||
@override |
|||
void dependencies() { |
|||
// 注册控制器 |
|||
Get.lazyPut<MeetingDetailsController>(() => MeetingDetailsController()); |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
import 'package:get/get.dart'; |
|||
|
|||
import '../controllers/meeting_edit_controller.dart'; |
|||
|
|||
class MeetingEditBinding extends Bindings { |
|||
@override |
|||
void dependencies() { |
|||
// 注册控制器 |
|||
Get.lazyPut<MeetingEditController>(() => MeetingEditController()); |
|||
} |
|||
} |
|||
@ -0,0 +1,51 @@ |
|||
import 'package:flutter/material.dart'; |
|||
import 'package:get/get.dart'; |
|||
|
|||
import '../../../data/services/db/sqflite_api.dart'; |
|||
import '../model/meeting_details_model.dart'; |
|||
import '../model/meeting_model.dart'; |
|||
|
|||
class MeetingDetailsController extends GetxController |
|||
with GetSingleTickerProviderStateMixin { |
|||
late AnimationController lottieController; |
|||
|
|||
int id = 0; |
|||
|
|||
RxBool isLoading = true.obs; |
|||
Rx<MeetingModel> meetingData = MeetingModel().obs; |
|||
Rx<MeetingDetailsModel> dataDetails = MeetingDetailsModel().obs; |
|||
|
|||
RxBool isPlay = false.obs; |
|||
|
|||
@override |
|||
void onInit() { |
|||
super.onInit(); |
|||
lottieController = AnimationController(vsync: this); |
|||
final Map<String, dynamic> args = Get.arguments ?? {}; |
|||
id = args['id']; |
|||
_getDataDetails(); |
|||
} |
|||
|
|||
@override |
|||
void onClose() { |
|||
lottieController.dispose(); |
|||
super.onClose(); |
|||
} |
|||
|
|||
void _getDataDetails() async { |
|||
final data = await SqfliteApi.getMeetingDetails(id); |
|||
meetingData.value = MeetingModel.fromJson(data); |
|||
dataDetails.value = MeetingDetailsModel.fromJson(data['details']); |
|||
isLoading.value = false; |
|||
} |
|||
|
|||
void start() { |
|||
if (isPlay.value) { |
|||
lottieController.stop(); |
|||
isPlay.value = false; |
|||
} else { |
|||
lottieController.repeat(); |
|||
isPlay.value = true; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,62 @@ |
|||
import 'package:flutter/material.dart'; |
|||
import 'package:get/get.dart'; |
|||
|
|||
import '../../../data/services/db/sqflite_api.dart'; |
|||
import '../model/meeting_details_model.dart'; |
|||
import '../model/meeting_model.dart'; |
|||
|
|||
class MeetingEditController extends GetxController |
|||
with GetSingleTickerProviderStateMixin { |
|||
late AnimationController lottieController; |
|||
|
|||
late TextEditingController titleController; |
|||
late TextEditingController contentController; |
|||
|
|||
int id = 0; |
|||
|
|||
RxBool isLoading = true.obs; |
|||
Rx<MeetingModel> meetingData = MeetingModel().obs; |
|||
Rx<MeetingDetailsModel> dataDetails = MeetingDetailsModel().obs; |
|||
|
|||
RxBool isPlay = false.obs; |
|||
|
|||
@override |
|||
void onInit() { |
|||
super.onInit(); |
|||
lottieController = AnimationController(vsync: this); |
|||
final Map<String, dynamic> args = Get.arguments ?? {}; |
|||
id = args['id']; |
|||
_getDataDetails(); |
|||
} |
|||
|
|||
@override |
|||
void onClose() { |
|||
lottieController.dispose(); |
|||
titleController.dispose(); |
|||
contentController.dispose(); |
|||
super.onClose(); |
|||
} |
|||
|
|||
void _getDataDetails() async { |
|||
final data = await SqfliteApi.getMeetingDetails(id); |
|||
meetingData.value = MeetingModel.fromJson(data); |
|||
dataDetails.value = MeetingDetailsModel.fromJson(data['details']); |
|||
titleController = TextEditingController( |
|||
text: meetingData.value.title, |
|||
); |
|||
contentController = TextEditingController( |
|||
text: dataDetails.value.content, |
|||
); |
|||
isLoading.value = false; |
|||
} |
|||
|
|||
void start() { |
|||
if (isPlay.value) { |
|||
lottieController.stop(); |
|||
isPlay.value = false; |
|||
} else { |
|||
lottieController.repeat(); |
|||
isPlay.value = true; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,253 @@ |
|||
import 'package:common_utils/common_utils.dart'; |
|||
import 'package:flutter/material.dart'; |
|||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|||
import 'package:get/get.dart'; |
|||
import 'package:lottie/lottie.dart'; |
|||
|
|||
import '../../../core/theme/app_colors.dart'; |
|||
import '../../../routes/app_routes.dart'; |
|||
import '../controllers/meeting_details_controller.dart'; |
|||
|
|||
class MeetingDetailsView extends GetView<MeetingDetailsController> { |
|||
const MeetingDetailsView({super.key}); |
|||
|
|||
@override |
|||
Widget build(BuildContext context) { |
|||
final isDarkMode = Theme.of(context).brightness == Brightness.dark; |
|||
|
|||
return Scaffold( |
|||
backgroundColor: isDarkMode ? Colors.black : Colors.grey[50], |
|||
appBar: _buildAppBar(isDarkMode), |
|||
body: Obx(() => !controller.isLoading.value |
|||
? _buildBody(isDarkMode) |
|||
: const SizedBox()), |
|||
); |
|||
} |
|||
|
|||
// 构建应用栏 |
|||
PreferredSizeWidget _buildAppBar(bool isDarkMode) { |
|||
return AppBar( |
|||
backgroundColor: isDarkMode ? Colors.black : Colors.white, |
|||
elevation: 0.5, |
|||
leading: IconButton( |
|||
icon: Icon( |
|||
Icons.arrow_back_ios, |
|||
color: isDarkMode ? Colors.white : Colors.black, |
|||
size: 20.sp, |
|||
), |
|||
onPressed: () => Get.back(), |
|||
), |
|||
title: Text( |
|||
'录音详情', |
|||
style: TextStyle( |
|||
fontSize: 17.sp, |
|||
fontWeight: FontWeight.w600, |
|||
color: isDarkMode ? Colors.white : Colors.black, |
|||
), |
|||
), |
|||
centerTitle: true, |
|||
); |
|||
} |
|||
|
|||
// 构建主体内容 |
|||
Widget _buildBody(bool isDarkMode) { |
|||
return Padding( |
|||
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 10.w), |
|||
child: Column( |
|||
crossAxisAlignment: CrossAxisAlignment.start, |
|||
children: [ |
|||
Text( |
|||
controller.meetingData.value.title, |
|||
style: TextStyle( |
|||
color: isDarkMode ? Colors.white : Colors.black87, |
|||
fontSize: 17.sp, |
|||
), |
|||
), |
|||
Padding( |
|||
padding: EdgeInsets.symmetric(vertical: 5.w), |
|||
child: Text( |
|||
DateUtil.formatDateMs( |
|||
controller.meetingData.value.creationtime, |
|||
format: DateFormats.y_mo_d_h_m, |
|||
), |
|||
style: TextStyle( |
|||
color: isDarkMode ? Colors.grey[400] : Colors.grey[500], |
|||
fontSize: 14.sp, |
|||
), |
|||
), |
|||
), |
|||
_audioWave(isDarkMode), |
|||
_recordContent(isDarkMode), |
|||
_bottomButton(isDarkMode), |
|||
], |
|||
), |
|||
); |
|||
} |
|||
|
|||
// 音波 |
|||
Widget _audioWave(bool isDarkMode) { |
|||
return Container( |
|||
padding: EdgeInsets.only(bottom: 10.w), |
|||
margin: EdgeInsets.symmetric(vertical: 5.w), |
|||
decoration: BoxDecoration( |
|||
color: isDarkMode ? Colors.white.withOpacity(0.05) : Colors.white, |
|||
borderRadius: BorderRadius.circular(12.w), |
|||
boxShadow: [ |
|||
BoxShadow( |
|||
color: isDarkMode |
|||
? Colors.black.withOpacity(0.2) |
|||
: Colors.black.withOpacity(0.05), |
|||
blurRadius: 10, |
|||
offset: const Offset(0, 2), |
|||
), |
|||
], |
|||
), |
|||
child: Column( |
|||
children: [ |
|||
SizedBox( |
|||
height: 70.w, |
|||
child: Row( |
|||
children: [ |
|||
Expanded( |
|||
child: Lottie.asset( |
|||
'assets/lottie/audio_wave.json', |
|||
controller: controller.lottieController, |
|||
fit: BoxFit.fill, |
|||
onLoaded: (composition) { |
|||
controller.lottieController.duration = |
|||
composition.duration; |
|||
}, |
|||
), |
|||
), |
|||
Expanded( |
|||
child: Lottie.asset( |
|||
'assets/lottie/audio_wave.json', |
|||
controller: controller.lottieController, |
|||
fit: BoxFit.fill, |
|||
), |
|||
), |
|||
Expanded( |
|||
child: Lottie.asset( |
|||
'assets/lottie/audio_wave.json', |
|||
controller: controller.lottieController, |
|||
fit: BoxFit.fill, |
|||
), |
|||
), |
|||
], |
|||
), |
|||
), |
|||
Row( |
|||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|||
children: [ |
|||
Text( |
|||
'00:00:00', |
|||
style: TextStyle( |
|||
color: isDarkMode ? Colors.grey[400] : Colors.grey[500], |
|||
fontSize: 12.sp, |
|||
), |
|||
), |
|||
GestureDetector( |
|||
onTap: controller.start, |
|||
child: Container( |
|||
width: 30.w, |
|||
height: 30.w, |
|||
decoration: BoxDecoration( |
|||
color: isDarkMode ? AppColors.primary : Colors.blue, |
|||
borderRadius: BorderRadius.circular( |
|||
12.w, |
|||
), |
|||
), |
|||
child: Icon( |
|||
controller.isPlay.value ? Icons.pause : Icons.play_arrow, |
|||
color: Colors.white, |
|||
size: 25.w, |
|||
), |
|||
), |
|||
), |
|||
Text( |
|||
'00:00:00', |
|||
style: TextStyle( |
|||
color: isDarkMode ? Colors.grey[400] : Colors.grey[500], |
|||
fontSize: 12.sp, |
|||
), |
|||
), |
|||
], |
|||
), |
|||
], |
|||
), |
|||
); |
|||
} |
|||
|
|||
// 记录内容 |
|||
Widget _recordContent(bool isDarkMode) { |
|||
return Expanded( |
|||
child: Container( |
|||
width: double.infinity, |
|||
padding: EdgeInsets.all(10.w), |
|||
margin: EdgeInsets.symmetric(vertical: 5.w), |
|||
decoration: BoxDecoration( |
|||
color: isDarkMode ? Colors.white.withOpacity(0.05) : Colors.white, |
|||
borderRadius: BorderRadius.circular(12.w), |
|||
boxShadow: [ |
|||
BoxShadow( |
|||
color: isDarkMode |
|||
? Colors.black.withOpacity(0.2) |
|||
: Colors.black.withOpacity(0.05), |
|||
blurRadius: 10, |
|||
offset: const Offset(0, 2), |
|||
), |
|||
], |
|||
), |
|||
child: Align( |
|||
alignment: Alignment.topLeft, |
|||
child: SingleChildScrollView( |
|||
reverse: true, |
|||
child: Obx( |
|||
() => Text( |
|||
controller.dataDetails.value.content, |
|||
), |
|||
), |
|||
), |
|||
), |
|||
), |
|||
); |
|||
} |
|||
|
|||
// 底部按钮 |
|||
Widget _bottomButton(bool isDarkMode) { |
|||
return Container( |
|||
padding: EdgeInsets.only(top: 40.w, bottom: 30.w), |
|||
alignment: Alignment.center, |
|||
child: GestureDetector( |
|||
onTap: () { |
|||
Get.toNamed(Routes.meetingEdit, arguments: { |
|||
'id': controller.id, |
|||
}); |
|||
}, |
|||
child: Container( |
|||
width: 130.w, |
|||
height: 48.w, |
|||
decoration: BoxDecoration( |
|||
color: isDarkMode ? AppColors.primary : Colors.blue, |
|||
borderRadius: BorderRadius.circular(12.w), |
|||
), |
|||
child: Row( |
|||
mainAxisAlignment: MainAxisAlignment.center, |
|||
children: [ |
|||
Icon( |
|||
Icons.edit_calendar, |
|||
color: Colors.white, |
|||
size: 20.w, |
|||
), |
|||
5.horizontalSpace, |
|||
Text( |
|||
'编辑', |
|||
style: TextStyle(color: Colors.white, fontSize: 16.sp), |
|||
), |
|||
], |
|||
), |
|||
), |
|||
), |
|||
); |
|||
} |
|||
} |
|||
@ -0,0 +1,262 @@ |
|||
import 'package:common_utils/common_utils.dart'; |
|||
import 'package:flutter/material.dart'; |
|||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|||
import 'package:get/get.dart'; |
|||
import 'package:lottie/lottie.dart'; |
|||
|
|||
import '../../../core/theme/app_colors.dart'; |
|||
import '../controllers/meeting_edit_controller.dart'; |
|||
|
|||
class MeetingEditView extends GetView<MeetingEditController> { |
|||
const MeetingEditView({super.key}); |
|||
|
|||
@override |
|||
Widget build(BuildContext context) { |
|||
final isDarkMode = Theme.of(context).brightness == Brightness.dark; |
|||
|
|||
return Scaffold( |
|||
backgroundColor: isDarkMode ? Colors.black : Colors.grey[50], |
|||
appBar: _buildAppBar(isDarkMode), |
|||
body: Obx(() => !controller.isLoading.value |
|||
? _buildBody(isDarkMode) |
|||
: const SizedBox()), |
|||
); |
|||
} |
|||
|
|||
// 构建应用栏 |
|||
PreferredSizeWidget _buildAppBar(bool isDarkMode) { |
|||
return AppBar( |
|||
backgroundColor: isDarkMode ? Colors.black : Colors.white, |
|||
elevation: 0.5, |
|||
leading: IconButton( |
|||
icon: Icon( |
|||
Icons.arrow_back_ios, |
|||
color: isDarkMode ? Colors.white : Colors.black, |
|||
size: 20.sp, |
|||
), |
|||
onPressed: () => Get.back(), |
|||
), |
|||
actions: [ |
|||
GestureDetector( |
|||
onTap: () {}, |
|||
child: Padding( |
|||
padding: EdgeInsets.symmetric( |
|||
horizontal: 12.w, |
|||
vertical: 6.w, |
|||
), |
|||
child: Text( |
|||
'保存', |
|||
style: TextStyle( |
|||
color: isDarkMode ? AppColors.primary : Colors.blue, |
|||
fontSize: 18.sp, |
|||
fontWeight: FontWeight.bold, |
|||
), |
|||
), |
|||
), |
|||
), |
|||
], |
|||
); |
|||
} |
|||
|
|||
// 构建主体内容 |
|||
Widget _buildBody(bool isDarkMode) { |
|||
return Padding( |
|||
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 10.w), |
|||
child: Column( |
|||
crossAxisAlignment: CrossAxisAlignment.start, |
|||
children: [ |
|||
Container( |
|||
height: 48.w, |
|||
alignment: Alignment.center, |
|||
decoration: BoxDecoration( |
|||
color: isDarkMode ? Colors.white.withOpacity(0.05) : Colors.white, |
|||
borderRadius: BorderRadius.circular(12.w), |
|||
boxShadow: [ |
|||
BoxShadow( |
|||
color: isDarkMode |
|||
? Colors.black.withOpacity(0.2) |
|||
: Colors.black.withOpacity(0.05), |
|||
blurRadius: 10, |
|||
offset: const Offset(0, 2), |
|||
), |
|||
], |
|||
), |
|||
child: TextField( |
|||
controller: controller.titleController, |
|||
style: TextStyle( |
|||
color: isDarkMode ? Colors.white : Colors.black87, |
|||
fontSize: 16.sp, |
|||
), |
|||
decoration: InputDecoration( |
|||
hintText: '最多50个字符', |
|||
hintStyle: TextStyle( |
|||
color: isDarkMode ? Colors.white70 : Colors.black54, |
|||
fontSize: 16.sp, |
|||
), |
|||
fillColor: Colors.transparent, |
|||
border: InputBorder.none, |
|||
contentPadding: EdgeInsets.symmetric( |
|||
horizontal: 10.w, |
|||
), |
|||
), |
|||
), |
|||
), |
|||
Padding( |
|||
padding: EdgeInsets.symmetric(vertical: 5.w), |
|||
child: Text( |
|||
DateUtil.formatDateMs( |
|||
controller.meetingData.value.creationtime, |
|||
format: DateFormats.y_mo_d_h_m, |
|||
), |
|||
style: TextStyle( |
|||
color: isDarkMode ? Colors.grey[400] : Colors.grey[500], |
|||
fontSize: 14.sp, |
|||
), |
|||
), |
|||
), |
|||
_audioWave(isDarkMode), |
|||
_recordContent(isDarkMode), |
|||
], |
|||
), |
|||
); |
|||
} |
|||
|
|||
// 音波 |
|||
Widget _audioWave(bool isDarkMode) { |
|||
return Container( |
|||
padding: EdgeInsets.only(bottom: 10.w), |
|||
margin: EdgeInsets.symmetric(vertical: 5.w), |
|||
decoration: BoxDecoration( |
|||
color: isDarkMode ? Colors.white.withOpacity(0.05) : Colors.white, |
|||
borderRadius: BorderRadius.circular(12.w), |
|||
boxShadow: [ |
|||
BoxShadow( |
|||
color: isDarkMode |
|||
? Colors.black.withOpacity(0.2) |
|||
: Colors.black.withOpacity(0.05), |
|||
blurRadius: 10, |
|||
offset: const Offset(0, 2), |
|||
), |
|||
], |
|||
), |
|||
child: Column( |
|||
children: [ |
|||
SizedBox( |
|||
height: 70.w, |
|||
child: Row( |
|||
children: [ |
|||
Expanded( |
|||
child: Lottie.asset( |
|||
'assets/lottie/audio_wave.json', |
|||
controller: controller.lottieController, |
|||
fit: BoxFit.fill, |
|||
onLoaded: (composition) { |
|||
controller.lottieController.duration = |
|||
composition.duration; |
|||
}, |
|||
), |
|||
), |
|||
Expanded( |
|||
child: Lottie.asset( |
|||
'assets/lottie/audio_wave.json', |
|||
controller: controller.lottieController, |
|||
fit: BoxFit.fill, |
|||
), |
|||
), |
|||
Expanded( |
|||
child: Lottie.asset( |
|||
'assets/lottie/audio_wave.json', |
|||
controller: controller.lottieController, |
|||
fit: BoxFit.fill, |
|||
), |
|||
), |
|||
], |
|||
), |
|||
), |
|||
Row( |
|||
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|||
children: [ |
|||
Text( |
|||
'00:00:00', |
|||
style: TextStyle( |
|||
color: isDarkMode ? Colors.grey[400] : Colors.grey[500], |
|||
fontSize: 12.sp, |
|||
), |
|||
), |
|||
GestureDetector( |
|||
onTap: controller.start, |
|||
child: Container( |
|||
width: 30.w, |
|||
height: 30.w, |
|||
decoration: BoxDecoration( |
|||
color: isDarkMode ? AppColors.primary : Colors.blue, |
|||
borderRadius: BorderRadius.circular( |
|||
12.w, |
|||
), |
|||
), |
|||
child: Icon( |
|||
controller.isPlay.value ? Icons.pause : Icons.play_arrow, |
|||
color: Colors.white, |
|||
size: 25.w, |
|||
), |
|||
), |
|||
), |
|||
Text( |
|||
'00:00:00', |
|||
style: TextStyle( |
|||
color: isDarkMode ? Colors.grey[400] : Colors.grey[500], |
|||
fontSize: 12.sp, |
|||
), |
|||
), |
|||
], |
|||
), |
|||
], |
|||
), |
|||
); |
|||
} |
|||
|
|||
// 记录内容 |
|||
Widget _recordContent(bool isDarkMode) { |
|||
return Expanded( |
|||
child: Container( |
|||
width: double.infinity, |
|||
padding: EdgeInsets.all(10.w), |
|||
margin: EdgeInsets.symmetric(vertical: 5.w), |
|||
decoration: BoxDecoration( |
|||
color: isDarkMode ? Colors.white.withOpacity(0.05) : Colors.white, |
|||
borderRadius: BorderRadius.circular(12.w), |
|||
boxShadow: [ |
|||
BoxShadow( |
|||
color: isDarkMode |
|||
? Colors.black.withOpacity(0.2) |
|||
: Colors.black.withOpacity(0.05), |
|||
blurRadius: 10, |
|||
offset: const Offset(0, 2), |
|||
), |
|||
], |
|||
), |
|||
child: TextField( |
|||
controller: controller.contentController, |
|||
style: TextStyle( |
|||
color: isDarkMode ? Colors.white : Colors.black87, |
|||
fontSize: 16.sp, |
|||
), |
|||
maxLines: 50, |
|||
decoration: InputDecoration( |
|||
hintText: '编辑记录内容', |
|||
hintStyle: TextStyle( |
|||
color: isDarkMode ? Colors.white70 : Colors.black54, |
|||
fontSize: 16.sp, |
|||
), |
|||
fillColor: Colors.transparent, |
|||
border: InputBorder.none, |
|||
focusedBorder: InputBorder.none, |
|||
contentPadding: EdgeInsets.symmetric( |
|||
horizontal: 10.w, |
|||
), |
|||
), |
|||
), |
|||
), |
|||
); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue