|
|
|
@ -1,6 +1,8 @@ |
|
|
|
import 'package:deep_voice/data/services/db/sqflite_api.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
import 'package:get/get.dart'; |
|
|
|
import 'package:get_storage/get_storage.dart'; |
|
|
|
|
|
|
|
import '../controllers/meeting_details_controller.dart'; |
|
|
|
import 'record_language_bottom_sheet.dart'; |
|
|
|
@ -17,54 +19,46 @@ class _GenerateBottomSheetState extends State<GenerateBottomSheet> { |
|
|
|
final _controller = Get.find<MeetingDetailsController>(); |
|
|
|
final ScrollController _scrollController = ScrollController(); |
|
|
|
|
|
|
|
final GetStorage _storage = GetStorage(); |
|
|
|
|
|
|
|
bool _isSpeaker = true; |
|
|
|
String _languageText = '中文普通话(简体)'; |
|
|
|
String _language = 'zh-CN'; |
|
|
|
|
|
|
|
final List _originalTemplate = [ |
|
|
|
{ |
|
|
|
'id': 1, |
|
|
|
'name': '会议纪要', |
|
|
|
'icon': Icons.auto_stories, |
|
|
|
'tag': ['主题', '代办事项'], |
|
|
|
'desc': '', |
|
|
|
}, |
|
|
|
{ |
|
|
|
'id': 2, |
|
|
|
'name': 'Autopilot', |
|
|
|
'icon': Icons.auto_graph, |
|
|
|
'tag': ['自适应结构', '全场景适配'], |
|
|
|
'desc': '', |
|
|
|
}, |
|
|
|
{ |
|
|
|
'id': 3, |
|
|
|
'name': '推理Autopilot', |
|
|
|
'icon': Icons.add_to_drive_outlined, |
|
|
|
'tag': ['推理模型', '自动结构化'], |
|
|
|
'desc': '', |
|
|
|
}, |
|
|
|
{ |
|
|
|
'id': 4, |
|
|
|
'name': '通话', |
|
|
|
'icon': Icons.perm_phone_msg, |
|
|
|
'tag': ['主题', '代办事项'], |
|
|
|
'desc': '', |
|
|
|
}, |
|
|
|
]; |
|
|
|
final Map _icons = { |
|
|
|
'auto_stories': Icons.auto_stories, |
|
|
|
'auto_graph': Icons.auto_graph, |
|
|
|
'add_to_drive_outlined': Icons.add_to_drive_outlined, |
|
|
|
'perm_phone_msg': Icons.perm_phone_msg, |
|
|
|
'auto_fix_high': Icons.auto_fix_high, |
|
|
|
}; |
|
|
|
|
|
|
|
List _categoryTemplateList = []; |
|
|
|
List _originalTemplate = []; |
|
|
|
|
|
|
|
int _templateId = 0; |
|
|
|
int _lastTemplateId = 0; |
|
|
|
Map _templateData = {}; |
|
|
|
Map _lastTemplateData = {}; |
|
|
|
List _templateList = []; |
|
|
|
|
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
super.initState(); |
|
|
|
if (_lastTemplateId != 0) { |
|
|
|
_templateId = _lastTemplateId; |
|
|
|
_getTemplate(); |
|
|
|
} |
|
|
|
|
|
|
|
void _getTemplate() async { |
|
|
|
_categoryTemplateList = await SqfliteApi.getMeetingCategoryTemplateList(); |
|
|
|
_lastTemplateData = _storage.read("meeting_last_template_Data") ?? {}; |
|
|
|
_originalTemplate = _storage.read("meeting_template_list") ?? |
|
|
|
_categoryTemplateList[0]['template']; |
|
|
|
if (_lastTemplateData.isNotEmpty) { |
|
|
|
_templateData = _lastTemplateData; |
|
|
|
} else { |
|
|
|
_templateId = _originalTemplate[0]['id']; |
|
|
|
_templateData = _originalTemplate[0]; |
|
|
|
} |
|
|
|
_templateList = List.from(_originalTemplate); |
|
|
|
setState(() { |
|
|
|
_templateList = List.from(_originalTemplate); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
@ -152,8 +146,9 @@ class _GenerateBottomSheetState extends State<GenerateBottomSheet> { |
|
|
|
GestureDetector( |
|
|
|
onTap: () async { |
|
|
|
var result = await Get.to(TemplateView( |
|
|
|
_templateId, |
|
|
|
_lastTemplateId, |
|
|
|
_templateData, |
|
|
|
_lastTemplateData['id'] ?? 0, |
|
|
|
_categoryTemplateList, |
|
|
|
)); |
|
|
|
if (result != null) { |
|
|
|
_scrollController.jumpTo(0); |
|
|
|
@ -167,7 +162,7 @@ class _GenerateBottomSheetState extends State<GenerateBottomSheet> { |
|
|
|
list.insert(0, result); |
|
|
|
} |
|
|
|
setState(() { |
|
|
|
_templateId = result['id']; |
|
|
|
_templateData = result; |
|
|
|
_templateList = list; |
|
|
|
}); |
|
|
|
} |
|
|
|
@ -262,8 +257,18 @@ class _GenerateBottomSheetState extends State<GenerateBottomSheet> { |
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 20.w), |
|
|
|
child: GestureDetector( |
|
|
|
onTap: () { |
|
|
|
if (_templateData['id'] != _templateList[0]['id']) { |
|
|
|
int index = _templateList |
|
|
|
.indexWhere((v) => v['id'] == _templateData['id']); |
|
|
|
if (index != -1) { |
|
|
|
Map itemToMove = _templateList.removeAt(index); |
|
|
|
_templateList.insert(0, itemToMove); |
|
|
|
} |
|
|
|
} |
|
|
|
_storage.write("meeting_last_template_Data", _templateData); |
|
|
|
_storage.write("meeting_template_list", _templateList); |
|
|
|
Get.back(); |
|
|
|
_controller.summaryCreate(); |
|
|
|
// _controller.summaryCreate(); |
|
|
|
}, |
|
|
|
child: Container( |
|
|
|
height: 48.w, |
|
|
|
@ -297,7 +302,7 @@ class _GenerateBottomSheetState extends State<GenerateBottomSheet> { |
|
|
|
child: GestureDetector( |
|
|
|
onTap: () { |
|
|
|
setState(() { |
|
|
|
_templateId = data['id']; |
|
|
|
_templateData = data; |
|
|
|
}); |
|
|
|
}, |
|
|
|
child: Stack( |
|
|
|
@ -306,7 +311,7 @@ class _GenerateBottomSheetState extends State<GenerateBottomSheet> { |
|
|
|
padding: EdgeInsets.all(5.w), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: Colors.white, |
|
|
|
gradient: _templateId == data['id'] |
|
|
|
gradient: _templateData['id'] == data['id'] |
|
|
|
? const LinearGradient( |
|
|
|
colors: [Colors.blue, Colors.pinkAccent], |
|
|
|
begin: Alignment.centerLeft, |
|
|
|
@ -327,7 +332,7 @@ class _GenerateBottomSheetState extends State<GenerateBottomSheet> { |
|
|
|
Padding( |
|
|
|
padding: EdgeInsets.only(top: 5.w), |
|
|
|
child: Icon( |
|
|
|
data['icon'], |
|
|
|
_icons[data['icon']], |
|
|
|
color: Colors.orange, |
|
|
|
size: 30.w, |
|
|
|
), |
|
|
|
@ -379,7 +384,7 @@ class _GenerateBottomSheetState extends State<GenerateBottomSheet> { |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
if (_lastTemplateId == data['id']) |
|
|
|
if (_lastTemplateData['id'] == data['id']) |
|
|
|
Positioned( |
|
|
|
top: 0, |
|
|
|
left: 0, |
|
|
|
@ -402,7 +407,7 @@ class _GenerateBottomSheetState extends State<GenerateBottomSheet> { |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
if (_templateId == data['id']) |
|
|
|
if (_templateData['id'] == data['id']) |
|
|
|
Positioned( |
|
|
|
right: -18.w, |
|
|
|
bottom: -18.w, |
|
|
|
|