|
@@ -1,6 +1,8 @@
|
|
|
import 'package:fis_i18n/i18n.dart';
|
|
|
import 'package:fis_jsonrpc/rpc.dart';
|
|
|
import 'package:fis_measure/interfaces/process/items/terms.dart';
|
|
|
+import 'package:fis_measure/process/language/measure_language.dart';
|
|
|
+import 'package:fis_measure/process/workspace/measure_data_controller.dart';
|
|
|
import 'package:fis_theme/theme.dart';
|
|
|
import 'package:fis_ui/index.dart';
|
|
|
import 'package:fis_ui/interface/interactive_container.dart';
|
|
@@ -11,11 +13,14 @@ import 'package:get/get.dart';
|
|
|
///选中设置对话框
|
|
|
class HasSelectedSettingDialog extends FStatelessWidget
|
|
|
implements FInteractiveContainer {
|
|
|
- const HasSelectedSettingDialog({
|
|
|
+ HasSelectedSettingDialog({
|
|
|
Key? key,
|
|
|
- required this.name,
|
|
|
+ required this.itemMeta,
|
|
|
}) : super(key: key);
|
|
|
- final String name;
|
|
|
+ final ItemMetaDTO itemMeta;
|
|
|
+
|
|
|
+ final measureData = Get.find<MeasureDataController>();
|
|
|
+
|
|
|
@override
|
|
|
final String pageName = 'HasSelectedSettingDialog';
|
|
|
@override
|
|
@@ -28,7 +33,18 @@ class HasSelectedSettingDialog extends FStatelessWidget
|
|
|
fontSize: 18,
|
|
|
),
|
|
|
),
|
|
|
- isDefault: true,
|
|
|
+ isDefault: false,
|
|
|
+ bottomButton: FContainer(
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 10),
|
|
|
+ child: FRow(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ _buildCommonButton('返回', () {
|
|
|
+ Get.back();
|
|
|
+ }),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
onOk: () {
|
|
|
Get.back();
|
|
|
},
|
|
@@ -38,19 +54,41 @@ class HasSelectedSettingDialog extends FStatelessWidget
|
|
|
Get.back();
|
|
|
},
|
|
|
children: [
|
|
|
- _DialogPage(parent: this, name: name),
|
|
|
+ Container(
|
|
|
+ width: 830,
|
|
|
+ height: 500,
|
|
|
+ child: _DialogPage(parent: this, itemMeta: itemMeta),
|
|
|
+ ),
|
|
|
],
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+ FWidget _buildCommonButton(String buttonName, VoidCallback onPressed) {
|
|
|
+ return FElevatedButton(
|
|
|
+ child: FText(buttonName),
|
|
|
+ onPressed: () {
|
|
|
+ onPressed.call();
|
|
|
+ },
|
|
|
+ businessParent: this,
|
|
|
+ name: buttonName,
|
|
|
+ style: ElevatedButton.styleFrom(
|
|
|
+ elevation: 0,
|
|
|
+ padding: EdgeInsets.symmetric(
|
|
|
+ vertical: 15,
|
|
|
+ horizontal: 25,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
///对话框界面
|
|
|
-class _DialogPage extends StatelessWidget {
|
|
|
+class _DialogPage extends StatefulWidget {
|
|
|
///父级节点
|
|
|
final FInteractiveContainer parent;
|
|
|
- const _DialogPage({
|
|
|
+ _DialogPage({
|
|
|
required this.parent,
|
|
|
- required this.name,
|
|
|
+ required this.itemMeta,
|
|
|
});
|
|
|
static BoxDecoration createBorder() {
|
|
|
const border = BoxDecoration(
|
|
@@ -64,245 +102,323 @@ class _DialogPage extends StatelessWidget {
|
|
|
return border;
|
|
|
}
|
|
|
|
|
|
- final String name;
|
|
|
- // final controller = Get.put(MeasureConfigurationController());
|
|
|
+ final ItemMetaDTO itemMeta;
|
|
|
|
|
|
+ @override
|
|
|
+ State<_DialogPage> createState() => _DialogPageState();
|
|
|
+}
|
|
|
+
|
|
|
+class _DialogPageState extends State<_DialogPage> {
|
|
|
+ /// 测量语言包
|
|
|
+ final measureLanguage = MeasureLanguage();
|
|
|
+ final measureData = Get.find<MeasureDataController>();
|
|
|
+
|
|
|
+ /// 左侧tab列表
|
|
|
+ late List<ChildItemMetaDTO> selectChildItemMeta =
|
|
|
+ widget.itemMeta.multiMethodItems ?? [];
|
|
|
+
|
|
|
+ /// 测量方式
|
|
|
+ late List<ChildItemMetaDTO> multiMethodItems =
|
|
|
+ widget.itemMeta.multiMethodItems ?? [];
|
|
|
+
|
|
|
+ late List<OutputItemMetaDTO> availableOutputs =
|
|
|
+ widget.itemMeta.calculator?.availableOutputs ?? [];
|
|
|
+
|
|
|
+ late int selectedTabIndex = -1;
|
|
|
+
|
|
|
+ @override
|
|
|
+ void initState() {
|
|
|
+ super.initState();
|
|
|
+ setTabList();
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
+ void dispose() {
|
|
|
+ measureData.itemMetaListConfig.add(widget.itemMeta);
|
|
|
+
|
|
|
+ super.dispose();
|
|
|
+ }
|
|
|
+
|
|
|
+ void setTabList() {
|
|
|
+ List<ChildItemMetaDTO> tabList = [];
|
|
|
+ List<ChildItemMetaDTO> childTabList = [];
|
|
|
+
|
|
|
+ /// 最下面的子集
|
|
|
+ List<ChildItemMetaDTO> selectChildItem = [];
|
|
|
+ tabList = (widget.itemMeta.multiMethodItems ?? [])
|
|
|
+ .firstWhereOrNull((element) => element.isWorking)
|
|
|
+ ?.childItems ??
|
|
|
+ [];
|
|
|
+
|
|
|
+ tabList.forEach((element) {
|
|
|
+ childTabList.add(element);
|
|
|
+ selectChildItem = element.childItems ?? [];
|
|
|
+ childTabList.addAll(selectChildItem
|
|
|
+ .firstWhereOrNull((element) =>
|
|
|
+ element.isWorking && element.childItems?.length != 0)
|
|
|
+ ?.childItems ??
|
|
|
+ []);
|
|
|
+ });
|
|
|
+ selectChildItemMeta = childTabList;
|
|
|
+ setState(() {});
|
|
|
+ }
|
|
|
+
|
|
|
+ // final controller = Get.put(MeasureConfigurationController());
|
|
|
@override
|
|
|
FWidget build(BuildContext context) {
|
|
|
+ return FRow(
|
|
|
+ children: [
|
|
|
+ _buildLeftMeasureMethod(),
|
|
|
+ FExpanded(child: _buildRightMeasurementResultAndUnit()),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 左侧测量方法
|
|
|
+ FWidget _buildLeftMeasureMethod() {
|
|
|
return FContainer(
|
|
|
- width: 700,
|
|
|
- height: 500,
|
|
|
- padding: const EdgeInsets.symmetric(horizontal: 15),
|
|
|
- child: FListView(
|
|
|
- shrinkWrap: true,
|
|
|
+ width: 150,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ border: Border(
|
|
|
+ left: BorderSide(
|
|
|
+ color: FTheme.ins.colorScheme.line,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ color: Colors.grey[300],
|
|
|
+ ),
|
|
|
+ child: FColumn(
|
|
|
children: [
|
|
|
- FColumn(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: [
|
|
|
- FContainer(
|
|
|
- child: FText(i18nBook.measure.currentMeasureTool.t),
|
|
|
- margin: const EdgeInsets.symmetric(vertical: 10),
|
|
|
- ),
|
|
|
- FContainer(
|
|
|
- margin: const EdgeInsets.only(left: 15),
|
|
|
- child: FElevatedButton(
|
|
|
- name: name,
|
|
|
- businessParent: parent,
|
|
|
- onPressed: () {},
|
|
|
- style: ButtonStyle(
|
|
|
- backgroundColor: MaterialStateProperty.all(
|
|
|
- FTheme.ins.colorScheme.primary,
|
|
|
- ),
|
|
|
+ FContainer(
|
|
|
+ width: double.infinity,
|
|
|
+ color: selectedTabIndex == -1
|
|
|
+ ? FTheme.ins.colorScheme.primary
|
|
|
+ : Colors.white,
|
|
|
+ height: 60,
|
|
|
+ child: FInkWell(
|
|
|
+ child: FCenter(
|
|
|
+ child: FText(
|
|
|
+ widget.itemMeta.description ?? '',
|
|
|
+ style: TextStyle(
|
|
|
+ color: selectedTabIndex == -1 ? Colors.white : Colors.black,
|
|
|
),
|
|
|
- child: _buildMeasureName(name),
|
|
|
),
|
|
|
),
|
|
|
- const FSizedBox(
|
|
|
- height: 15,
|
|
|
- ),
|
|
|
- FContainer(
|
|
|
- decoration: _DialogPage.createBorder(),
|
|
|
- ),
|
|
|
- // controller.state.childItemMeta.multiMethodItems!.length
|
|
|
- if (2 != 0) ...[
|
|
|
- FContainer(
|
|
|
- child: FText(i18nBook.measure.SelectMeasureMethod.t),
|
|
|
- margin: const EdgeInsets.symmetric(vertical: 10),
|
|
|
- ),
|
|
|
- _HasSelectedModule(),
|
|
|
- const FSizedBox(
|
|
|
- height: 15,
|
|
|
- ),
|
|
|
- FContainer(
|
|
|
- decoration: _DialogPage.createBorder(),
|
|
|
- ),
|
|
|
- FContainer(
|
|
|
- child: FText(i18nBook.measure.SelectCalculateResultAndUnit.t),
|
|
|
- margin: const EdgeInsets.symmetric(vertical: 10),
|
|
|
- ),
|
|
|
- FContainer(
|
|
|
- margin: const EdgeInsets.only(left: 15),
|
|
|
- child: FColumn(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: [
|
|
|
- // FObx(() {
|
|
|
- // return
|
|
|
- FContainer(
|
|
|
- padding: const EdgeInsets.only(
|
|
|
- left: 15, top: 15, bottom: 15),
|
|
|
- child: FWrap(
|
|
|
- spacing: 16.0, // 主轴(水平)方向间距
|
|
|
- runSpacing: 8.0, // 纵轴(垂直)方向间距
|
|
|
- direction: Axis.horizontal,
|
|
|
- crossAlignment: WrapCrossAlignment.center,
|
|
|
- alignment: WrapAlignment.start,
|
|
|
- children: List<FWidget>.generate(
|
|
|
- // controller.state.childItemMetaCalculator.length,
|
|
|
- 10,
|
|
|
- (index) {
|
|
|
- return FElevatedButton(
|
|
|
- businessParent: parent,
|
|
|
- name: "buildMeasureName",
|
|
|
- onPressed: () {},
|
|
|
- style: ButtonStyle(
|
|
|
- backgroundColor: MaterialStateProperty.all(
|
|
|
- index == 0
|
|
|
- ? FTheme.ins.colorScheme.primary
|
|
|
- : Colors.white,
|
|
|
- ),
|
|
|
- ),
|
|
|
- child: _buildMeasureName(
|
|
|
- // controller.state
|
|
|
- // .childItemMetaCalculator[index].name,
|
|
|
- ''),
|
|
|
- );
|
|
|
- },
|
|
|
- ),
|
|
|
- ),
|
|
|
- // );
|
|
|
- // },
|
|
|
- )
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- const FSizedBox(
|
|
|
- height: 15,
|
|
|
- ),
|
|
|
- FContainer(
|
|
|
- decoration: _DialogPage.createBorder(),
|
|
|
+ onTap: () {
|
|
|
+ selectedTabIndex = -1;
|
|
|
+ // availableOutputs =
|
|
|
+ multiMethodItems = widget.itemMeta.multiMethodItems ?? [];
|
|
|
+ availableOutputs =
|
|
|
+ widget.itemMeta.calculator?.availableOutputs ?? [];
|
|
|
+ setState(() {});
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ FColumn(
|
|
|
+ children: selectChildItemMeta.map((e) {
|
|
|
+ int index = selectChildItemMeta.indexOf(e);
|
|
|
+ return FContainer(
|
|
|
+ width: double.infinity,
|
|
|
+ height: 60,
|
|
|
+ color: selectedTabIndex == index
|
|
|
+ ? FTheme.ins.colorScheme.primary
|
|
|
+ : Colors.white,
|
|
|
+ child: FInkWell(
|
|
|
+ child: FCenter(
|
|
|
+ child: FText(e.description ?? e.name ?? '',
|
|
|
+ style: TextStyle(
|
|
|
+ color: selectedTabIndex == index
|
|
|
+ ? Colors.white
|
|
|
+ : Colors.black,
|
|
|
+ ))),
|
|
|
+ onTap: () {
|
|
|
+ selectedTabIndex = index;
|
|
|
+ multiMethodItems = e.childItems ?? [];
|
|
|
+ availableOutputs = e.calculator?.availableOutputs ?? [];
|
|
|
+ setState(() {});
|
|
|
+ },
|
|
|
),
|
|
|
- ],
|
|
|
- ],
|
|
|
- )
|
|
|
+ );
|
|
|
+ }).toList(),
|
|
|
+ ),
|
|
|
],
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- /// 测量名字
|
|
|
- ///
|
|
|
- /// [name] 测量名
|
|
|
- FWidget _buildMeasureName(name) {
|
|
|
- return FContainer(
|
|
|
- width: 180,
|
|
|
- height: 60,
|
|
|
- child: FColumn(
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- children: [
|
|
|
- FText(
|
|
|
- name,
|
|
|
- style: const TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- ),
|
|
|
+ /// 计算结果和单位
|
|
|
+ FWidget _buildRightMeasurementResultAndUnit() {
|
|
|
+ return FColumn(
|
|
|
+ mainAxisSize: MainAxisSize.max,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ if (multiMethodItems != null && multiMethodItems.isNotEmpty)
|
|
|
+ _buildMeasureResult(),
|
|
|
+ if (availableOutputs.length != 0) _buildMeasureUnit(),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ FWidget _buildTitleContainer(String title, FWidget wrapList) {
|
|
|
+ return FColumn(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ FContainer(
|
|
|
+ margin: EdgeInsets.all(15),
|
|
|
+ child: FText(title),
|
|
|
+ ),
|
|
|
+ FContainer(
|
|
|
+ padding: const EdgeInsets.only(
|
|
|
+ left: 35,
|
|
|
+ right: 25,
|
|
|
+ top: 25,
|
|
|
+ bottom: 25,
|
|
|
),
|
|
|
- FText(
|
|
|
- name,
|
|
|
- style: const TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- ),
|
|
|
+ margin: EdgeInsets.symmetric(
|
|
|
+ horizontal: 15,
|
|
|
),
|
|
|
- ],
|
|
|
- ),
|
|
|
+ width: double.infinity,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ border: Border.all(color: FTheme.ins.colorScheme.line),
|
|
|
+ borderRadius: BorderRadius.circular(8),
|
|
|
+ ),
|
|
|
+ child: wrapList,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
);
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
-class _HasSelectedModule extends FStatefulWidget {
|
|
|
- @override
|
|
|
- FState<_HasSelectedModule> createState() => _HasSelectedModuleState();
|
|
|
-}
|
|
|
+ FWidget _buildMeasureResult() {
|
|
|
+ return _buildTitleContainer(
|
|
|
+ '选择测量方法',
|
|
|
+ _buildResultWrapList(multiMethodItems),
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
-class _HasSelectedModuleState extends FState<_HasSelectedModule> {
|
|
|
- /// 测量的控制器
|
|
|
- // final controller = Get.put(MeasureConfigurationController());
|
|
|
+ FWidget _buildMeasureUnit() {
|
|
|
+ return _buildTitleContainer(
|
|
|
+ '选择计算结果和单位',
|
|
|
+ _buildUnitWrapList(availableOutputs),
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
- /// 选中的方法
|
|
|
- late String selectedMeasureFun = '';
|
|
|
- List<ChildItemMetaDTO> multiMethodItems = [];
|
|
|
+ /// 这边是测量结果
|
|
|
+ FWidget _buildResultWrapList(List<ChildItemMetaDTO> list) {
|
|
|
+ return FWrap(
|
|
|
+ spacing: 20.0, // 主轴(水平)方向间距
|
|
|
+ runSpacing: 10.0, // 纵轴(垂直)方向间距
|
|
|
+ direction: Axis.horizontal,
|
|
|
+ crossAlignment: WrapCrossAlignment.center,
|
|
|
+ alignment: WrapAlignment.start,
|
|
|
+ children: list
|
|
|
+ .map(
|
|
|
+ (e) => _buildResultItem(e.description ?? e.name ?? '', e),
|
|
|
+ )
|
|
|
+ .toList(),
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
- @override
|
|
|
- void initState() {
|
|
|
- super.initState();
|
|
|
- // multiMethodItems = controller.state.childItemMeta.multiMethodItems!;
|
|
|
- selectedMeasureFun = multiMethodItems
|
|
|
- .firstWhere((element) =>
|
|
|
- element.isWorking == true &&
|
|
|
- !MeasureUnsupportedTerms.items.contains(element.name))
|
|
|
- .name!;
|
|
|
+ /// 这边是测量单位
|
|
|
+ FWidget _buildUnitWrapList(List<OutputItemMetaDTO> list) {
|
|
|
+ return FWrap(
|
|
|
+ spacing: 20.0, // 主轴(水平)方向间距
|
|
|
+ runSpacing: 10.0, // 纵轴(垂直)方向间距
|
|
|
+ direction: Axis.horizontal,
|
|
|
+ crossAlignment: WrapCrossAlignment.center,
|
|
|
+ alignment: WrapAlignment.start,
|
|
|
+ children: list.map((e) {
|
|
|
+ int _index = list.indexOf(e);
|
|
|
+ bool _isCanClick = true;
|
|
|
+ if (_index == 0) {
|
|
|
+ _isCanClick = false;
|
|
|
+ }
|
|
|
+ return _buildUnitItem(e.description ?? e.name ?? '', e, _isCanClick);
|
|
|
+ }).toList(),
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
- // controller.state.childItemMetaCalculator = multiMethodItems
|
|
|
- // .firstWhere((element) => element.isWorking == true)
|
|
|
- // .calculator!
|
|
|
- // .availableOutputs!;
|
|
|
+ FWidget _buildResultItem(String name, ChildItemMetaDTO childItemMeta) {
|
|
|
+ return FGestureDetector(
|
|
|
+ name: name,
|
|
|
+ businessParent: widget.parent,
|
|
|
+ onTap: () {
|
|
|
+ if (!childItemMeta.isWorking) {
|
|
|
+ multiMethodItems.forEach((element) {
|
|
|
+ element.isWorking = false;
|
|
|
+ });
|
|
|
+ childItemMeta.isWorking = true;
|
|
|
+ setTabList();
|
|
|
+ }
|
|
|
+ setState(() {});
|
|
|
+ },
|
|
|
+ child: FContainer(
|
|
|
+ width: 180,
|
|
|
+ height: 65,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: childItemMeta.isWorking
|
|
|
+ ? FTheme.ins.colorScheme.primary
|
|
|
+ : Colors.white,
|
|
|
+ border: Border.all(
|
|
|
+ color: FTheme.ins.colorScheme.line,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: FCenter(
|
|
|
+ child: FColumn(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ FText(
|
|
|
+ name,
|
|
|
+ style: TextStyle(
|
|
|
+ color: childItemMeta.isWorking ? Colors.white : Colors.black,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
- @override
|
|
|
- FWidget build(BuildContext context) {
|
|
|
- return FListView(
|
|
|
- shrinkWrap: true,
|
|
|
- children: [
|
|
|
- FColumn(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: [
|
|
|
- FContainer(
|
|
|
- padding: const EdgeInsets.only(left: 15, top: 15, bottom: 15),
|
|
|
- child: FWrap(
|
|
|
- spacing: 16.0, // 主轴(水平)方向间距
|
|
|
- runSpacing: 8.0, // 纵轴(垂直)方向间距
|
|
|
- direction: Axis.horizontal,
|
|
|
- crossAlignment: WrapCrossAlignment.center,
|
|
|
- alignment: WrapAlignment.start,
|
|
|
- children: List<FWidget>.generate(
|
|
|
- multiMethodItems.length,
|
|
|
- (index) {
|
|
|
- return
|
|
|
- // FElevatedButton(
|
|
|
- // onPressed: () {
|
|
|
- // setState(() {
|
|
|
- // // controller.state.childItemMetaCalculator =
|
|
|
- // // multiMethodItems[index]
|
|
|
- // // .calculator!
|
|
|
- // // .availableOutputs!;
|
|
|
- // selectedMeasureFun = multiMethodItems[index].name!;
|
|
|
- // });
|
|
|
- // },
|
|
|
- // style: ButtonStyle(
|
|
|
- // backgroundColor: MaterialStateProperty.all(
|
|
|
- // multiMethodItems[index].name == selectedMeasureFun
|
|
|
- // ? FTheme.ins.colorScheme.primary
|
|
|
- // : Colors.white,
|
|
|
- // ),
|
|
|
- // ),
|
|
|
- // child:
|
|
|
- FContainer(
|
|
|
- width: 180,
|
|
|
- height: 60,
|
|
|
- decoration: BoxDecoration(
|
|
|
- border: Border.all(
|
|
|
- width: 0.5,
|
|
|
- color: FTheme.ins.colorScheme.primary,
|
|
|
- ),
|
|
|
- ),
|
|
|
- child: FCenter(
|
|
|
- child: FText(
|
|
|
- multiMethodItems[index].name!,
|
|
|
- style: TextStyle(
|
|
|
- color: multiMethodItems[index].name ==
|
|
|
- selectedMeasureFun
|
|
|
- ? Colors.white
|
|
|
- : Colors.black,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- // ),
|
|
|
- );
|
|
|
- },
|
|
|
+ FWidget _buildUnitItem(
|
|
|
+ String name, OutputItemMetaDTO outputItemMeta, bool isCanClick) {
|
|
|
+ return FGestureDetector(
|
|
|
+ name: name,
|
|
|
+ businessParent: widget.parent,
|
|
|
+ onTap: () {
|
|
|
+ if (isCanClick) {
|
|
|
+ if (outputItemMeta.isWorking == null) {
|
|
|
+ outputItemMeta.isWorking = false;
|
|
|
+ }
|
|
|
+ outputItemMeta.isWorking = !outputItemMeta.isWorking!;
|
|
|
+ setState(() {});
|
|
|
+ }
|
|
|
+ },
|
|
|
+ child: FContainer(
|
|
|
+ width: 180,
|
|
|
+ height: 65,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: outputItemMeta.isWorking ?? false
|
|
|
+ ? FTheme.ins.colorScheme.primary
|
|
|
+ : Colors.white,
|
|
|
+ border: Border.all(
|
|
|
+ color: FTheme.ins.colorScheme.line,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: FCenter(
|
|
|
+ child: FColumn(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ FText(
|
|
|
+ name,
|
|
|
+ style: TextStyle(
|
|
|
+ color: outputItemMeta.isWorking ?? false
|
|
|
+ ? Colors.white
|
|
|
+ : Colors.black,
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- ],
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
- ],
|
|
|
+ ),
|
|
|
);
|
|
|
}
|
|
|
}
|