Controller za cart

PHOTO EMBED

Tue May 17 2022 12:22:20 GMT+0000 (UTC)

Saved by @Vesko_devv #dart

var kruske = 0.obs;
  var jabuke = 0.obs;
  int get sum => kruske.value + jabuke.value;

  increment() {
    kruske.value++;
  }

  decrement() {
    if (kruske.value > 0) {
      kruske.value--;
    } else {
      (Get.snackbar('DJESI', 'SNEKCINO')); // stopiramo da ne moze ispod 0 ne moze se update i prikazivati i snackbar
    }
  }

  increment2() {
    jabuke.value++;
  }

  decrement2() {
    if (jabuke.value > 0) {
      jabuke.value--;
    }
  }
content_copyCOPY