123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- import 'package:fis_i18n/i18n.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';
- import 'package:fis_measure/view/measure/operate_type_change_button.dart';
- import 'package:fis_theme/theme.dart';
- import 'package:fis_ui/index.dart';
- import 'package:fis_ui/interface/interactive_container.dart';
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- /// 下拉选择的类
- // class MeasureSelectModel {
- // MeasureSelectModel({required this.name, required this.code});
- // final String name;
- // final String code;
- // }
- // enum MeasureOperateType {
- // tabMeasureTool,
- // tabNodesTool,
- // }
- /// 工具箱 样式配置之类
- class LeftSiderHold extends StatelessWidget implements FWidget {
- const LeftSiderHold({Key? key, this.ifHideConfig = false}) : super(key: key);
- final bool ifHideConfig; // 是否隐藏测量项配置入口
- @override
- FWidget build(BuildContext context) {
- return FContainer(
- width: 300,
- padding: const EdgeInsets.symmetric(
- horizontal: 10,
- vertical: 15,
- ),
- child: FColumn(
- // key: UniqueKey(),
- mainAxisSize: MainAxisSize.max,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- FRow(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- // 工具箱文案
- FText(
- i18nBook.measure.toolbox.t,
- style: const TextStyle(
- color: Colors.white,
- ),
- ),
- LeftSiderHoldAllStyleConfig(ifHideConfig: ifHideConfig),
- ],
- ),
- // const _LeftSiderTabBar(),
- // _LeftSelectInput(),
- // _LeftPulldown(),
- ],
- ),
- );
- }
- }
- /// 测量样式 和配置
- class LeftSiderHoldAllStyleConfig extends StatelessWidget
- implements FInteractiveContainer {
- const LeftSiderHoldAllStyleConfig({Key? key, this.ifHideConfig = false})
- : super(key: key);
- final bool ifHideConfig; // 是否隐藏测量项配置入口
- @override
- final String pageName = 'LeftSiderHoldAllStyleConfig';
- @override
- FWidget build(BuildContext context) {
- return FRow(
- children: [
- FTextButton(
- name: "toPatternDialog",
- businessParent: this,
- onPressed: () {
- Get.dialog(
- PatternDialog(
- businessParent: this,
- ),
- );
- },
- child: FText(
- i18nBook.measure.style.t,
- style: TextStyle(
- color: FTheme.ins.colorScheme.primary,
- ),
- ),
- ),
- if (!ifHideConfig) ...[
- FTextButton(
- businessParent: this,
- name: "toMeasureConfigurationPage",
- onPressed: () {
- Get.dialog(
- const MeasureConfigurationPage(),
- );
- },
- child: FText(
- i18nBook.measure.config.t,
- style: TextStyle(
- color: FTheme.ins.colorScheme.primary,
- ),
- ),
- )
- ]
- ],
- );
- }
- }
- /// 测量工具 注释工具Tab [已废弃:重构为]
- // class _LeftSiderTabBar extends StatefulWidget implements FWidget {
- // const _LeftSiderTabBar();
- // @override
- // State<_LeftSiderTabBar> createState() => _LeftSiderTabBarState();
- // }
- // class _LeftSiderTabBarState extends State<_LeftSiderTabBar>
- // with TickerProviderStateMixin {
- // late final measureHandler = Get.find<MeasureHandler>();
- // late TabController tabController;
- // List<Center> tabs = [];
- // late final measureData = Get.find<MeasureDataController>();
- // /// 全部图片list
- // final measureController = Get.find<MeasureController>();
- // VidPlayerController playerController =
- // Get.find<IPlayerController>() as VidPlayerController;
- // @override
- // void initState() {
- // super.initState();
- // measureHandler.annotationsLoaded.addListener(onAnnotationsLoaded);
- // measureController.imageLoaded.addListener(_onImageLoaded);
- // }
- // @override
- // void dispose() {
- // super.dispose();
- // measureHandler.annotationsLoaded.removeListener(onAnnotationsLoaded);
- // measureController.imageLoaded.removeListener(_onImageLoaded);
- // tabController.dispose();
- // }
- // void initTab() {
- // final application = Get.find<IApplication>();
- // ///TODO:[Gavin] 虽然屏蔽了多幅,但是切换至多幅时候仍会存在问题【虽然只显示注释,但是默认会被切换至第一个测量项】
- // ///原因是Tab页切换优化为了FOffstage的方式,Measure Tab 实际没有被 dispose
- // ///比较妥协的临时解决方案是,触发切换注释时加上 500ms 延时【line 178:180】
- // if (application.isSingleFrame && application.visuals.length > 1) {
- // //多幅vid
- // tabs = [i18nBook.measure.annotationTool.t]
- // .map((e) => Center(child: Tab(text: e)))
- // .toList();
- // changeTabTo(MeasureOperateType.tabNodesTool);
- // } else {
- // tabs = [i18nBook.measure.measureTool.t, i18nBook.measure.annotationTool.t]
- // .map((e) => Center(child: Tab(text: e)))
- // .toList();
- // changeTabTo(MeasureOperateType.tabMeasureTool);
- // }
- // setState(() {});
- // }
- // void changeTabTo(e) {
- // measureHandler.currOperateType = e;
- // if (e == MeasureOperateType.tabMeasureTool) {
- // final measureMetaController = Get.find<MeasureMetaController>();
- // measureMetaController.setAvailableModes(measureData.currentMode);
- // measureMetaController.updateItemList();
- // } else {
- // final application = Get.find<IApplication>();
- // Future.delayed(const Duration(milliseconds: 500), () {
- // application.switchAnnotation(AnnotationType.label, "test");
- // });
- // }
- // }
- // // 应该在图像注释获取完成后再触发initTab
- // void onAnnotationsLoaded(Object sender, _) {
- // if (!mounted) return;
- // initTab();
- // }
- // void _onFrameLoadedAfterFirst(Object sender, VidUsImage? e) {
- // if (!mounted) return;
- // initTab();
- // playerController.firstFrameLoaded.removeListener(_onFrameLoadedAfterFirst);
- // }
- // void _onImageLoaded(Object sender, ExamImageInfo? e) {
- // playerController = Get.find<IPlayerController>() as VidPlayerController;
- // playerController.firstFrameLoaded.addListener(_onFrameLoadedAfterFirst);
- // }
- // @override
- // void didUpdateWidget(covariant _LeftSiderTabBar oldWidget) {
- // super.didUpdateWidget(oldWidget);
- // }
- // @override
- // FWidget build(BuildContext context) {
- // tabController = TabController(
- // vsync: this,
- // length: tabs.length,
- // initialIndex: 0,
- // );
- // final _colorScheme = FTheme.ins.colorScheme;
- // return FTabBar(
- // indicatorWeight: 2,
- // indicatorColor: _colorScheme.primary,
- // labelColor: _colorScheme.primary,
- // indicatorSize: TabBarIndicatorSize.label,
- // unselectedLabelColor: Colors.white,
- // onTap: (int index) {
- // try {
- // changeTabTo(MeasureOperateType.values[index]);
- // } catch (e) {
- // debugPrint(e.toString());
- // }
- // },
- // tabs: tabs,
- // controller: tabController,
- // );
- // }
- // }
- // class _LeftPulldown extends StatelessWidget implements FWidget {
- // @override
- // FWidget build(BuildContext context) {
- // return FContainer(
- // margin: const EdgeInsets.symmetric(vertical: 4),
- // child: FSelect<MeasureSelectModel, String>(
- // source: [
- // MeasureSelectModel(
- // name: 'General',
- // code: 'General',
- // )
- // ],
- // hintText: i18nBook.measure.selectMeasureItem.t,
- // value: 'General',
- // clearable: false,
- // height: 36,
- // width: 400,
- // optionLabelExtractor: (data) => data.name,
- // optionValueExtractor: (data) => data.code,
- // onSelectChanged: (value, index) {},
- // ),
- // );
- // }
- // }
|