|
@@ -53,54 +53,6 @@ class StyleConfigPage extends FStatelessWidget {
|
|
|
final measureData = Get.find<MeasureDataController>();
|
|
|
final mouseState = Get.find<IMouseState>();
|
|
|
|
|
|
- @override
|
|
|
- FWidget build(BuildContext context) {
|
|
|
- return FContainer(
|
|
|
- width: 550,
|
|
|
- height: 500,
|
|
|
- padding: const EdgeInsets.symmetric(
|
|
|
- vertical: 15,
|
|
|
- horizontal: 15,
|
|
|
- ),
|
|
|
- margin: const EdgeInsets.symmetric(
|
|
|
- horizontal: 15,
|
|
|
- ),
|
|
|
- child: PatternBody(
|
|
|
- businessParent: businessParent,
|
|
|
- measureSystemSetting: measureData.measureSystemSetting,
|
|
|
- ));
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-class MeasureTextSize {
|
|
|
- MeasureTextSize(this.textSize);
|
|
|
- final int textSize;
|
|
|
-
|
|
|
- @override
|
|
|
- String toString() {
|
|
|
- return '$textSize×$textSize';
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-class PatternBody extends FStatefulWidget {
|
|
|
- const PatternBody({
|
|
|
- Key? key,
|
|
|
- required this.businessParent,
|
|
|
- required this.measureSystemSetting,
|
|
|
- }) : super(key: key);
|
|
|
-
|
|
|
- ///父级节点
|
|
|
- final FInteractiveContainer businessParent;
|
|
|
- final MeasureSystemSettingDTO measureSystemSetting;
|
|
|
- @override
|
|
|
- FState<PatternBody> createState() => _PatternBodyState();
|
|
|
-}
|
|
|
-
|
|
|
-class _PatternBodyState extends FState<PatternBody> {
|
|
|
- /// 测量数据
|
|
|
- late final measureData = Get.find<MeasureDataController>();
|
|
|
- final mouseState = Get.find<IMouseState>();
|
|
|
-
|
|
|
/// [卡尺大小] 枚举值
|
|
|
static final List<int> C_MEASURE_CURSOR_SIZE = [16, 24, 32];
|
|
|
|
|
@@ -166,52 +118,100 @@ class _PatternBodyState extends FState<PatternBody> {
|
|
|
),
|
|
|
];
|
|
|
|
|
|
+ @override
|
|
|
+ FWidget build(BuildContext context) {
|
|
|
+ return FContainer(
|
|
|
+ width: 550,
|
|
|
+ height: 500,
|
|
|
+ padding: const EdgeInsets.symmetric(
|
|
|
+ vertical: 15,
|
|
|
+ horizontal: 15,
|
|
|
+ ),
|
|
|
+ margin: const EdgeInsets.symmetric(
|
|
|
+ horizontal: 15,
|
|
|
+ ),
|
|
|
+ child: PatternBody(
|
|
|
+ businessParent: businessParent,
|
|
|
+ measureSystemSetting: measureData.measureSystemSetting,
|
|
|
+ ));
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+class MeasureTextSize {
|
|
|
+ MeasureTextSize(this.textSize);
|
|
|
+ final int textSize;
|
|
|
+
|
|
|
+ @override
|
|
|
+ String toString() {
|
|
|
+ return '$textSize×$textSize';
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+class PatternBody extends FStatefulWidget {
|
|
|
+ const PatternBody({
|
|
|
+ Key? key,
|
|
|
+ required this.businessParent,
|
|
|
+ required this.measureSystemSetting,
|
|
|
+ }) : super(key: key);
|
|
|
+
|
|
|
+ ///父级节点
|
|
|
+ final FInteractiveContainer businessParent;
|
|
|
+ final MeasureSystemSettingDTO measureSystemSetting;
|
|
|
+ @override
|
|
|
+ FState<PatternBody> createState() => _PatternBodyState();
|
|
|
+}
|
|
|
+
|
|
|
+class _PatternBodyState extends FState<PatternBody> {
|
|
|
+ /// 测量数据
|
|
|
+ late final measureData = Get.find<MeasureDataController>();
|
|
|
+ final mouseState = Get.find<IMouseState>();
|
|
|
+
|
|
|
@override
|
|
|
void initState() {
|
|
|
super.initState();
|
|
|
- autoCorrectIllegalValue();
|
|
|
+ // autoCorrectIllegalValue();
|
|
|
}
|
|
|
|
|
|
/// 自动纠正非法值【脏数据检查】
|
|
|
- void autoCorrectIllegalValue() {
|
|
|
- if (!C_MEASURE_CURSOR_SIZE
|
|
|
- .contains(widget.measureSystemSetting.cursorSize)) {
|
|
|
- widget.measureSystemSetting.cursorSize = C_MEASURE_CURSOR_SIZE[0];
|
|
|
- }
|
|
|
- if (!C_MEASURE_MARK_SIZE
|
|
|
- .contains(widget.measureSystemSetting.shapeCursorSize)) {
|
|
|
- widget.measureSystemSetting.shapeCursorSize = C_MEASURE_MARK_SIZE[0];
|
|
|
- }
|
|
|
- if (!C_RESULT_TEXT_SIZE.contains(widget.measureSystemSetting.fontSize)) {
|
|
|
- widget.measureSystemSetting.fontSize = C_RESULT_TEXT_SIZE[0];
|
|
|
- }
|
|
|
- if (!C_ANNOTATION_TEXT_SIZE
|
|
|
- .contains(widget.measureSystemSetting.annotationFontSize)) {
|
|
|
- widget.measureSystemSetting.annotationFontSize =
|
|
|
- C_ANNOTATION_TEXT_SIZE[0];
|
|
|
- }
|
|
|
- if (!isContainsValue(
|
|
|
- C_DISTANCE_THRESHOLD, widget.measureSystemSetting.autoSnapDistance)) {
|
|
|
- widget.measureSystemSetting.autoSnapDistance =
|
|
|
- C_DISTANCE_THRESHOLD[0].value.toString();
|
|
|
- }
|
|
|
- if (!isContainsValue(
|
|
|
- C_DISTANCE_THRESHOLD, widget.measureSystemSetting.minCursorDistance)) {
|
|
|
- widget.measureSystemSetting.minCursorDistance =
|
|
|
- C_DISTANCE_THRESHOLD[0].value.toString();
|
|
|
- }
|
|
|
- }
|
|
|
+ // void autoCorrectIllegalValue() {
|
|
|
+ // if (!C_MEASURE_CURSOR_SIZE
|
|
|
+ // .contains(widget.measureSystemSetting.cursorSize)) {
|
|
|
+ // widget.measureSystemSetting.cursorSize = C_MEASURE_CURSOR_SIZE[0];
|
|
|
+ // }
|
|
|
+ // if (!C_MEASURE_MARK_SIZE
|
|
|
+ // .contains(widget.measureSystemSetting.shapeCursorSize)) {
|
|
|
+ // widget.measureSystemSetting.shapeCursorSize = C_MEASURE_MARK_SIZE[0];
|
|
|
+ // }
|
|
|
+ // if (!C_RESULT_TEXT_SIZE.contains(widget.measureSystemSetting.fontSize)) {
|
|
|
+ // widget.measureSystemSetting.fontSize = C_RESULT_TEXT_SIZE[0];
|
|
|
+ // }
|
|
|
+ // if (!C_ANNOTATION_TEXT_SIZE
|
|
|
+ // .contains(widget.measureSystemSetting.annotationFontSize)) {
|
|
|
+ // widget.measureSystemSetting.annotationFontSize =
|
|
|
+ // C_ANNOTATION_TEXT_SIZE[0];
|
|
|
+ // }
|
|
|
+ // if (!isContainsValue(
|
|
|
+ // C_DISTANCE_THRESHOLD, widget.measureSystemSetting.autoSnapDistance)) {
|
|
|
+ // widget.measureSystemSetting.autoSnapDistance =
|
|
|
+ // C_DISTANCE_THRESHOLD[0].value.toString();
|
|
|
+ // }
|
|
|
+ // if (!isContainsValue(
|
|
|
+ // C_DISTANCE_THRESHOLD, widget.measureSystemSetting.minCursorDistance)) {
|
|
|
+ // widget.measureSystemSetting.minCursorDistance =
|
|
|
+ // C_DISTANCE_THRESHOLD[0].value.toString();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
/// List<MeasureSelectModel> 中是否包含该值
|
|
|
- bool isContainsValue(List<MeasureSelectModel> list, String? value) {
|
|
|
- if (value == null) return false;
|
|
|
- for (var item in list) {
|
|
|
- if (item.value.toString() == value) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
+ // bool isContainsValue(List<MeasureSelectModel> list, String? value) {
|
|
|
+ // if (value == null) return false;
|
|
|
+ // for (var item in list) {
|
|
|
+ // if (item.value.toString() == value) {
|
|
|
+ // return true;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
|
|
|
CursorTypeEnum getMeasureSystemSettingCursorTypeIcon(
|
|
|
MeasureCursorType cursorType,
|
|
@@ -250,7 +250,7 @@ class _PatternBodyState extends FState<PatternBody> {
|
|
|
PatternItem(
|
|
|
title: i18nBook.measure.rulerType.t,
|
|
|
item: PatternItemRadio(
|
|
|
- tabList: C_MEASURE_CURSOR_TYPE,
|
|
|
+ tabList: StyleConfigPage.C_MEASURE_CURSOR_TYPE,
|
|
|
businessParent: widget.businessParent,
|
|
|
value: getMeasureSystemSettingCursorType(
|
|
|
widget.measureSystemSetting.cursorType,
|
|
@@ -269,7 +269,7 @@ class _PatternBodyState extends FState<PatternBody> {
|
|
|
PatternItem(
|
|
|
title: i18nBook.measure.rulerSize.t,
|
|
|
item: PatternItemRadio(
|
|
|
- tabList: C_MEASURE_CURSOR_SIZE,
|
|
|
+ tabList: StyleConfigPage.C_MEASURE_CURSOR_SIZE,
|
|
|
businessParent: widget.businessParent,
|
|
|
value: widget.measureSystemSetting.cursorSize,
|
|
|
onChangeState: (value) {
|
|
@@ -283,7 +283,7 @@ class _PatternBodyState extends FState<PatternBody> {
|
|
|
PatternItem(
|
|
|
title: i18nBook.measure.measureRulerSize.t,
|
|
|
item: PatternItemRadio(
|
|
|
- tabList: C_MEASURE_MARK_SIZE,
|
|
|
+ tabList: StyleConfigPage.C_MEASURE_MARK_SIZE,
|
|
|
value: widget.measureSystemSetting.shapeCursorSize,
|
|
|
businessParent: widget.businessParent,
|
|
|
onChangeState: (value) {
|
|
@@ -316,7 +316,7 @@ class _PatternBodyState extends FState<PatternBody> {
|
|
|
PatternItem(
|
|
|
title: i18nBook.measure.panelPosition.t,
|
|
|
item: PatternItemSelect(
|
|
|
- itemList: C_PANEL_POSITION,
|
|
|
+ itemList: StyleConfigPage.C_PANEL_POSITION,
|
|
|
value:
|
|
|
widget.measureSystemSetting.showResultLocation.toString(),
|
|
|
onChanged: (value) {
|
|
@@ -335,7 +335,7 @@ class _PatternBodyState extends FState<PatternBody> {
|
|
|
PatternItem(
|
|
|
title: i18nBook.measure.fontSize.t,
|
|
|
item: PatternItemSelect(
|
|
|
- itemList: C_RESULT_TEXT_SIZE
|
|
|
+ itemList: StyleConfigPage.C_RESULT_TEXT_SIZE
|
|
|
.map((e) =>
|
|
|
MeasureSelectModel(name: e.toString(), value: e))
|
|
|
.toList(),
|
|
@@ -403,9 +403,9 @@ class _PatternBodyState extends FState<PatternBody> {
|
|
|
PatternItem(
|
|
|
title: i18nBook.measure.autoAdjustCursor.t,
|
|
|
item: PatternItemSelect(
|
|
|
- itemList: C_DISTANCE_THRESHOLD,
|
|
|
+ itemList: StyleConfigPage.C_DISTANCE_THRESHOLD,
|
|
|
value: widget.measureSystemSetting.minCursorDistance ??
|
|
|
- C_DISTANCE_THRESHOLD[0].value.toString(),
|
|
|
+ StyleConfigPage.C_DISTANCE_THRESHOLD[0].value.toString(),
|
|
|
onChanged: (value) {
|
|
|
setState(() {
|
|
|
measureData.measureSystemSetting.minCursorDistance =
|
|
@@ -418,9 +418,9 @@ class _PatternBodyState extends FState<PatternBody> {
|
|
|
PatternItem(
|
|
|
title: i18nBook.measure.autoCaptureRange.t,
|
|
|
item: PatternItemSelect(
|
|
|
- itemList: C_DISTANCE_THRESHOLD,
|
|
|
+ itemList: StyleConfigPage.C_DISTANCE_THRESHOLD,
|
|
|
value: widget.measureSystemSetting.autoSnapDistance ??
|
|
|
- C_DISTANCE_THRESHOLD[0].value.toString(),
|
|
|
+ StyleConfigPage.C_DISTANCE_THRESHOLD[0].value.toString(),
|
|
|
onChanged: (value) {
|
|
|
setState(() {
|
|
|
measureData.measureSystemSetting.autoSnapDistance = value;
|
|
@@ -432,7 +432,7 @@ class _PatternBodyState extends FState<PatternBody> {
|
|
|
PatternItem(
|
|
|
title: i18nBook.measure.annotationFontSize.t,
|
|
|
item: PatternItemSelect(
|
|
|
- itemList: C_ANNOTATION_TEXT_SIZE
|
|
|
+ itemList: StyleConfigPage.C_ANNOTATION_TEXT_SIZE
|
|
|
.map((e) =>
|
|
|
MeasureSelectModel(name: e.toString(), value: e))
|
|
|
.toList(),
|