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.

40 lines
845B

  1. import 'package:farm_tpf/custom_model/Supply.dart';
  2. import 'package:get/get.dart';
  3. class ChangeSupply extends GetxController {
  4. Supply currentSupply;
  5. int selectedSupplyId;
  6. String selectedSupplyName;
  7. String unit;
  8. bool isValid;
  9. void initValue() {
  10. currentSupply = Supply();
  11. selectedSupplyName = "";
  12. selectedSupplyId = -1;
  13. unit = "";
  14. isValid = true;
  15. update();
  16. }
  17. void change(Supply supply) {
  18. currentSupply = supply;
  19. selectedSupplyId = supply.id;
  20. selectedSupplyName = supply.tbSuppliesName;
  21. unit = supply.unit;
  22. update();
  23. }
  24. void changeByIdAndName(int supplyId, String supplyName, {String unitName}) {
  25. selectedSupplyId = supplyId;
  26. selectedSupplyName = supplyName;
  27. unit = unitName;
  28. update();
  29. }
  30. void changeValid(bool valid) {
  31. isValid = valid;
  32. update();
  33. }
  34. }