|
@@ -3,6 +3,7 @@ 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_measure/view/measure/tool_chest_title.dart';
|
|
|
import 'package:fis_ui/index.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:get/get.dart';
|
|
@@ -27,15 +28,31 @@ class _MobileAnnotationSelectorState extends State<MobileAnnotationSelector> {
|
|
|
/// 数据
|
|
|
late final measureData = Get.find<MeasureDataController>();
|
|
|
|
|
|
+ bool isArrowMode = false;
|
|
|
+
|
|
|
+ void onChangedAnnotationType(
|
|
|
+ Object sender,
|
|
|
+ AnnotationType? e,
|
|
|
+ ) {
|
|
|
+ print("onChangedAnnotationType");
|
|
|
+ setState(() {
|
|
|
+ isArrowMode =
|
|
|
+ measureHandler.changedAnnotationType == AnnotationType.arrow;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
@override
|
|
|
void initState() {
|
|
|
- // application.switchAnnotation(
|
|
|
- // AnnotationType.label, measureData.getCommentsList[0]);
|
|
|
+ measureHandler.onChangedAnnotationType.addListener(onChangedAnnotationType);
|
|
|
+
|
|
|
super.initState();
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
void dispose() {
|
|
|
+ measureHandler.onChangedAnnotationType
|
|
|
+ .removeListener(onChangedAnnotationType);
|
|
|
+
|
|
|
super.dispose();
|
|
|
}
|
|
|
|
|
@@ -46,19 +63,24 @@ class _MobileAnnotationSelectorState extends State<MobileAnnotationSelector> {
|
|
|
const SizedBox(
|
|
|
height: 50,
|
|
|
),
|
|
|
- SizedBox(
|
|
|
- width: 150,
|
|
|
- height: 300,
|
|
|
- child: Scrollbar(
|
|
|
- controller: scrollController,
|
|
|
- isAlwaysShown: true,
|
|
|
- child: GridView.count(
|
|
|
+ _buildModeChangeBtn(),
|
|
|
+ const SizedBox(
|
|
|
+ height: 10,
|
|
|
+ ),
|
|
|
+ Expanded(
|
|
|
+ child: SizedBox(
|
|
|
+ width: 150,
|
|
|
+ child: Scrollbar(
|
|
|
controller: scrollController,
|
|
|
- crossAxisCount: 1,
|
|
|
- childAspectRatio: 3,
|
|
|
- children: measureData.getCommentsList.map((e) {
|
|
|
- return _buildNoteTools(e);
|
|
|
- }).toList(),
|
|
|
+ isAlwaysShown: true,
|
|
|
+ child: GridView.count(
|
|
|
+ controller: scrollController,
|
|
|
+ crossAxisCount: 1,
|
|
|
+ childAspectRatio: 3,
|
|
|
+ children: measureData.getCommentsList.map((e) {
|
|
|
+ return _buildNoteTools(e);
|
|
|
+ }).toList(),
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
@@ -94,7 +116,7 @@ class _MobileAnnotationSelectorState extends State<MobileAnnotationSelector> {
|
|
|
child: OutlinedButton(
|
|
|
child: Text(tools, style: style),
|
|
|
onPressed: () {
|
|
|
- PromptBox.toast('拖动添加');
|
|
|
+ PromptBox.toast('拖动以添加注释');
|
|
|
},
|
|
|
style: OutlinedButton.styleFrom(
|
|
|
shape: RoundedRectangleBorder(
|
|
@@ -113,4 +135,71 @@ class _MobileAnnotationSelectorState extends State<MobileAnnotationSelector> {
|
|
|
],
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+ Widget _buildModeChangeBtn() {
|
|
|
+ return SizedBox(
|
|
|
+ width: 150,
|
|
|
+ child: Row(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ InkWell(
|
|
|
+ child: _buildModeBtn(!isArrowMode, "文本", Icons.abc, true),
|
|
|
+ onTap: () {
|
|
|
+ measureHandler.changedAnnotationType = AnnotationType.label;
|
|
|
+ application.switchAnnotation(AnnotationType.label);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ InkWell(
|
|
|
+ child: _buildModeBtn(
|
|
|
+ isArrowMode, "箭头", Icons.compare_arrows_rounded, false),
|
|
|
+ onTap: () {
|
|
|
+ measureHandler.changedAnnotationType = AnnotationType.arrow;
|
|
|
+ application.switchAnnotation(AnnotationType.arrow);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget _buildModeBtn(
|
|
|
+ bool ifActive, String text, IconData iconData, bool ifLeft) {
|
|
|
+ const style = TextStyle(color: Colors.grey, fontSize: 12);
|
|
|
+ const activeStyle = TextStyle(color: Colors.white, fontSize: 12);
|
|
|
+ const borderColor = Colors.grey;
|
|
|
+ const activeBorderColor = Colors.white;
|
|
|
+ const borderSide = BorderSide(color: borderColor);
|
|
|
+ const activeBorderSide = BorderSide(color: activeBorderColor);
|
|
|
+ const leftBorderStyle = BorderRadius.only(
|
|
|
+ topLeft: Radius.circular(4),
|
|
|
+ bottomLeft: Radius.circular(4),
|
|
|
+ );
|
|
|
+ const rightBorderStyle = BorderRadius.only(
|
|
|
+ topRight: Radius.circular(4),
|
|
|
+ bottomRight: Radius.circular(4),
|
|
|
+ );
|
|
|
+ return Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ borderRadius: ifLeft ? leftBorderStyle : rightBorderStyle,
|
|
|
+ border: Border.fromBorderSide(ifActive ? activeBorderSide : borderSide),
|
|
|
+ ),
|
|
|
+ padding: const EdgeInsets.symmetric(
|
|
|
+ horizontal: 4,
|
|
|
+ vertical: 4,
|
|
|
+ ),
|
|
|
+ child: Row(
|
|
|
+ children: [
|
|
|
+ Icon(
|
|
|
+ iconData,
|
|
|
+ color: ifActive ? Colors.white : Colors.grey,
|
|
|
+ ),
|
|
|
+ const FSizedBox(
|
|
|
+ width: 6,
|
|
|
+ ),
|
|
|
+ Text(text, style: ifActive ? activeStyle : style),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|