|
@@ -1,149 +1,116 @@
|
|
|
-import 'package:fis_measure/interfaces/process/items/item_metas.dart';
|
|
|
-import 'package:fis_measure/interfaces/process/items/types.dart';
|
|
|
-import 'package:fis_measure/process/workspace/measure_3d_view_controller.dart';
|
|
|
-import 'package:fis_measure/view/measure/measure_tool.dart';
|
|
|
+import 'package:fis_measure/interfaces/enums/annotation.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/utils/prompt_box.dart';
|
|
|
import 'package:fis_ui/index.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:get/get.dart';
|
|
|
-import 'package:vid/us/vid_us_unit.dart';
|
|
|
|
|
|
-/// 移动端测量项选择器(继承自 测量项页面)
|
|
|
-class MobileAnnotationSelector extends LeftSiderSelectMeasure {
|
|
|
+/// 注释项
|
|
|
+///
|
|
|
+// ignore: must_be_immutable
|
|
|
+class MobileAnnotationSelector extends StatefulWidget implements FWidget {
|
|
|
const MobileAnnotationSelector({Key? key}) : super(key: key);
|
|
|
-
|
|
|
@override
|
|
|
- FState<LeftSiderSelectMeasure> createState() => _MobileAnnotationSelector();
|
|
|
+ State<StatefulWidget> createState() => _MobileAnnotationSelectorState();
|
|
|
}
|
|
|
|
|
|
-class _MobileAnnotationSelector extends LeftSiderSelectMeasureState {
|
|
|
- late final measure3DViewController = Get.find<Measure3DViewController>();
|
|
|
+class _MobileAnnotationSelectorState extends State<MobileAnnotationSelector> {
|
|
|
+ // ignore: non_constant_identifier_names
|
|
|
+ // static final C_SUPPORTED_TEXTS = measureData.getCommentsList;
|
|
|
+
|
|
|
+ final scrollController = ScrollController();
|
|
|
+ final application = Get.find<IApplication>();
|
|
|
+ late final measureHandler = Get.find<MeasureHandler>();
|
|
|
|
|
|
- /// 写死的移动端测量项
|
|
|
- List<MobileMeasureBtn> mobileMeasureBtnList = [
|
|
|
- MobileMeasureBtn(
|
|
|
- icon: Icons.linear_scale,
|
|
|
- displayName: '距离',
|
|
|
- itemMeta: ItemMeta(
|
|
|
- MeasureTypes.Distance,
|
|
|
- measureType: MeasureTypes.Distance,
|
|
|
- description: MeasureTypes.Distance,
|
|
|
- briefAnnotation: "D",
|
|
|
- outputs: [
|
|
|
- ItemOutputMeta(MeasureTypes.Distance, "Distance", VidUsUnit.cm),
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- MobileMeasureBtn(
|
|
|
- icon: Icons.border_style,
|
|
|
- displayName: '周长',
|
|
|
- itemMeta: ItemMeta(
|
|
|
- MeasureTypes.Perimeter,
|
|
|
- measureType: MeasureTypes.Perimeter,
|
|
|
- description: MeasureTypes.Perimeter,
|
|
|
- briefAnnotation: "P",
|
|
|
- outputs: [
|
|
|
- ItemOutputMeta(MeasureTypes.Perimeter, "Perimeter", VidUsUnit.cm),
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- MobileMeasureBtn(
|
|
|
- icon: Icons.format_shapes,
|
|
|
- displayName: '面积',
|
|
|
- itemMeta: ItemMeta(
|
|
|
- MeasureTypes.Area,
|
|
|
- measureType: MeasureTypes.Area,
|
|
|
- description: MeasureTypes.Area,
|
|
|
- briefAnnotation: "A",
|
|
|
- outputs: [
|
|
|
- ItemOutputMeta(MeasureTypes.Area, "Area", VidUsUnit.cm2),
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- ];
|
|
|
+ /// 数据
|
|
|
+ late final measureData = Get.find<MeasureDataController>();
|
|
|
|
|
|
@override
|
|
|
- FWidget build(BuildContext context) {
|
|
|
- return FSizedBox(
|
|
|
- width: 100,
|
|
|
- height: 320,
|
|
|
- child: FColumn(
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- mainAxisSize: MainAxisSize.max,
|
|
|
- children: [
|
|
|
- const FSizedBox(height: 30),
|
|
|
- ...mobileMeasureBtnList.map((e) {
|
|
|
- return _buildMeasureBtn(e.itemMeta, e.itemMeta.name == activeName,
|
|
|
- e.displayName, e.icon);
|
|
|
- }).toList(),
|
|
|
- ]),
|
|
|
- );
|
|
|
+ void initState() {
|
|
|
+ // application.switchAnnotation(
|
|
|
+ // AnnotationType.label, measureData.getCommentsList[0]);
|
|
|
+ super.initState();
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
+ void dispose() {
|
|
|
+ super.dispose();
|
|
|
}
|
|
|
|
|
|
- FWidget _buildMeasureBtn(
|
|
|
- ItemMeta itemMeta, bool ifActive, String displayName, IconData icon) {
|
|
|
- return FInkWell(
|
|
|
- onTap: () {
|
|
|
- if (ifActive) {
|
|
|
- changeItem(
|
|
|
- ItemMeta(
|
|
|
- "None",
|
|
|
- description: "None",
|
|
|
- outputs: [
|
|
|
- ItemOutputMeta("None", "None", VidUsUnit.cm2),
|
|
|
- ],
|
|
|
+ @override
|
|
|
+ Widget build(BuildContext context) {
|
|
|
+ return Column(
|
|
|
+ children: [
|
|
|
+ const SizedBox(
|
|
|
+ height: 50,
|
|
|
+ ),
|
|
|
+ SizedBox(
|
|
|
+ width: 150,
|
|
|
+ height: 300,
|
|
|
+ child: Scrollbar(
|
|
|
+ controller: scrollController,
|
|
|
+ isAlwaysShown: true,
|
|
|
+ child: GridView.count(
|
|
|
+ controller: scrollController,
|
|
|
+ crossAxisCount: 1,
|
|
|
+ childAspectRatio: 3,
|
|
|
+ children: measureData.getCommentsList.map((e) {
|
|
|
+ return _buildNoteTools(e);
|
|
|
+ }).toList(),
|
|
|
),
|
|
|
- );
|
|
|
- } else {
|
|
|
- changeItem(itemMeta);
|
|
|
- }
|
|
|
- },
|
|
|
- child: Container(
|
|
|
- margin: const EdgeInsets.fromLTRB(0, 10, 10, 10),
|
|
|
- padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
|
|
|
- decoration: ifActive
|
|
|
- ? BoxDecoration(
|
|
|
- border: Border.all(color: Colors.grey),
|
|
|
- borderRadius: BorderRadiusGeometry.lerp(
|
|
|
- BorderRadius.circular(10), BorderRadius.circular(10), 10),
|
|
|
- )
|
|
|
- : BoxDecoration(
|
|
|
- border: Border.all(color: Colors.transparent),
|
|
|
- borderRadius: BorderRadiusGeometry.lerp(
|
|
|
- BorderRadius.circular(10), BorderRadius.circular(10), 10),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget _buildNoteTools(String tools) {
|
|
|
+ const style = TextStyle(color: Colors.white, fontSize: 12);
|
|
|
+ const dragStyle = TextStyle(color: Colors.amber, fontSize: 12);
|
|
|
+ return Row(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ children: [
|
|
|
+ Draggable<String>(
|
|
|
+ data: tools,
|
|
|
+ dragAnchorStrategy: (data, context, offset) {
|
|
|
+ return const Offset(100, 50);
|
|
|
+ },
|
|
|
+ child: const Icon(
|
|
|
+ Icons.drag_indicator,
|
|
|
+ color: Colors.grey,
|
|
|
+ ),
|
|
|
+ feedback: Material(
|
|
|
+ color: Colors.transparent,
|
|
|
+ child: Text(tools, style: dragStyle),
|
|
|
+ ),
|
|
|
+ onDragStarted: () {
|
|
|
+ measureHandler.changedAnnotationType = AnnotationType.label;
|
|
|
+ application.switchAnnotation(AnnotationType.label, tools);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ Expanded(
|
|
|
+ child: OutlinedButton(
|
|
|
+ child: Text(tools, style: style),
|
|
|
+ onPressed: () {
|
|
|
+ PromptBox.toast('拖动添加');
|
|
|
+ },
|
|
|
+ style: OutlinedButton.styleFrom(
|
|
|
+ shape: RoundedRectangleBorder(
|
|
|
+ borderRadius: BorderRadius.circular(4),
|
|
|
),
|
|
|
- child: FColumn(
|
|
|
- children: [
|
|
|
- const FSizedBox(
|
|
|
- height: 10,
|
|
|
- ),
|
|
|
- FIcon(
|
|
|
- icon,
|
|
|
- color: ifActive
|
|
|
- ? Colors.white
|
|
|
- : const Color.fromARGB(255, 124, 124, 124),
|
|
|
- ),
|
|
|
- FText(
|
|
|
- displayName,
|
|
|
- style: TextStyle(
|
|
|
- color: ifActive
|
|
|
- ? Colors.white
|
|
|
- : const Color.fromARGB(255, 124, 124, 124),
|
|
|
+ side: const BorderSide(
|
|
|
+ color: Color.fromRGBO(124, 124, 124, 1),
|
|
|
),
|
|
|
+ fixedSize: const Size.fromHeight(40),
|
|
|
),
|
|
|
- const FSizedBox(
|
|
|
- height: 10,
|
|
|
- ),
|
|
|
- ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ const FSizedBox(
|
|
|
+ width: 12,
|
|
|
),
|
|
|
- ),
|
|
|
+ ],
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-class MobileMeasureBtn {
|
|
|
- ItemMeta itemMeta;
|
|
|
- String displayName;
|
|
|
- IconData icon;
|
|
|
- MobileMeasureBtn(
|
|
|
- {required this.itemMeta, required this.displayName, required this.icon});
|
|
|
-}
|