measure_search_input.dart 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. }
  71. }
  72. },
  73. icon: const FIcon(
  74. Icons.add,
  75. ),
  76. ),
  77. ),
  78. hintText: i18nBook.measure.pleaseAddCcomment.t,
  79. onChanged: (value) {
  80. commentItem = value;
  81. },
  82. ),
  83. ],
  84. ),
  85. );
  86. }
  87. }