You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

133 lines
5.7KB

  1. import 'package:farm_tpf/custom_model/action_form/CommonData.dart';
  2. import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_dropdown_controller.dart';
  3. import 'package:farm_tpf/presentation/screens/resources/sc_common_data_helper.dart';
  4. import 'package:farm_tpf/utils/validators.dart';
  5. import 'package:flutter/material.dart';
  6. import 'package:get/get.dart';
  7. class DropdownSupplyWidget extends StatefulWidget {
  8. final String? titleName;
  9. final String condition;
  10. final String hint;
  11. final String? value;
  12. final Function(CommonData) onPressed;
  13. final String? invalidMessage;
  14. final String tag;
  15. final String tbSupply;
  16. DropdownSupplyWidget({
  17. this.titleName,
  18. required this.hint,
  19. required this.tag,
  20. this.value,
  21. required this.condition,
  22. required this.onPressed,
  23. this.invalidMessage,
  24. required this.tbSupply,
  25. });
  26. @override
  27. _DropdownSupplyWidgetState createState() => _DropdownSupplyWidgetState();
  28. }
  29. class _DropdownSupplyWidgetState extends State<DropdownSupplyWidget> {
  30. ChangeDropdownController? controller;
  31. @override
  32. void initState() {
  33. super.initState();
  34. controller = Get.put(ChangeDropdownController(), tag: widget.tag);
  35. }
  36. @override
  37. Widget build(BuildContext context) {
  38. // return Container();
  39. return GetBuilder<ChangeDropdownController>(
  40. tag: 's',
  41. init: controller,
  42. builder: (data) {
  43. return Container();
  44. });
  45. // return GetBuilder<ChangeDropdownController>(
  46. // tag: widget.tag,
  47. // builder: (data) {
  48. // return Container();
  49. // return SizedBox(
  50. // width: double.infinity,
  51. // height: Validators.stringNotNullOrEmpty(widget.invalidMessage ?? '') ? 85 : 65,
  52. // child: Column(
  53. // crossAxisAlignment: CrossAxisAlignment.start,
  54. // children: [
  55. // Validators.stringNotNullOrEmpty(data?.currentData?.name ?? '')
  56. // ? Text(
  57. // widget.hint ?? '',
  58. // style: TextStyle(
  59. // color: Validators.stringNotNullOrEmpty(widget.invalidMessage ?? '') ? Colors.red : Colors.black54, fontSize: 13.0),
  60. // )
  61. // : Text(
  62. // '',
  63. // style: TextStyle(
  64. // color: Validators.stringNotNullOrEmpty(widget.invalidMessage ?? '') ? Colors.red : Colors.black54, fontSize: 13.0),
  65. // ),
  66. // SizedBox(
  67. // width: double.infinity,
  68. // height: 44,
  69. // child: TextButton(
  70. // onPressed: () {
  71. // Navigator.of(context)
  72. // .push(MaterialPageRoute(
  73. // builder: (_) => CommonDataHelperScreen(
  74. // titleName: widget.titleName ?? '',
  75. // tbSupply: widget.tbSupply ?? '',
  76. // condition: widget.condition ?? '',
  77. // selectedId: data?.selectedId ?? -1,
  78. // currentItems: [],
  79. // currentEditId: -1),
  80. // fullscreenDialog: false))
  81. // .then((value) {
  82. // if (value != null) {
  83. // var result = value as CommonData;
  84. // controller?.change(result);
  85. // widget.onPressed(result);
  86. // }
  87. // });
  88. // },
  89. // child: Column(
  90. // crossAxisAlignment: CrossAxisAlignment.start,
  91. // children: [
  92. // Container(
  93. // padding: EdgeInsets.only(top: 0.0, right: 0.0, bottom: 10.5, left: 0.0),
  94. // decoration: BoxDecoration(
  95. // border: Border(
  96. // bottom: BorderSide(
  97. // width: 0.5,
  98. // color: Validators.stringNotNullOrEmpty(widget.invalidMessage ?? '') ? Colors.red : Colors.black54)),
  99. // ),
  100. // child: Row(
  101. // children: [
  102. // Expanded(
  103. // child: Validators.stringNotNullOrEmpty(data?.currentData?.name ?? '')
  104. // ? Text(data?.currentData?.name ?? '', style: TextStyle(fontSize: 16.0, color: Colors.black))
  105. // : Text(widget.hint, style: TextStyle(fontSize: 16.0, color: Colors.black54)),
  106. // ),
  107. // Icon(
  108. // Icons.arrow_drop_down,
  109. // color: Colors.grey,
  110. // ),
  111. // ],
  112. // ))
  113. // ],
  114. // )),
  115. // ),
  116. // Validators.stringNotNullOrEmpty(widget.invalidMessage ?? '')
  117. // ? Text(
  118. // widget.invalidMessage ?? '',
  119. // style: TextStyle(fontSize: 12.0, color: Colors.red, fontWeight: FontWeight.normal),
  120. // textAlign: TextAlign.left,
  121. // )
  122. // : SizedBox(),
  123. // ],
  124. // ),
  125. // );
  126. // });
  127. }
  128. }