Browse Source

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

weicu
lxm 1 year ago
parent
commit
a164b9d255
  1. 3
      lib/modules/meeting/controllers/meeting_details_controller.dart
  2. 10
      lib/modules/meeting/controllers/mind_map_controller.dart
  3. 2
      lib/modules/meeting/views/bottomSheet/speaker_all_bottom_sheet.dart
  4. 1
      lib/modules/meeting/views/bottomSheet/speaker_bottom_sheet.dart
  5. 175
      lib/modules/meeting/views/tabs/summary_tab.dart

3
lib/modules/meeting/controllers/meeting_details_controller.dart

@ -55,6 +55,8 @@ class MeetingDetailsController extends GetxController
String editSpeakerTextChange = '';
int _everType = 99;
RxInt summaryNumberModifications = 0.obs;
RxInt personnelNumberModifications = 0.obs;
String markmapLibJs = '';
String d3Js = '';
@ -90,6 +92,7 @@ class MeetingDetailsController extends GetxController
} else if (value == 3) {
meetingDetails.value.summary = _meetingTaskService.summary;
meetingDetails.value.overview = _meetingTaskService.overview;
summaryNumberModifications.value++;
}
}
meetingDetails.refresh();

10
lib/modules/meeting/controllers/mind_map_controller.dart

@ -108,6 +108,12 @@ class MindMapController extends GetxController {
const toolbarElement = document.getElementById('toolbar');
toolbarElement.append(el);
window.updateMarkmap = async function(value) {
const { root } = transformer.transform(value);
await mm.setData(root);
await mm.fit();
}
window.captureImage = async function() {
const markmapElement = document.getElementById('markmap');
markmapElement.style.height = `${_width}px`;
@ -144,6 +150,10 @@ class MindMapController extends GetxController {
)
..setBackgroundColor(Colors.transparent)
..loadHtmlString(html);
ever(_meetingDetailsController.summaryNumberModifications, (value) {
webViewController.runJavaScript(
'updateMarkmap(`${_meetingDetailsController.meetingDetails.value.summary}`)');
});
}
void _messageReceived(message) async {

2
lib/modules/meeting/views/bottomSheet/speaker_all_bottom_sheet.dart

@ -576,10 +576,12 @@ class _SpeakerAllBottomSheetState extends State<SpeakerAllBottomSheet> {
'personnel': personnel,
});
_controller.meetingDetails.value.summary = summaryText;
_controller.summaryNumberModifications.value++;
} else {
SqfliteApi.editMeeting(_controller.id, {'personnel': personnel});
}
_controller.meetingDetails.value.personnel = personnel;
_controller.personnelNumberModifications.value++;
_controller.meetingDetails.refresh();
_storage.write("speaker_list", _historySpeakerList);
Get.back();

1
lib/modules/meeting/views/bottomSheet/speaker_bottom_sheet.dart

@ -382,6 +382,7 @@ class _SpeakerBottomSheetState extends State<SpeakerBottomSheet> {
'personnel': personnel,
});
_controller.meetingDetails.value.summary = summaryText;
_controller.summaryNumberModifications.value++;
} else {
SqfliteApi.editMeeting(_controller.id, {'personnel': personnel});
}

175
lib/modules/meeting/views/tabs/summary_tab.dart

@ -1,7 +1,6 @@
import 'package:common_utils/common_utils.dart';
import 'package:fleather/fleather.dart';
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:parchment/codecs.dart';
@ -32,9 +31,25 @@ class _SummaryTabState extends State<SummaryTab> {
final GlobalKey<EditorState> _editorKey = GlobalKey();
FleatherController? _fleatherController;
bool _hasFocus = false;
@override
void initState() {
super.initState();
_initController();
_addressController.addListener(_handleAddressChanged);
_personnelController.addListener(_handlePersonnelChanged);
_focusNode.addListener(() {
setState(() {
_hasFocus = _focusNode.hasFocus;
});
});
ever(_controller.personnelNumberModifications, (value) {
_initController();
});
}
void _initController() {
_addressController.text = _addressPrefix +
(_controller.meetingDetails.value.address.isNotEmpty
? _controller.meetingDetails.value.address
@ -43,9 +58,9 @@ class _SummaryTabState extends State<SummaryTab> {
(_controller.meetingDetails.value.personnel.isNotEmpty
? _controller.meetingDetails.value.personnel
: '[输入与会人员]');
_addressController.addListener(_handleAddressChanged);
_personnelController.addListener(_handlePersonnelChanged);
_initController();
final markdown = const ParchmentMarkdownCodec()
.decode(_controller.meetingDetails.value.summary);
_fleatherController = FleatherController(document: markdown);
}
void _handleAddressChanged() {
@ -108,14 +123,24 @@ class _SummaryTabState extends State<SummaryTab> {
}
}
Future<void> _initController() async {
final markdown = const ParchmentMarkdownCodec()
.decode(_controller.meetingDetails.value.summary);
_fleatherController = FleatherController(document: markdown);
void _saveSummary() async {
final markdown =
const ParchmentMarkdownCodec().encode(_fleatherController!.document);
if (markdown != _controller.meetingDetails.value.summary) {
SqfliteApi.editMeeting(
_controller.id,
{'summary': markdown},
);
_controller.meetingDetails.value.summary = markdown;
_controller.summaryNumberModifications.value++;
}
_focusNode.dispose();
_fleatherController?.dispose();
}
@override
void dispose() {
_saveSummary();
_addressController.dispose();
_personnelController.dispose();
super.dispose();
@ -292,67 +317,51 @@ class _SummaryTabState extends State<SummaryTab> {
),
Padding(
padding: EdgeInsets.only(top: 10.w),
child: MarkdownBody(
data: _controller.meetingDetails.value.summary,
child: FleatherEditor(
controller: _fleatherController!,
focusNode: _focusNode,
editorKey: _editorKey,
),
),
],
),
),
),
Obx(
() => Positioned(
bottom: 20.w,
left: 0,
right: 0,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (_controller.meetingDetails.value.tasktype >= 3)
_button(
Icons.supervisor_account,
'编辑发言者',
() {
Get.bottomSheet(
const SpeakerAllBottomSheet(),
isScrollControlled: true,
backgroundColor: Colors.grey[100],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(12.r),
),
),
);
},
),
if (_controller.meetingDetails.value.tasktype >= 3)
_button(
Icons.auto_awesome,
'Ask AI',
() {
Get.bottomSheet(
const AIBottomSheet(),
isScrollControlled: true,
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(12.r),
if (!_hasFocus)
Obx(
() => Positioned(
bottom: 20.w,
left: 0,
right: 0,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (_controller.meetingDetails.value.tasktype >= 3)
_button(
Icons.supervisor_account,
'编辑发言者',
() {
Get.bottomSheet(
const SpeakerAllBottomSheet(),
isScrollControlled: true,
backgroundColor: Colors.grey[100],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(12.r),
),
),
),
);
},
),
if (_controller.meetingDetails.value.tasktype == 0)
SizedBox(
width: 150.w,
child: _button(
);
},
),
if (_controller.meetingDetails.value.tasktype >= 3)
_button(
Icons.auto_awesome,
'生成',
'Ask AI',
() {
Get.bottomSheet(
const GenerateBottomSheet(),
const AIBottomSheet(),
isScrollControlled: true,
backgroundColor: Colors.grey[100],
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(12.r),
@ -361,25 +370,45 @@ class _SummaryTabState extends State<SummaryTab> {
);
},
),
),
],
if (_controller.meetingDetails.value.tasktype == 0)
SizedBox(
width: 150.w,
child: _button(
Icons.auto_awesome,
'生成',
() {
Get.bottomSheet(
const GenerateBottomSheet(),
isScrollControlled: true,
backgroundColor: Colors.grey[100],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(12.r),
),
),
);
},
),
),
],
),
),
),
),
Positioned(
bottom: 0,
left: -12.w,
right: -12.w,
child: Container(
height: 40,
color: Colors.white,
alignment: Alignment.center,
child: FleatherToolbar.basic(
controller: _fleatherController!,
editorKey: _editorKey,
if (_hasFocus)
Positioned(
bottom: 0,
left: -12.w,
right: -12.w,
child: Container(
height: 40,
color: Colors.white,
alignment: Alignment.center,
child: FleatherToolbar.basic(
controller: _fleatherController!,
editorKey: _editorKey,
),
),
),
),
],
);
}

Loading…
Cancel
Save