measure_search_input.dart 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import 'package:fis_i18n/i18n.dart';
  2. import 'package:fis_jsonrpc/rpc.dart';
  3. import 'package:fis_measure/interfaces/process/workspace/application.dart';
  4. import 'package:fis_measure/process/workspace/measure_data_controller.dart';
  5. import 'package:fis_measure/process/workspace/measure_handler.dart';
  6. import 'package:fis_measure/utils/prompt_box.dart';
  7. import 'package:fis_measure/view/measure/tool_chest_title.dart';
  8. import 'package:fis_ui/index.dart';
  9. import 'package:flutter/material.dart';
  10. import 'package:get/get.dart';
  11. class LeftSelectInput extends FStatefulWidget {
  12. @override
  13. FState<LeftSelectInput> createState() => _LeftSelectInputState();
  14. }
  15. class _LeftSelectInputState extends FState<LeftSelectInput> {
  16. late final application = Get.find<IApplication>();
  17. /// 数据
  18. late final measureData = Get.find<MeasureDataController>();
  19. late final measureHandler = Get.find<MeasureHandler>();
  20. String commentItem = '';
  21. /// 注释获取
  22. void getNoteCommentsList() async {
  23. List<String> commentsList = [];
  24. var measureCommentItemResult =
  25. await measureData.getCommentsByApplicationAsync(
  26. application.applicationName,
  27. application.categoryName,
  28. );
  29. measureData.measureCommentItemResult =
  30. measureCommentItemResult?.commentItems ?? [];
  31. measureCommentItemResult?.commentItems?.forEach((element) {
  32. commentsList.add(element.text ?? '');
  33. });
  34. measureData.getCommentsList = commentsList;
  35. }
  36. @override
  37. FWidget build(BuildContext context) {
  38. return FContainer(
  39. padding: const EdgeInsets.only(
  40. left: 15,
  41. right: 15,
  42. bottom: 5,
  43. ),
  44. child: FRow(
  45. crossAxisAlignment: CrossAxisAlignment.center,
  46. children: [
  47. FBorderInput(
  48. height: 38,
  49. hintSize: 16,
  50. contentSize: 16,
  51. maxLength: 20,
  52. fillColor: Colors.white,
  53. borderColor: const Color.fromARGB(255, 187, 180, 180),
  54. suffixIcon: FMaterial(
  55. color: Colors.transparent,
  56. child: FIconButton(
  57. onPressed: () async {
  58. /// TODO 翻译
  59. List<CommentItemDTO> measureCommentItemList =
  60. measureData.measureCommentItemResult;
  61. if (commentItem.isEmpty) {
  62. PromptBox.toast(i18nBook.remedical.pleaseAddCcomment.t);
  63. } else {
  64. measureCommentItemList.add(
  65. CommentItemDTO(text: commentItem),
  66. );
  67. var result = await measureData.saveUserDefinedCommentsAsync(
  68. application.applicationName,
  69. application.categoryName,
  70. measureCommentItemList,
  71. );
  72. if (result ?? false) {
  73. measureHandler.changedTab = TagEnum.MeasureTool;
  74. measureHandler.changedTab = TagEnum.NodesTool;
  75. getNoteCommentsList();
  76. } else {
  77. PromptBox.toast(i18nBook.remedical.addCommentfail.t);
  78. }
  79. }
  80. },
  81. icon: const FIcon(
  82. Icons.add,
  83. ),
  84. ),
  85. ),
  86. /// TODO 翻译
  87. hintText: i18nBook.remedical.pleaseAddCcomment.t,
  88. onChanged: (value) {
  89. commentItem = value;
  90. },
  91. ),
  92. ],
  93. ),
  94. );
  95. }
  96. }