measure_search_input.dart 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. if (commentItem.isEmpty) {
  59. PromptBox.toast(i18nBook.measure.pleaseAddCcomment.t);
  60. } else {
  61. var result = await measureData.saveUserDefinedCommentsAsync(
  62. application.applicationName,
  63. application.categoryName,
  64. [CommentItemDTO(text: commentItem)],
  65. );
  66. if (result ?? false) {
  67. measureHandler.changedTab = TagEnum.MeasureTool;
  68. measureHandler.changedTab = TagEnum.NodesTool;
  69. getNoteCommentsList();
  70. } else {
  71. PromptBox.toast(i18nBook.measure.addCommentfail.t);
  72. }
  73. }
  74. },
  75. icon: const FIcon(
  76. Icons.add,
  77. ),
  78. ),
  79. ),
  80. hintText: i18nBook.measure.pleaseAddCcomment.t,
  81. onChanged: (value) {
  82. commentItem = value;
  83. },
  84. ),
  85. ],
  86. ),
  87. );
  88. }
  89. }