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.

77 lines
1.8KB

  1. import 'package:farm_tpf/custom_model/LocationUnit.dart';
  2. import 'package:get/state_manager.dart';
  3. class CheckChangeAnotherDropdown extends GetxController {
  4. LocationUnit currentCountry;
  5. LocationUnit currentProvince;
  6. LocationUnit currentDistrict;
  7. LocationUnit currentWard;
  8. void initValue() {
  9. currentCountry = LocationUnit();
  10. currentProvince = LocationUnit();
  11. currentDistrict = LocationUnit();
  12. currentWard = LocationUnit();
  13. }
  14. void changeCountry(LocationUnit country) {
  15. currentCountry = country;
  16. currentProvince = LocationUnit();
  17. currentDistrict = LocationUnit();
  18. currentWard = LocationUnit();
  19. update();
  20. }
  21. void changeCountryByIdAndName(int id, String name) {
  22. currentCountry = LocationUnit()
  23. ..id = id
  24. ..name = name;
  25. currentProvince = LocationUnit();
  26. currentDistrict = LocationUnit();
  27. currentWard = LocationUnit();
  28. update();
  29. }
  30. void changeProvince(LocationUnit province) {
  31. currentProvince = province;
  32. currentDistrict = LocationUnit();
  33. currentWard = LocationUnit();
  34. update();
  35. }
  36. void changeProvinceByIdAndName(int id, String name) {
  37. currentProvince = LocationUnit()
  38. ..id = id
  39. ..name = name;
  40. currentDistrict = LocationUnit();
  41. currentWard = LocationUnit();
  42. update();
  43. }
  44. void changeDistrict(LocationUnit district) {
  45. currentDistrict = district;
  46. currentWard = LocationUnit();
  47. update();
  48. }
  49. void changeDistrictByIdAndName(int id, String name) {
  50. currentDistrict = LocationUnit()
  51. ..id = id
  52. ..name = name;
  53. currentWard = LocationUnit();
  54. update();
  55. }
  56. void changeWard(LocationUnit ward) {
  57. currentWard = ward;
  58. update();
  59. }
  60. void changeWardByIdAndName(int id, String name) {
  61. currentWard = LocationUnit()
  62. ..id = id
  63. ..name = name;
  64. update();
  65. }
  66. }