|
@@ -1,4 +1,6 @@
|
|
|
import 'package:fis_i18n/i18n.dart';
|
|
|
+import 'package:fis_measure/interfaces/process/workspace/application.dart';
|
|
|
+import 'package:fis_measure/process/workspace/measure_data_controller.dart';
|
|
|
import 'package:fis_measure/process/workspace/measure_handler.dart';
|
|
|
import 'package:fis_measure/view/measure/measure_config/measure_configuation_page.dart';
|
|
|
import 'package:fis_measure/view/measure/measure_config/widgets/measure_configuration_style.dart';
|
|
@@ -114,33 +116,46 @@ class _LeftSiderTabBarState extends State<_LeftSiderTabBar>
|
|
|
with TickerProviderStateMixin {
|
|
|
late final measureHandler = Get.find<MeasureHandler>();
|
|
|
late TabController tabController;
|
|
|
+ late IApplication application = Get.find<IApplication>();
|
|
|
+ List<Center> tabs = [];
|
|
|
+ late final measureData = Get.find<MeasureDataController>();
|
|
|
|
|
|
-
|
|
|
- List<String> tabTitles = [
|
|
|
- i18nBook.auth.tabOfLoginByAccountPwd.t,
|
|
|
- i18nBook.auth.tabOfLoginByVerificationCode.t,
|
|
|
- ];
|
|
|
@override
|
|
|
void initState() {
|
|
|
super.initState();
|
|
|
- tabController = TabController(
|
|
|
- vsync: this,
|
|
|
- length: tabTitles.length,
|
|
|
- initialIndex: TagEnum.MeasureTool.index,
|
|
|
- );
|
|
|
+ measureData.getItemMetaListChanged.addListener(getItemMetaListChanged);
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
void dispose() {
|
|
|
super.dispose();
|
|
|
+
|
|
|
+ measureData.getItemMetaListChanged.removeListener(getItemMetaListChanged);
|
|
|
+
|
|
|
tabController.dispose();
|
|
|
}
|
|
|
|
|
|
- void onTabChanged(int index) {
|
|
|
- print(index);
|
|
|
- print(TagEnum.values[index]);
|
|
|
-
|
|
|
-
|
|
|
+ void getItemMetaListChanged(sender, e) {
|
|
|
+ if (mounted) {
|
|
|
+ Future.delayed(const Duration(milliseconds: 300), () {
|
|
|
+ setState(() {
|
|
|
+ application = Get.find<IApplication>();
|
|
|
+ if (application.visuals.length > 1) {
|
|
|
+ tabs = [i18nBook.measure.annotationTool.t]
|
|
|
+ .map((e) => Center(child: Tab(text: e)))
|
|
|
+ .toList();
|
|
|
+ } else {
|
|
|
+ tabs = [
|
|
|
+ i18nBook.measure.measureTool.t,
|
|
|
+ i18nBook.measure.annotationTool.t
|
|
|
+ ].map((e) => Center(child: Tab(text: e))).toList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@override
|
|
@@ -150,10 +165,11 @@ class _LeftSiderTabBarState extends State<_LeftSiderTabBar>
|
|
|
|
|
|
@override
|
|
|
FWidget build(BuildContext context) {
|
|
|
- final tabs = [
|
|
|
- i18nBook.measure.measureTool.t,
|
|
|
- i18nBook.measure.annotationTool.t
|
|
|
- ].map((e) => Center(child: Tab(text: e))).toList();
|
|
|
+ tabController = TabController(
|
|
|
+ vsync: this,
|
|
|
+ length: tabs.length,
|
|
|
+ initialIndex: 0,
|
|
|
+ );
|
|
|
final _colorScheme = FTheme.ins.colorScheme;
|
|
|
|
|
|
return FTabBar(
|
|
@@ -165,8 +181,6 @@ class _LeftSiderTabBarState extends State<_LeftSiderTabBar>
|
|
|
onTap: (int index) {
|
|
|
try {
|
|
|
measureHandler.changedTab = TagEnum.values[index];
|
|
|
-
|
|
|
- print(index);
|
|
|
} catch (e) {
|
|
|
print(e);
|
|
|
}
|
|
@@ -174,45 +188,6 @@ class _LeftSiderTabBarState extends State<_LeftSiderTabBar>
|
|
|
tabs: tabs,
|
|
|
controller: tabController,
|
|
|
);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- FWidget _buildTab(TagEnum tag, String title) {
|
|
|
- return FTextButton(
|
|
|
- style: ButtonStyle(
|
|
|
- padding: MaterialStateProperty.all(
|
|
|
- const EdgeInsets.all(
|
|
|
- 6,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- onPressed: () {
|
|
|
- measureHandler.changedTab = tag;
|
|
|
- setState(() {});
|
|
|
- },
|
|
|
- child: FText(
|
|
|
- title,
|
|
|
- style: TextStyle(
|
|
|
- color: measureHandler.changedTab == tag
|
|
|
- ? FTheme.ins.colorScheme.primary
|
|
|
- : Colors.white,
|
|
|
- ),
|
|
|
- ),
|
|
|
- );
|
|
|
}
|
|
|
}
|
|
|
|