Browse Source

优化内容显示

weicu
tanlongsheng 1 year ago
parent
commit
ddc2ccacb8
  1. 5
      lib/modules/meeting/controllers/meeting_details_controller.dart
  2. 9
      lib/modules/meeting/controllers/meeting_mine_controller.dart
  3. 11
      lib/modules/meeting/controllers/mind_map_controller.dart
  4. 379
      lib/modules/meeting/views/meeting_details_view.dart
  5. 15
      lib/modules/meeting/views/tabs/summary_tab.dart

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

@ -25,6 +25,8 @@ class MeetingDetailsController extends GetxController
late AnimationController lottieController; late AnimationController lottieController;
late final Worker _tasktypeListener;
final _meetingUploadService = Get.find<MeetingUploadService>(); final _meetingUploadService = Get.find<MeetingUploadService>();
final _meetingTaskService = Get.find<MeetingTaskService>(); final _meetingTaskService = Get.find<MeetingTaskService>();
@ -84,7 +86,7 @@ class MeetingDetailsController extends GetxController
_meetingTaskService.meetingId = id; _meetingTaskService.meetingId = id;
_getDataDetails(); _getDataDetails();
_loadJS(); _loadJS();
ever(_meetingTaskService.tasktype, (value) { _tasktypeListener = ever(_meetingTaskService.tasktype, (value) {
meetingDetails.value.tasktype = value; meetingDetails.value.tasktype = value;
if (_everType <= value) { if (_everType <= value) {
if (value == 2) { if (value == 2) {
@ -101,6 +103,7 @@ class MeetingDetailsController extends GetxController
@override @override
void onClose() { void onClose() {
_tasktypeListener.dispose();
_currentDurationSubscription?.cancel(); _currentDurationSubscription?.cancel();
_playerStateSubscription?.cancel(); _playerStateSubscription?.cancel();
tabController.dispose(); tabController.dispose();

9
lib/modules/meeting/controllers/meeting_mine_controller.dart

@ -14,6 +14,9 @@ class MeetingMineController extends GetxController {
final ScrollController scrollController = ScrollController(); final ScrollController scrollController = ScrollController();
late final Worker _pageIndexListener;
late final Worker _originalDataListener;
bool isStatistics = true; bool isStatistics = true;
Map statistics = {}; Map statistics = {};
@ -38,18 +41,20 @@ class MeetingMineController extends GetxController {
} }
}); });
_getStatistics(); _getStatistics();
ever(_meetingController.pageIndex, (value) { _pageIndexListener = ever(_meetingController.pageIndex, (value) {
if (isStatistics && value == 2) { if (isStatistics && value == 2) {
_getStatistics(); _getStatistics();
} }
}); });
ever(_homeController.originalDataList, (value) { _originalDataListener = ever(_homeController.originalDataList, (value) {
isStatistics = true; isStatistics = true;
}); });
} }
@override @override
void onClose() { void onClose() {
_pageIndexListener.dispose();
_originalDataListener.dispose();
scrollController.dispose(); scrollController.dispose();
super.onClose(); super.onClose();
} }

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

@ -18,6 +18,8 @@ class MindMapController extends GetxController {
final double _width = 1.sw - 25.w; final double _width = 1.sw - 25.w;
bool isWebViewReady = false; bool isWebViewReady = false;
late final Worker _summaryNumberListener;
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
@ -150,12 +152,19 @@ class MindMapController extends GetxController {
) )
..setBackgroundColor(Colors.transparent) ..setBackgroundColor(Colors.transparent)
..loadHtmlString(html); ..loadHtmlString(html);
ever(_meetingDetailsController.summaryNumberModifications, (value) { _summaryNumberListener =
ever(_meetingDetailsController.summaryNumberModifications, (value) {
webViewController.runJavaScript( webViewController.runJavaScript(
'updateMarkmap(`${_meetingDetailsController.meetingDetails.value.summary}`)'); 'updateMarkmap(`${_meetingDetailsController.meetingDetails.value.summary}`)');
}); });
} }
@override
void onClose() {
_summaryNumberListener.dispose();
super.onClose();
}
void _messageReceived(message) async { void _messageReceived(message) async {
final String dataUrl = message.message; final String dataUrl = message.message;
final String base64Str = dataUrl.split(',').last; final String base64Str = dataUrl.split(',').last;

379
lib/modules/meeting/views/meeting_details_view.dart

@ -25,219 +25,224 @@ class MeetingDetailsView extends GetView<MeetingDetailsController> {
return PopScope( return PopScope(
onPopInvokedWithResult: controller.popInvokedWithResult, onPopInvokedWithResult: controller.popInvokedWithResult,
child: Obx( child: Scaffold(
() => Scaffold( backgroundColor: isDarkMode ? Colors.black : Colors.grey[50],
backgroundColor: isDarkMode ? Colors.black : Colors.grey[50], appBar: _buildAppBar(context, isDarkMode),
appBar: _buildAppBar(context, isDarkMode), body: _buildBody(isDarkMode),
body: _buildBody(isDarkMode),
),
), ),
); );
} }
// 构建应用栏 // 构建应用栏
PreferredSizeWidget _buildAppBar(BuildContext context, bool isDarkMode) { PreferredSizeWidget _buildAppBar(BuildContext context, bool isDarkMode) {
return AppBar( return PreferredSize(
backgroundColor: preferredSize: const Size.fromHeight(kToolbarHeight),
controller.isTop.value ? Colors.grey[50] : Colors.grey[200], child: Obx(
surfaceTintColor: Colors.transparent, () => AppBar(
elevation: 0.5, backgroundColor:
leading: controller.isSpeakerText.value controller.isTop.value ? Colors.grey[50] : Colors.grey[200],
? GestureDetector( surfaceTintColor: Colors.transparent,
onTap: () { elevation: 0.5,
controller.isSpeakerText.value = false; leading: controller.isSpeakerText.value
controller.editSpeakerTextId.value = 0; ? GestureDetector(
controller.editSpeakerTextList = [];
},
child: Center(
child: Text(
'cancel'.tr,
style: TextStyle(
color: isDarkMode ? Colors.white : Colors.black87,
fontSize: 16.sp,
),
),
),
)
: IconButton(
icon: Icon(
Icons.arrow_back_ios,
color: isDarkMode ? Colors.white : Colors.black,
size: 20.sp,
),
onPressed: () => Get.back(),
),
title: Obx(
() => Opacity(
opacity: (1 - (controller.dragOffset.value / 100.w)).clamp(0.0, 1.0),
child: Container(
width: 170.w,
padding: EdgeInsets.symmetric(horizontal: 2.w, vertical: 3.w),
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: BorderRadius.circular(30.r),
),
child: Row(
children: [
GestureDetector(
onTap: () { onTap: () {
if (controller.meetingData.value.filepath.isEmpty) { controller.isSpeakerText.value = false;
controller.downloadAudio(); controller.editSpeakerTextId.value = 0;
} else { controller.editSpeakerTextList = [];
if (controller.isPlay.value) {
controller.playerController.pausePlayer();
} else {
controller.playerController.startPlayer();
}
}
}, },
child: Obx( child: Center(
() => !controller.isLoading.value && child: Text(
controller.meetingData.value.filepath.isEmpty 'cancel'.tr,
? Obx( style: TextStyle(
() => Stack( color: isDarkMode ? Colors.white : Colors.black87,
alignment: Alignment.center, fontSize: 16.sp,
children: [ ),
if (controller.isDownload.value) ),
SizedBox( ),
width: 26.w, )
height: 26.w, : IconButton(
child: CircularProgressIndicator( icon: Icon(
value: controller.downloadProgress.value, Icons.arrow_back_ios,
valueColor: color: isDarkMode ? Colors.white : Colors.black,
const AlwaysStoppedAnimation<Color>( size: 20.sp,
Colors.red), ),
strokeWidth: 2.w, onPressed: () => Get.back(),
),
title: Obx(
() => Opacity(
opacity:
(1 - (controller.dragOffset.value / 100.w)).clamp(0.0, 1.0),
child: Container(
width: 170.w,
padding: EdgeInsets.symmetric(horizontal: 2.w, vertical: 3.w),
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: BorderRadius.circular(30.r),
),
child: Row(
children: [
GestureDetector(
onTap: () {
if (controller.meetingData.value.filepath.isEmpty) {
controller.downloadAudio();
} else {
if (controller.isPlay.value) {
controller.playerController.pausePlayer();
} else {
controller.playerController.startPlayer();
}
}
},
child: Obx(
() => !controller.isLoading.value &&
controller.meetingData.value.filepath.isEmpty
? Obx(
() => Stack(
alignment: Alignment.center,
children: [
if (controller.isDownload.value)
SizedBox(
width: 26.w,
height: 26.w,
child: CircularProgressIndicator(
value:
controller.downloadProgress.value,
valueColor:
const AlwaysStoppedAnimation<
Color>(Colors.red),
strokeWidth: 2.w,
),
),
Icon(
Icons.download_for_offline,
color: Colors.black,
size: 30.w,
), ),
), ],
Icon(
Icons.download_for_offline,
color: Colors.black,
size: 30.w,
), ),
], )
: Icon(
controller.isPlay.value
? Icons.pause_circle
: Icons.play_circle,
color: Colors.black,
size: 30.w,
),
),
),
4.horizontalSpace,
GestureDetector(
onTap: () {
if (controller.isSpeakerText.value) return;
controller.dragOffset.value = 210.w;
controller.isTop.value = false;
},
behavior: HitTestBehavior.translucent,
child: SizedBox(
width: 130.w,
height: 30.w,
child: FittedBox(
fit: BoxFit.scaleDown,
child: AudioFileWaveforms(
size: Size(350.w, 30.w),
playerController: controller.playerController,
waveformData: List.generate(88, (int index) {
return 0.01 + Random().nextDouble() * 0.09;
}),
waveformType: WaveformType.fitWidth,
enableSeekGesture: false,
playerWaveStyle: PlayerWaveStyle(
spacing: 4.w,
waveThickness: 2.w,
fixedWaveColor: Colors.grey[400]!,
liveWaveColor: Colors.red,
seekLineColor: Colors.red,
scaleFactor: 200,
), ),
)
: Icon(
controller.isPlay.value
? Icons.pause_circle
: Icons.play_circle,
color: Colors.black,
size: 30.w,
), ),
),
),
4.horizontalSpace,
GestureDetector(
onTap: () {
if (controller.isSpeakerText.value) return;
controller.dragOffset.value = 210.w;
controller.isTop.value = false;
},
behavior: HitTestBehavior.translucent,
child: SizedBox(
width: 130.w,
height: 30.w,
child: FittedBox(
fit: BoxFit.scaleDown,
child: AudioFileWaveforms(
size: Size(350.w, 30.w),
playerController: controller.playerController,
waveformData: List.generate(88, (int index) {
return 0.01 + Random().nextDouble() * 0.09;
}),
waveformType: WaveformType.fitWidth,
enableSeekGesture: false,
playerWaveStyle: PlayerWaveStyle(
spacing: 4.w,
waveThickness: 2.w,
fixedWaveColor: Colors.grey[400]!,
liveWaveColor: Colors.red,
seekLineColor: Colors.red,
scaleFactor: 200,
), ),
), ),
), ),
), ],
),
],
),
),
),
),
centerTitle: true,
actions: [
if (controller.isSpeakerText.value)
GestureDetector(
onTap: controller.editSpeakerText,
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 12.w,
vertical: 6.w,
),
child: Text(
'save'.tr,
style: TextStyle(
color: isDarkMode ? AppColors.primary : Colors.blue,
fontSize: 16.sp,
), ),
), ),
), ),
), ),
if (!controller.isSpeakerText.value) centerTitle: true,
IconButton( actions: [
icon: Icon( if (controller.isSpeakerText.value)
Icons.ios_share, GestureDetector(
color: isDarkMode ? Colors.white : Colors.black, onTap: controller.editSpeakerText,
size: 22.sp, child: Padding(
), padding: EdgeInsets.symmetric(
onPressed: () { horizontal: 12.w,
Get.bottomSheet( vertical: 6.w,
const ShareBottomSheet(), ),
isScrollControlled: true, child: Text(
backgroundColor: Colors.grey[100], 'save'.tr,
shape: RoundedRectangleBorder( style: TextStyle(
borderRadius: BorderRadius.vertical( color: isDarkMode ? AppColors.primary : Colors.blue,
top: Radius.circular(12.r), fontSize: 16.sp,
),
), ),
), ),
); ),
}, if (!controller.isSpeakerText.value)
), IconButton(
if (!controller.isSpeakerText.value) icon: Icon(
IconButton( Icons.ios_share,
icon: Container(
width: 22.w,
height: 22.w,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.r),
border: Border.all(
color: isDarkMode ? Colors.white : Colors.black, color: isDarkMode ? Colors.white : Colors.black,
width: 2, size: 22.sp,
), ),
onPressed: () {
Get.bottomSheet(
const ShareBottomSheet(),
isScrollControlled: true,
backgroundColor: Colors.grey[100],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(12.r),
),
),
);
},
), ),
child: Icon( if (!controller.isSpeakerText.value)
Icons.more_horiz, IconButton(
color: isDarkMode ? Colors.white : Colors.black, icon: Container(
size: 16.sp, width: 22.w,
), height: 22.w,
), alignment: Alignment.center,
onPressed: () { decoration: BoxDecoration(
Get.bottomSheet( borderRadius: BorderRadius.circular(20.r),
const MoreBottomSheet(), border: Border.all(
isScrollControlled: true, color: isDarkMode ? Colors.white : Colors.black,
backgroundColor: Colors.grey[100], width: 2,
shape: RoundedRectangleBorder( ),
borderRadius: BorderRadius.vertical( ),
top: Radius.circular(12.r), child: Icon(
Icons.more_horiz,
color: isDarkMode ? Colors.white : Colors.black,
size: 16.sp,
), ),
), ),
); onPressed: () {
}, Get.bottomSheet(
), const MoreBottomSheet(),
], isScrollControlled: true,
backgroundColor: Colors.grey[100],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(12.r),
),
),
);
},
),
],
),
),
); );
} }

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

@ -20,6 +20,9 @@ class SummaryTab extends StatefulWidget {
class _SummaryTabState extends State<SummaryTab> { class _SummaryTabState extends State<SummaryTab> {
final _controller = Get.find<MeetingDetailsController>(); final _controller = Get.find<MeetingDetailsController>();
late final Worker _personnelListener;
final String _addressPrefix = '地点:'; final String _addressPrefix = '地点:';
String _addressText = ''; String _addressText = '';
final String _personnelPrefix = '与会人员:'; final String _personnelPrefix = '与会人员:';
@ -44,7 +47,8 @@ class _SummaryTabState extends State<SummaryTab> {
_hasFocus = _focusNode.hasFocus; _hasFocus = _focusNode.hasFocus;
}); });
}); });
ever(_controller.personnelNumberModifications, (value) { _personnelListener =
ever(_controller.personnelNumberModifications, (value) {
_initController(); _initController();
}); });
} }
@ -60,7 +64,9 @@ class _SummaryTabState extends State<SummaryTab> {
: '[输入与会人员]'); : '[输入与会人员]');
final markdown = const ParchmentMarkdownCodec() final markdown = const ParchmentMarkdownCodec()
.decode(_controller.meetingDetails.value.summary); .decode(_controller.meetingDetails.value.summary);
_fleatherController = FleatherController(document: markdown); setState(() {
_fleatherController = FleatherController(document: markdown);
});
} }
void _handleAddressChanged() { void _handleAddressChanged() {
@ -134,13 +140,14 @@ class _SummaryTabState extends State<SummaryTab> {
_controller.meetingDetails.value.summary = markdown; _controller.meetingDetails.value.summary = markdown;
_controller.summaryNumberModifications.value++; _controller.summaryNumberModifications.value++;
} }
_focusNode.dispose();
_fleatherController?.dispose();
} }
@override @override
void dispose() { void dispose() {
_personnelListener.dispose();
_saveSummary(); _saveSummary();
_fleatherController?.dispose();
_focusNode.dispose();
_addressController.dispose(); _addressController.dispose();
_personnelController.dispose(); _personnelController.dispose();
super.dispose(); super.dispose();

Loading…
Cancel
Save