123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- import 'package:fis_jsonrpc/rpc.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_measure/view/measure/tool_chest_title.dart';
- import 'package:fis_ui/index.dart';
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- class LeftSelectInput extends FStatefulWidget {
- @override
- FState<LeftSelectInput> createState() => _LeftSelectInputState();
- }
- class _LeftSelectInputState extends FState<LeftSelectInput> {
- late final application = Get.find<IApplication>();
- /// 数据
- late final measureData = Get.find<MeasureDataController>();
- late final measureHandler = Get.find<MeasureHandler>();
- String commentItem = '';
- /// 注释获取
- void getNoteCommentsList() async {
- List<String> commentsList = [];
- var measureCommentItemResult =
- await measureData.getCommentsByApplicationAsync(
- application.applicationName,
- application.categoryName,
- );
- measureData.measureCommentItemResult =
- measureCommentItemResult?.commentItems ?? [];
- measureCommentItemResult?.commentItems?.forEach((element) {
- commentsList.add(element.text ?? '');
- });
- measureData.getCommentsList = commentsList;
- }
- @override
- FWidget build(BuildContext context) {
- return FContainer(
- padding: const EdgeInsets.only(
- left: 15,
- right: 15,
- bottom: 5,
- ),
- child: FRow(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- FBorderInput(
- height: 38,
- hintSize: 16,
- contentSize: 16,
- maxLength: 20,
- fillColor: Colors.white,
- borderColor: const Color.fromARGB(255, 187, 180, 180),
- suffixIcon: FMaterial(
- color: Colors.transparent,
- child: FIconButton(
- onPressed: () async {
- /// TODO 翻译
- List<CommentItemDTO> measureCommentItemList =
- measureData.measureCommentItemResult;
- if (commentItem.isEmpty) {
- PromptBox.toast("请添加新注释");
- } else {
- measureCommentItemList.add(
- CommentItemDTO(text: commentItem),
- );
- var result = await measureData.saveUserDefinedCommentsAsync(
- application.applicationName,
- application.categoryName,
- measureCommentItemList,
- );
- if (result ?? false) {
- measureHandler.changedTab = TagEnum.MeasureTool;
- measureHandler.changedTab = TagEnum.NodesTool;
- getNoteCommentsList();
- } else {
- PromptBox.toast("添加注释失败");
- }
- }
- },
- icon: const FIcon(
- Icons.add,
- ),
- ),
- ),
- /// TODO 翻译
- hintText: "请添加新注释",
- onChanged: (value) {
- commentItem = value;
- },
- ),
- ],
- ),
- );
- }
- }
|