|
|
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|
|
import 'package:get/get.dart';
|
|
|
import 'package:injectable/injectable.dart';
|
|
|
import 'package:keyboard/base/base_controller.dart';
|
|
|
+import 'package:keyboard/module/intimacy_analyse/screenshot_reply/intimacy_analyse_screenshot_reply_controller.dart';
|
|
|
import 'package:keyboard/resource/string.gen.dart';
|
|
|
|
|
|
import '../../data/consts/event_report.dart';
|
|
|
@@ -9,6 +10,7 @@ import '../../handler/event_handler.dart';
|
|
|
import '../../router/app_page_arguments.dart';
|
|
|
import '../../utils/atmob_log.dart';
|
|
|
import 'enums/intimacy_analyse_tab.dart';
|
|
|
+import 'enums/screenshot_reply_tab.dart';
|
|
|
|
|
|
/// 亲密度分析Controller
|
|
|
@injectable
|
|
|
@@ -29,6 +31,9 @@ class IntimacyAnalyseController extends BaseController
|
|
|
/// PageView是否允许滑动切换
|
|
|
RxBool isPageViewSwipeEnabled = false.obs;
|
|
|
|
|
|
+ /// 当前Tab的索引
|
|
|
+ final RxInt _currentIndex = 0.obs;
|
|
|
+
|
|
|
@override
|
|
|
void onInit() {
|
|
|
super.onInit();
|
|
|
@@ -63,9 +68,22 @@ class IntimacyAnalyseController extends BaseController
|
|
|
EventHandler.report(EventId.event_09001);
|
|
|
} else if (tabIndex ==
|
|
|
IntimacyAnalyseTab.intimacyAnalyseScreenshotReply.tabIndex) {
|
|
|
- EventHandler.report(EventId.event_10001);
|
|
|
+ if (Get.isRegistered<IntimacyAnalyseScreenshotReplyController>()) {
|
|
|
+ var controller = Get.find<IntimacyAnalyseScreenshotReplyController>();
|
|
|
+ if (controller.currentTabIndex.value ==
|
|
|
+ ScreenshotReplyTab.conversationAnalysis.tabIndex) {
|
|
|
+ EventHandler.report(EventId.event_10001);
|
|
|
+ } else {
|
|
|
+ EventHandler.report(EventId.event_10004);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ EventHandler.report(EventId.event_10001);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ _currentIndex.listen((newIndex) {
|
|
|
+ _reportEvent(newIndex);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/// 返回上一页
|
|
|
@@ -82,12 +100,28 @@ class IntimacyAnalyseController extends BaseController
|
|
|
|
|
|
/// 处理Tab切换,联动PageView
|
|
|
void handleTabChange(int index) {
|
|
|
+ if (_currentIndex.value == index) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
pageController.animateToPage(
|
|
|
index,
|
|
|
duration: const Duration(milliseconds: 300),
|
|
|
curve: Curves.fastOutSlowIn,
|
|
|
);
|
|
|
+ _currentIndex.value = index;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 处理PageView切换,联动Tab
|
|
|
+ void handlePageChange(int index) {
|
|
|
+ if (_currentIndex.value == index) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ tabController.animateTo(index, duration: const Duration(milliseconds: 300));
|
|
|
+ _currentIndex.value = index;
|
|
|
+ }
|
|
|
|
|
|
+ /// 埋点
|
|
|
+ void _reportEvent(int index) {
|
|
|
if (index == IntimacyAnalyseTab.intimacyAnalyseReport.tabIndex) {
|
|
|
EventHandler.report(EventId.event_09001);
|
|
|
} else if (index ==
|
|
|
@@ -95,9 +129,4 @@ class IntimacyAnalyseController extends BaseController
|
|
|
EventHandler.report(EventId.event_10001);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- /// 处理PageView切换,联动Tab
|
|
|
- void handlePageChange(int index) {
|
|
|
- tabController.animateTo(index, duration: const Duration(milliseconds: 300));
|
|
|
- }
|
|
|
}
|