|
@@ -133,49 +133,44 @@ class _LeftSiderTabBarState extends State<_LeftSiderTabBar>
|
|
|
@override
|
|
|
void initState() {
|
|
|
super.initState();
|
|
|
- initTab();
|
|
|
+ measureHandler.commentsLoaded.addListener(onCommentsLoaded);
|
|
|
measureController.imageLoaded.addListener(onImageLoaded);
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
void dispose() {
|
|
|
super.dispose();
|
|
|
+ measureHandler.commentsLoaded.removeListener(onCommentsLoaded);
|
|
|
measureController.imageLoaded.removeListener(onImageLoaded);
|
|
|
tabController.dispose();
|
|
|
}
|
|
|
|
|
|
void initTab() {
|
|
|
- Future.delayed(const Duration(milliseconds: 500), () {
|
|
|
- application = Get.find<IApplication>();
|
|
|
- if (application.isSingleFrame) {
|
|
|
- if (application.visuals.length > 1) {
|
|
|
- //多幅vid
|
|
|
- tabs = [i18nBook.measure.annotationTool.t]
|
|
|
- .map((e) => Center(child: Tab(text: e)))
|
|
|
- .toList();
|
|
|
- changeTabTo(TabEnum.tabNodesTool);
|
|
|
- } else {
|
|
|
- tabs = [
|
|
|
- i18nBook.measure.measureTool.t,
|
|
|
- i18nBook.measure.annotationTool.t
|
|
|
- ].map((e) => Center(child: Tab(text: e))).toList();
|
|
|
- changeTabTo(TabEnum.tabNodesTool);
|
|
|
- }
|
|
|
+ application = Get.find<IApplication>();
|
|
|
+ if (application.isSingleFrame) {
|
|
|
+ if (application.visuals.length > 1) {
|
|
|
+ //多幅vid
|
|
|
+ tabs = [i18nBook.measure.annotationTool.t]
|
|
|
+ .map((e) => Center(child: Tab(text: e)))
|
|
|
+ .toList();
|
|
|
+ changeTabTo(TabEnum.tabNodesTool);
|
|
|
} else {
|
|
|
tabs = [
|
|
|
i18nBook.measure.measureTool.t,
|
|
|
i18nBook.measure.annotationTool.t
|
|
|
].map((e) => Center(child: Tab(text: e))).toList();
|
|
|
- changeTabTo(TabEnum.tabNodesTool);
|
|
|
+ changeTabTo(TabEnum.tabMeasureTool);
|
|
|
}
|
|
|
- setState(() {});
|
|
|
- });
|
|
|
+ } else {
|
|
|
+ tabs = [i18nBook.measure.measureTool.t, i18nBook.measure.annotationTool.t]
|
|
|
+ .map((e) => Center(child: Tab(text: e)))
|
|
|
+ .toList();
|
|
|
+ changeTabTo(TabEnum.tabMeasureTool);
|
|
|
+ }
|
|
|
+ setState(() {});
|
|
|
}
|
|
|
|
|
|
void changeTabTo(e) {
|
|
|
- if (measureHandler.changedTab == e) {
|
|
|
- return;
|
|
|
- }
|
|
|
measureHandler.changedTab = e;
|
|
|
if (e == TabEnum.tabMeasureTool) {
|
|
|
final measureMetaController = Get.find<MeasureMetaController>();
|
|
@@ -187,6 +182,12 @@ class _LeftSiderTabBarState extends State<_LeftSiderTabBar>
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 应该在图像注释获取完成后再触发initTab
|
|
|
+ void onCommentsLoaded(Object sender, _) {
|
|
|
+ if (!mounted) return;
|
|
|
+ initTab();
|
|
|
+ }
|
|
|
+
|
|
|
void onImageLoaded(Object sender, ExamImageInfo? e) {
|
|
|
if (!mounted) return;
|
|
|
initTab();
|