|
|
@ -4,15 +4,117 @@ import 'package:flutter_markdown/flutter_markdown.dart'; |
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
import 'package:get/get.dart'; |
|
|
import 'package:get/get.dart'; |
|
|
|
|
|
|
|
|
|
|
|
import '../../../data/services/db/sqflite_api.dart'; |
|
|
import '../controllers/meeting_details_controller.dart'; |
|
|
import '../controllers/meeting_details_controller.dart'; |
|
|
import 'speaker_all_bottom_sheet.dart'; |
|
|
import 'speaker_all_bottom_sheet.dart'; |
|
|
|
|
|
|
|
|
class SummaryTab extends GetView<MeetingDetailsController> { |
|
|
class SummaryTab extends StatefulWidget { |
|
|
const SummaryTab({super.key}); |
|
|
const SummaryTab({super.key}); |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
|
State<SummaryTab> createState() => _SummaryTabState(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class _SummaryTabState extends State<SummaryTab> { |
|
|
|
|
|
final _controller = Get.find<MeetingDetailsController>(); |
|
|
|
|
|
final String _addressPrefix = '地点:'; |
|
|
|
|
|
String _addressText = ''; |
|
|
|
|
|
final String _personnelPrefix = '与会人员:'; |
|
|
|
|
|
String _personnelText = ''; |
|
|
|
|
|
final TextEditingController _addressController = TextEditingController(); |
|
|
|
|
|
final TextEditingController _personnelController = TextEditingController(); |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
|
void initState() { |
|
|
|
|
|
super.initState(); |
|
|
|
|
|
_addressController.text = _addressPrefix + |
|
|
|
|
|
(_controller.meetingDetails.value.address.isNotEmpty |
|
|
|
|
|
? _controller.meetingDetails.value.address |
|
|
|
|
|
: '[输入地点]'); |
|
|
|
|
|
_personnelController.text = _personnelPrefix + |
|
|
|
|
|
(_controller.meetingDetails.value.personnel.isNotEmpty |
|
|
|
|
|
? _controller.meetingDetails.value.personnel |
|
|
|
|
|
: '[输入与会人员]'); |
|
|
|
|
|
_addressController.addListener(_handleAddressChanged); |
|
|
|
|
|
_personnelController.addListener(_handlePersonnelChanged); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void _handleAddressChanged() { |
|
|
|
|
|
String currentText = _addressController.text; |
|
|
|
|
|
TextSelection currentSelection = _addressController.selection; |
|
|
|
|
|
if (!currentText.startsWith(_addressPrefix)) { |
|
|
|
|
|
_addressController.value = TextEditingValue( |
|
|
|
|
|
text: _addressPrefix + _addressText, |
|
|
|
|
|
selection: TextSelection.collapsed( |
|
|
|
|
|
offset: _addressPrefix.length + _addressText.length, |
|
|
|
|
|
), |
|
|
|
|
|
); |
|
|
|
|
|
return; |
|
|
|
|
|
} else { |
|
|
|
|
|
_addressText = currentText.substring(_addressPrefix.length); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (currentSelection.start < _addressPrefix.length || |
|
|
|
|
|
currentSelection.end < _addressPrefix.length) { |
|
|
|
|
|
int newStart = currentSelection.start < _addressPrefix.length |
|
|
|
|
|
? _addressPrefix.length |
|
|
|
|
|
: currentSelection.start; |
|
|
|
|
|
int newEnd = currentSelection.end < _addressPrefix.length |
|
|
|
|
|
? _addressPrefix.length |
|
|
|
|
|
: currentSelection.end; |
|
|
|
|
|
_addressController.selection = currentSelection.copyWith( |
|
|
|
|
|
baseOffset: newStart, |
|
|
|
|
|
extentOffset: newEnd, |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void _handlePersonnelChanged() { |
|
|
|
|
|
String currentText = _personnelController.text; |
|
|
|
|
|
TextSelection currentSelection = _personnelController.selection; |
|
|
|
|
|
if (!currentText.startsWith(_personnelPrefix)) { |
|
|
|
|
|
_personnelController.value = TextEditingValue( |
|
|
|
|
|
text: _personnelPrefix + _personnelText, |
|
|
|
|
|
selection: TextSelection.collapsed( |
|
|
|
|
|
offset: _personnelPrefix.length + _personnelText.length, |
|
|
|
|
|
), |
|
|
|
|
|
); |
|
|
|
|
|
return; |
|
|
|
|
|
} else { |
|
|
|
|
|
_personnelText = currentText.substring(_personnelPrefix.length); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (currentSelection.start < _personnelPrefix.length || |
|
|
|
|
|
currentSelection.end < _personnelPrefix.length) { |
|
|
|
|
|
int newStart = currentSelection.start < _personnelPrefix.length |
|
|
|
|
|
? _personnelPrefix.length |
|
|
|
|
|
: currentSelection.start; |
|
|
|
|
|
int newEnd = currentSelection.end < _personnelPrefix.length |
|
|
|
|
|
? _personnelPrefix.length |
|
|
|
|
|
: currentSelection.end; |
|
|
|
|
|
_personnelController.selection = currentSelection.copyWith( |
|
|
|
|
|
baseOffset: newStart, |
|
|
|
|
|
extentOffset: newEnd, |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
|
void dispose() { |
|
|
|
|
|
_addressController.dispose(); |
|
|
|
|
|
_personnelController.dispose(); |
|
|
|
|
|
super.dispose(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@override |
|
|
@override |
|
|
Widget build(BuildContext context) { |
|
|
Widget build(BuildContext context) { |
|
|
final isDarkMode = Theme.of(context).brightness == Brightness.dark; |
|
|
final isDarkMode = Theme.of(context).brightness == Brightness.dark; |
|
|
|
|
|
final TextStyle textStyle = TextStyle( |
|
|
|
|
|
color: isDarkMode ? Colors.grey[400] : Colors.grey[700], |
|
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
|
letterSpacing: 0, |
|
|
|
|
|
height: 1.5, |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
return Stack( |
|
|
return Stack( |
|
|
children: [ |
|
|
children: [ |
|
|
@ -25,7 +127,7 @@ class SummaryTab extends GetView<MeetingDetailsController> { |
|
|
Padding( |
|
|
Padding( |
|
|
padding: EdgeInsets.symmetric(vertical: 10.w), |
|
|
padding: EdgeInsets.symmetric(vertical: 10.w), |
|
|
child: Text( |
|
|
child: Text( |
|
|
controller.meetingData.value.title, |
|
|
_controller.meetingData.value.title, |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 20.sp, |
|
|
fontSize: 20.sp, |
|
|
fontWeight: FontWeight.bold, |
|
|
fontWeight: FontWeight.bold, |
|
|
@ -43,7 +145,7 @@ class SummaryTab extends GetView<MeetingDetailsController> { |
|
|
borderRadius: BorderRadius.circular(4.w), |
|
|
borderRadius: BorderRadius.circular(4.w), |
|
|
), |
|
|
), |
|
|
child: Text( |
|
|
child: Text( |
|
|
controller.meetingData.value.type, |
|
|
_controller.meetingData.value.type, |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
color: |
|
|
color: |
|
|
isDarkMode ? Colors.grey[400] : Colors.grey[500], |
|
|
isDarkMode ? Colors.grey[400] : Colors.grey[500], |
|
|
@ -59,7 +161,7 @@ class SummaryTab extends GetView<MeetingDetailsController> { |
|
|
2.horizontalSpace, |
|
|
2.horizontalSpace, |
|
|
Text( |
|
|
Text( |
|
|
DateUtil.formatDateMs( |
|
|
DateUtil.formatDateMs( |
|
|
controller.meetingData.value.creationtime, |
|
|
_controller.meetingData.value.creationtime, |
|
|
format: DateFormats.y_mo_d_h_m, |
|
|
format: DateFormats.y_mo_d_h_m, |
|
|
), |
|
|
), |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
@ -75,7 +177,7 @@ class SummaryTab extends GetView<MeetingDetailsController> { |
|
|
), |
|
|
), |
|
|
2.horizontalSpace, |
|
|
2.horizontalSpace, |
|
|
Text( |
|
|
Text( |
|
|
'${controller.meetingData.value.seconds}s', |
|
|
'${_controller.meetingData.value.seconds}s', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
color: isDarkMode ? Colors.grey[400] : Colors.grey[500], |
|
|
color: isDarkMode ? Colors.grey[400] : Colors.grey[500], |
|
|
fontSize: 12.sp, |
|
|
fontSize: 12.sp, |
|
|
@ -103,43 +205,79 @@ class SummaryTab extends GetView<MeetingDetailsController> { |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
child: Column( |
|
|
child: Focus( |
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
onFocusChange: (bool hasFocus) { |
|
|
children: [ |
|
|
if (!hasFocus) { |
|
|
Text( |
|
|
bool isEdit = false; |
|
|
'日期和时间:${DateUtil.formatDateMs( |
|
|
if (_addressText.isNotEmpty && |
|
|
controller.meetingData.value.creationtime, |
|
|
_addressText != |
|
|
format: DateFormats.y_mo_d_h_m, |
|
|
_controller.meetingDetails.value.address) { |
|
|
)}', |
|
|
_controller.meetingDetails.value.address = |
|
|
style: TextStyle( |
|
|
_addressText; |
|
|
color: |
|
|
isEdit = true; |
|
|
isDarkMode ? Colors.grey[400] : Colors.grey[700], |
|
|
} |
|
|
fontSize: 16.sp, |
|
|
if (_personnelText.isNotEmpty && |
|
|
|
|
|
_personnelText != |
|
|
|
|
|
_controller.meetingDetails.value.personnel) { |
|
|
|
|
|
_controller.meetingDetails.value.personnel = |
|
|
|
|
|
_personnelText; |
|
|
|
|
|
isEdit = true; |
|
|
|
|
|
} |
|
|
|
|
|
if (isEdit) { |
|
|
|
|
|
SqfliteApi.editMeeting( |
|
|
|
|
|
_controller.id, |
|
|
|
|
|
{ |
|
|
|
|
|
'address': |
|
|
|
|
|
_controller.meetingDetails.value.address, |
|
|
|
|
|
'personnel': |
|
|
|
|
|
_controller.meetingDetails.value.personnel, |
|
|
|
|
|
}, |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
child: Column( |
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
|
children: [ |
|
|
|
|
|
Text( |
|
|
|
|
|
'日期和时间:${DateUtil.formatDateMs( |
|
|
|
|
|
_controller.meetingData.value.creationtime, |
|
|
|
|
|
format: DateFormats.y_mo_d_h_m, |
|
|
|
|
|
)}', |
|
|
|
|
|
style: textStyle, |
|
|
), |
|
|
), |
|
|
), |
|
|
TextField( |
|
|
Text( |
|
|
controller: _addressController, |
|
|
'地点:${controller.meetingDetails.value.address.isNotEmpty ? controller.meetingDetails.value.address : '[输入地点]'}', |
|
|
style: textStyle, |
|
|
style: TextStyle( |
|
|
minLines: 1, |
|
|
color: |
|
|
maxLines: 100, |
|
|
isDarkMode ? Colors.grey[400] : Colors.grey[700], |
|
|
decoration: const InputDecoration( |
|
|
fontSize: 16.sp, |
|
|
isDense: true, |
|
|
|
|
|
fillColor: Colors.transparent, |
|
|
|
|
|
border: InputBorder.none, |
|
|
|
|
|
contentPadding: EdgeInsets.zero, |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
TextField( |
|
|
Text( |
|
|
controller: _personnelController, |
|
|
'与会人员:${controller.meetingDetails.value.personnel.isNotEmpty ? controller.meetingDetails.value.personnel : '[输入与会人员]'}', |
|
|
style: textStyle, |
|
|
style: TextStyle( |
|
|
minLines: 1, |
|
|
color: |
|
|
maxLines: 100, |
|
|
isDarkMode ? Colors.grey[400] : Colors.grey[700], |
|
|
decoration: const InputDecoration( |
|
|
fontSize: 16.sp, |
|
|
isDense: true, |
|
|
|
|
|
fillColor: Colors.transparent, |
|
|
|
|
|
border: InputBorder.none, |
|
|
|
|
|
contentPadding: EdgeInsets.zero, |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
Padding( |
|
|
Padding( |
|
|
padding: EdgeInsets.only(top: 10.w), |
|
|
padding: EdgeInsets.only(top: 10.w), |
|
|
child: MarkdownBody( |
|
|
child: MarkdownBody( |
|
|
data: controller.meetingDetails.value.summary, |
|
|
data: _controller.meetingDetails.value.summary, |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
], |
|
|
], |
|
|
@ -154,7 +292,7 @@ class SummaryTab extends GetView<MeetingDetailsController> { |
|
|
child: Row( |
|
|
child: Row( |
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
children: [ |
|
|
children: [ |
|
|
if (controller.meetingDetails.value.summary.isNotEmpty) |
|
|
if (_controller.meetingDetails.value.summary.isNotEmpty) |
|
|
_button( |
|
|
_button( |
|
|
Icons.supervisor_account, |
|
|
Icons.supervisor_account, |
|
|
'编辑发言者', |
|
|
'编辑发言者', |
|
|
@ -174,13 +312,13 @@ class SummaryTab extends GetView<MeetingDetailsController> { |
|
|
); |
|
|
); |
|
|
}, |
|
|
}, |
|
|
), |
|
|
), |
|
|
if (controller.meetingDetails.value.summary.isEmpty) |
|
|
if (_controller.meetingDetails.value.summary.isEmpty) |
|
|
SizedBox( |
|
|
SizedBox( |
|
|
width: 150.w, |
|
|
width: 150.w, |
|
|
child: _button( |
|
|
child: _button( |
|
|
Icons.auto_awesome, |
|
|
Icons.auto_awesome, |
|
|
'生成', |
|
|
'生成', |
|
|
controller.summaryCreate, |
|
|
_controller.summaryCreate, |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
], |
|
|
], |
|
|
|