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.

29 lines
608B

  1. import 'package:farm_tpf/custom_model/Device.dart';
  2. import 'package:get/get.dart';
  3. class ChangeDevice extends GetxController {
  4. Device currentDevice;
  5. int selectedDeviceId;
  6. String selectedDeviceName;
  7. void initValue() {
  8. currentDevice = Device();
  9. selectedDeviceName = "";
  10. selectedDeviceId = -1;
  11. update();
  12. }
  13. void change(Device device) {
  14. currentDevice = device;
  15. selectedDeviceId = device.id;
  16. selectedDeviceName = device.name;
  17. update();
  18. }
  19. void changeByIdAndName(int id, String name) {
  20. selectedDeviceId = id;
  21. selectedDeviceName = name;
  22. update();
  23. }
  24. }