tool_chest_title.dart 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. import 'package:fis_i18n/i18n.dart';
  2. import 'package:fis_measure/view/measure/measure_config/measure_configuation_page.dart';
  3. import 'package:fis_measure/view/measure/measure_config/widgets/measure_configuration_style.dart';
  4. import 'package:fis_measure/view/measure/operate_type_change_button.dart';
  5. import 'package:fis_theme/theme.dart';
  6. import 'package:fis_ui/index.dart';
  7. import 'package:fis_ui/interface/interactive_container.dart';
  8. import 'package:flutter/material.dart';
  9. import 'package:get/get.dart';
  10. /// 下拉选择的类
  11. // class MeasureSelectModel {
  12. // MeasureSelectModel({required this.name, required this.code});
  13. // final String name;
  14. // final String code;
  15. // }
  16. // enum MeasureOperateType {
  17. // tabMeasureTool,
  18. // tabNodesTool,
  19. // }
  20. /// 工具箱 样式配置之类
  21. class LeftSiderHold extends StatelessWidget implements FWidget {
  22. const LeftSiderHold({Key? key, this.ifHideConfig = false}) : super(key: key);
  23. final bool ifHideConfig; // 是否隐藏测量项配置入口
  24. @override
  25. FWidget build(BuildContext context) {
  26. return FContainer(
  27. width: 300,
  28. padding: const EdgeInsets.symmetric(
  29. horizontal: 10,
  30. vertical: 15,
  31. ),
  32. child: FColumn(
  33. // key: UniqueKey(),
  34. mainAxisSize: MainAxisSize.max,
  35. crossAxisAlignment: CrossAxisAlignment.start,
  36. children: [
  37. FRow(
  38. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  39. children: [
  40. // 工具箱文案
  41. FText(
  42. i18nBook.measure.toolbox.t,
  43. style: const TextStyle(
  44. color: Colors.white,
  45. ),
  46. ),
  47. LeftSiderHoldAllStyleConfig(ifHideConfig: ifHideConfig),
  48. ],
  49. ),
  50. // const _LeftSiderTabBar(),
  51. // _LeftSelectInput(),
  52. // _LeftPulldown(),
  53. ],
  54. ),
  55. );
  56. }
  57. }
  58. /// 测量样式 和配置
  59. class LeftSiderHoldAllStyleConfig extends StatelessWidget
  60. implements FInteractiveContainer {
  61. const LeftSiderHoldAllStyleConfig({Key? key, this.ifHideConfig = false})
  62. : super(key: key);
  63. final bool ifHideConfig; // 是否隐藏测量项配置入口
  64. @override
  65. final String pageName = 'LeftSiderHoldAllStyleConfig';
  66. @override
  67. FWidget build(BuildContext context) {
  68. return FRow(
  69. children: [
  70. FTextButton(
  71. name: "toPatternDialog",
  72. businessParent: this,
  73. onPressed: () {
  74. Get.dialog(
  75. PatternDialog(
  76. businessParent: this,
  77. ),
  78. );
  79. },
  80. child: FText(
  81. i18nBook.measure.style.t,
  82. style: TextStyle(
  83. color: FTheme.ins.colorScheme.primary,
  84. ),
  85. ),
  86. ),
  87. if (!ifHideConfig) ...[
  88. FTextButton(
  89. businessParent: this,
  90. name: "toMeasureConfigurationPage",
  91. onPressed: () {
  92. Get.dialog(
  93. const MeasureConfigurationPage(),
  94. );
  95. },
  96. child: FText(
  97. i18nBook.measure.config.t,
  98. style: TextStyle(
  99. color: FTheme.ins.colorScheme.primary,
  100. ),
  101. ),
  102. )
  103. ]
  104. ],
  105. );
  106. }
  107. }
  108. /// 测量工具 注释工具Tab [已废弃:重构为]
  109. // class _LeftSiderTabBar extends StatefulWidget implements FWidget {
  110. // const _LeftSiderTabBar();
  111. // @override
  112. // State<_LeftSiderTabBar> createState() => _LeftSiderTabBarState();
  113. // }
  114. // class _LeftSiderTabBarState extends State<_LeftSiderTabBar>
  115. // with TickerProviderStateMixin {
  116. // late final measureHandler = Get.find<MeasureHandler>();
  117. // late TabController tabController;
  118. // List<Center> tabs = [];
  119. // late final measureData = Get.find<MeasureDataController>();
  120. // /// 全部图片list
  121. // final measureController = Get.find<MeasureController>();
  122. // VidPlayerController playerController =
  123. // Get.find<IPlayerController>() as VidPlayerController;
  124. // @override
  125. // void initState() {
  126. // super.initState();
  127. // measureHandler.annotationsLoaded.addListener(onAnnotationsLoaded);
  128. // measureController.imageLoaded.addListener(_onImageLoaded);
  129. // }
  130. // @override
  131. // void dispose() {
  132. // super.dispose();
  133. // measureHandler.annotationsLoaded.removeListener(onAnnotationsLoaded);
  134. // measureController.imageLoaded.removeListener(_onImageLoaded);
  135. // tabController.dispose();
  136. // }
  137. // void initTab() {
  138. // final application = Get.find<IApplication>();
  139. // ///TODO:[Gavin] 虽然屏蔽了多幅,但是切换至多幅时候仍会存在问题【虽然只显示注释,但是默认会被切换至第一个测量项】
  140. // ///原因是Tab页切换优化为了FOffstage的方式,Measure Tab 实际没有被 dispose
  141. // ///比较妥协的临时解决方案是,触发切换注释时加上 500ms 延时【line 178:180】
  142. // if (application.isSingleFrame && application.visuals.length > 1) {
  143. // //多幅vid
  144. // tabs = [i18nBook.measure.annotationTool.t]
  145. // .map((e) => Center(child: Tab(text: e)))
  146. // .toList();
  147. // changeTabTo(MeasureOperateType.tabNodesTool);
  148. // } else {
  149. // tabs = [i18nBook.measure.measureTool.t, i18nBook.measure.annotationTool.t]
  150. // .map((e) => Center(child: Tab(text: e)))
  151. // .toList();
  152. // changeTabTo(MeasureOperateType.tabMeasureTool);
  153. // }
  154. // setState(() {});
  155. // }
  156. // void changeTabTo(e) {
  157. // measureHandler.currOperateType = e;
  158. // if (e == MeasureOperateType.tabMeasureTool) {
  159. // final measureMetaController = Get.find<MeasureMetaController>();
  160. // measureMetaController.setAvailableModes(measureData.currentMode);
  161. // measureMetaController.updateItemList();
  162. // } else {
  163. // final application = Get.find<IApplication>();
  164. // Future.delayed(const Duration(milliseconds: 500), () {
  165. // application.switchAnnotation(AnnotationType.label, "test");
  166. // });
  167. // }
  168. // }
  169. // // 应该在图像注释获取完成后再触发initTab
  170. // void onAnnotationsLoaded(Object sender, _) {
  171. // if (!mounted) return;
  172. // initTab();
  173. // }
  174. // void _onFrameLoadedAfterFirst(Object sender, VidUsImage? e) {
  175. // if (!mounted) return;
  176. // initTab();
  177. // playerController.firstFrameLoaded.removeListener(_onFrameLoadedAfterFirst);
  178. // }
  179. // void _onImageLoaded(Object sender, ExamImageInfo? e) {
  180. // playerController = Get.find<IPlayerController>() as VidPlayerController;
  181. // playerController.firstFrameLoaded.addListener(_onFrameLoadedAfterFirst);
  182. // }
  183. // @override
  184. // void didUpdateWidget(covariant _LeftSiderTabBar oldWidget) {
  185. // super.didUpdateWidget(oldWidget);
  186. // }
  187. // @override
  188. // FWidget build(BuildContext context) {
  189. // tabController = TabController(
  190. // vsync: this,
  191. // length: tabs.length,
  192. // initialIndex: 0,
  193. // );
  194. // final _colorScheme = FTheme.ins.colorScheme;
  195. // return FTabBar(
  196. // indicatorWeight: 2,
  197. // indicatorColor: _colorScheme.primary,
  198. // labelColor: _colorScheme.primary,
  199. // indicatorSize: TabBarIndicatorSize.label,
  200. // unselectedLabelColor: Colors.white,
  201. // onTap: (int index) {
  202. // try {
  203. // changeTabTo(MeasureOperateType.values[index]);
  204. // } catch (e) {
  205. // debugPrint(e.toString());
  206. // }
  207. // },
  208. // tabs: tabs,
  209. // controller: tabController,
  210. // );
  211. // }
  212. // }
  213. // class _LeftPulldown extends StatelessWidget implements FWidget {
  214. // @override
  215. // FWidget build(BuildContext context) {
  216. // return FContainer(
  217. // margin: const EdgeInsets.symmetric(vertical: 4),
  218. // child: FSelect<MeasureSelectModel, String>(
  219. // source: [
  220. // MeasureSelectModel(
  221. // name: 'General',
  222. // code: 'General',
  223. // )
  224. // ],
  225. // hintText: i18nBook.measure.selectMeasureItem.t,
  226. // value: 'General',
  227. // clearable: false,
  228. // height: 36,
  229. // width: 400,
  230. // optionLabelExtractor: (data) => data.name,
  231. // optionValueExtractor: (data) => data.code,
  232. // onSelectChanged: (value, index) {},
  233. // ),
  234. // );
  235. // }
  236. // }