Browse Source

修改思维导图缓存状态

newdev_shunjiawei
tanlongsheng 1 year ago
parent
commit
d4b5a233eb
  1. 6
      lib/modules/meeting/controllers/meeting_details_controller.dart
  2. 24
      lib/modules/meeting/views/meeting_details_view.dart
  3. 7
      lib/modules/meeting/views/mind_map_tab.dart

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

@ -25,7 +25,7 @@ class MeetingDetailsController extends GetxController
final PlayerController playerController = PlayerController();
RxBool isTop = false.obs;
RxInt durationMax = 0.obs;
RxDouble dragOffset = 200.0.w.obs;
RxDouble dragOffset = 210.0.w.obs;
int id = 0;
@ -86,6 +86,10 @@ class MeetingDetailsController extends GetxController
final data = await SqfliteApi.getMeetingDetails(id);
meetingData.value = MeetingModel.fromJson(data);
meetingDetails.value = MeetingDetailsModel.fromJson(data['details']);
if (meetingDetails.value.summary.isNotEmpty) {
dragOffset.value = 0;
isTop.value = true;
}
await playerController.preparePlayer(
path: meetingData.value.filepath,
noOfSamples: 1200,

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

@ -183,16 +183,16 @@ class MeetingDetailsView extends GetView<MeetingDetailsController> {
controller.dragOffset.value = 0;
controller.isTop.value = true;
} else {
controller.dragOffset.value = 200.w;
controller.dragOffset.value = 210.w;
controller.isTop.value = false;
}
} else {
if (!controller.isTop.value) {
controller.dragOffset.value = 200.w;
controller.dragOffset.value = 210.w;
return;
}
if (offset < -60) {
controller.dragOffset.value = 200.w;
controller.dragOffset.value = 210.w;
controller.isTop.value = false;
} else {
controller.dragOffset.value = 0;
@ -226,11 +226,15 @@ class MeetingDetailsView extends GetView<MeetingDetailsController> {
child: TabBarView(
controller: controller.tabController,
physics: const NeverScrollableScrollPhysics(),
children: const [
OverviewTab(),
SpeechTab(),
SummaryTab(),
MindMapTab(),
children: [
const OverviewTab(),
const SpeechTab(),
const SummaryTab(),
Obx(
() => controller.meetingDetails.value.summary.isNotEmpty
? const MindMapTab()
: const SizedBox(),
),
],
),
),
@ -244,8 +248,8 @@ class MeetingDetailsView extends GetView<MeetingDetailsController> {
() => SizedBox(
height: controller.dragOffset.value < 0
? 0
: controller.dragOffset.value > 200.w
? 200.w
: controller.dragOffset.value > 210.w
? 210.w
: controller.dragOffset.value,
child: Stack(
children: [

7
lib/modules/meeting/views/mind_map_tab.dart

@ -11,7 +11,8 @@ class MindMapTab extends StatefulWidget {
State<MindMapTab> createState() => _MindMapTabState();
}
class _MindMapTabState extends State<MindMapTab> {
class _MindMapTabState extends State<MindMapTab>
with AutomaticKeepAliveClientMixin {
late final WebViewController _controller;
final _meetingDetailsController = Get.find<MeetingDetailsController>();
@ -93,8 +94,12 @@ ${_meetingDetailsController.meetingDetails.value.summary}
..loadHtmlString(html);
}
@override
bool get wantKeepAlive => true;
@override
Widget build(BuildContext context) {
super.build(context);
return WebViewWidget(
controller: _controller,
);

Loading…
Cancel
Save