|
@@ -1,6 +1,7 @@
|
|
|
import 'dart:ui' as ui;
|
|
|
import 'package:fis_measure/interfaces/process/items/item_feature.dart';
|
|
|
import 'package:fis_measure/interfaces/process/workspace/application.dart';
|
|
|
+import 'package:fis_measure/process/workspace/measure_data_controller.dart';
|
|
|
import 'package:fis_measure/values/colors.dart';
|
|
|
import 'package:fis_ui/index.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
@@ -20,6 +21,7 @@ class MeasureResultPanel extends StatefulWidget {
|
|
|
class _MeasureResultPanelState extends State<MeasureResultPanel> {
|
|
|
final _scrollController = ScrollController();
|
|
|
final application = Get.find<IApplication>();
|
|
|
+ final measureData = Get.find<MeasureDataController>();
|
|
|
|
|
|
final List<ResultLine> lines = [];
|
|
|
|
|
@@ -29,45 +31,50 @@ class _MeasureResultPanelState extends State<MeasureResultPanel> {
|
|
|
Widget build(BuildContext context) {
|
|
|
if (!hasOutputs) return const SizedBox();
|
|
|
|
|
|
- final child = Container(
|
|
|
- constraints: const BoxConstraints(
|
|
|
- maxWidth: 300,
|
|
|
- minWidth: 150,
|
|
|
- maxHeight: 400,
|
|
|
- ),
|
|
|
- decoration: BoxDecoration(
|
|
|
- border: Border.all(
|
|
|
- color: MeasureColors.ResultBorder,
|
|
|
- width: 2,
|
|
|
+ return Align(
|
|
|
+ alignment: _getAlignmentFromLocation(
|
|
|
+ measureData.measureSystemSetting.showResultLocation),
|
|
|
+ child: Container(
|
|
|
+ margin: const EdgeInsets.only(left: 20, top: 2, right: 20, bottom: 2),
|
|
|
+ constraints: const BoxConstraints(
|
|
|
+ maxWidth: 300,
|
|
|
+ minWidth: 150,
|
|
|
+ maxHeight: 400,
|
|
|
),
|
|
|
- borderRadius: BorderRadius.circular(4),
|
|
|
- color: Colors.black.withOpacity(0.7),
|
|
|
- ),
|
|
|
- // padding: const EdgeInsets.only(left: 2),
|
|
|
- child: FThemeWidget(
|
|
|
- data: Theme.of(context).copyWith(
|
|
|
- scrollbarTheme: ScrollbarThemeData(
|
|
|
- thumbColor: MaterialStateProperty.all(
|
|
|
- MeasureColors.ResultScrollbar,
|
|
|
- ),
|
|
|
- crossAxisMargin: 1,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ border: Border.all(
|
|
|
+ color: MeasureColors.ResultBorder,
|
|
|
+ width: 2,
|
|
|
),
|
|
|
+ borderRadius: BorderRadius.circular(4),
|
|
|
+ color: Colors.black.withOpacity(0.7),
|
|
|
),
|
|
|
- child: FScrollbar(
|
|
|
- isAlwaysShown: false,
|
|
|
- controller: _scrollController,
|
|
|
- radius: ui.Radius.zero,
|
|
|
- child: FSingleChildScrollView(
|
|
|
+ // padding: const EdgeInsets.only(left: 2),
|
|
|
+ child: FThemeWidget(
|
|
|
+ data: Theme.of(context).copyWith(
|
|
|
+ scrollbarTheme: ScrollbarThemeData(
|
|
|
+ thumbColor: MaterialStateProperty.all(
|
|
|
+ MeasureColors.ResultScrollbar,
|
|
|
+ ),
|
|
|
+ crossAxisMargin: 1,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: FScrollbar(
|
|
|
+ isAlwaysShown: false,
|
|
|
controller: _scrollController,
|
|
|
- child: FRepaintBoundary(
|
|
|
- child: FIntrinsicHeight(
|
|
|
- child: FIntrinsicWidth(
|
|
|
- child: FContainer(
|
|
|
- margin: const EdgeInsets.all(8),
|
|
|
- child: FColumn(
|
|
|
- mainAxisSize: MainAxisSize.min,
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: _buildMainList(),
|
|
|
+ radius: ui.Radius.zero,
|
|
|
+ child: FSingleChildScrollView(
|
|
|
+ controller: _scrollController,
|
|
|
+ child: FRepaintBoundary(
|
|
|
+ child: FIntrinsicHeight(
|
|
|
+ child: FIntrinsicWidth(
|
|
|
+ child: FContainer(
|
|
|
+ margin: const EdgeInsets.all(8),
|
|
|
+ child: FColumn(
|
|
|
+ mainAxisSize: MainAxisSize.min,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: _buildMainList(),
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
@@ -77,22 +84,46 @@ class _MeasureResultPanelState extends State<MeasureResultPanel> {
|
|
|
),
|
|
|
),
|
|
|
);
|
|
|
- return child;
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
void initState() {
|
|
|
_updateOutputs();
|
|
|
application.updateRenderReady.addListener(_onMeasureRerenderReady);
|
|
|
+ measureData.measureSystemSettingChanged
|
|
|
+ .addListener(_onMeasureSystemSettingChanged);
|
|
|
super.initState();
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
void dispose() {
|
|
|
application.updateRenderReady.removeListener(_onMeasureRerenderReady);
|
|
|
+ measureData.measureSystemSettingChanged
|
|
|
+ .removeListener(_onMeasureSystemSettingChanged);
|
|
|
super.dispose();
|
|
|
}
|
|
|
|
|
|
+ /// 样式更新事件监听
|
|
|
+ _onMeasureSystemSettingChanged(_, e) {
|
|
|
+ setState(() {});
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 面板对齐方式
|
|
|
+ Alignment _getAlignmentFromLocation(int locationNum) {
|
|
|
+ switch (locationNum) {
|
|
|
+ case 0:
|
|
|
+ return Alignment.topLeft;
|
|
|
+ case 1:
|
|
|
+ return Alignment.bottomLeft;
|
|
|
+ case 2:
|
|
|
+ return Alignment.topRight;
|
|
|
+ case 3:
|
|
|
+ return Alignment.bottomRight;
|
|
|
+ default:
|
|
|
+ return Alignment.topLeft;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
List<FWidget> _buildMainList() {
|
|
|
final list = <FWidget>[
|
|
|
const FSizedBox(height: 6),
|