ViewPage za Cart

PHOTO EMBED

Tue May 17 2022 12:14:36 GMT+0000 (UTC)

Saved by @Vesko_devv #dart

children: [
            Row(
              children: [
                ElevatedButton(
                    onPressed: () => controller.decrement(), child: Text('-')),
                Obx(
                  () => Text(
                    'KRUSKE ${controller.kruske.toString()}', // prikazujemo iz controller-a kruske i pretvaramo u string jer je Text widget
                    style: TextStyle(fontSize: 30, color: Colors.black),
                  ),
                ), // obavijamo widzet u obx da bi bio reaktivan 
                ElevatedButton(
                    onPressed: () => controller.increment(), child: Text('+')), // dugme koje poziva funkciju increment iz controller-a 
              ],
            ),
            Row(
              children: [
                ElevatedButton(
                    onPressed: () => controller.decrement2(), child: Text('-')),
                Obx(() => Text(
                      'JABUKE ${controller.jabuke.toString()}',
                      style: TextStyle(fontSize: 30, color: Colors.black),
                    )),
                ElevatedButton(
                    onPressed: () => controller.increment2(), child: Text('+')),
              ],
            ),
            Obx(() => Text(
                  '${controller.sum.toString()}', // prikazujemo sumu iz kontrolera
                  style: TextStyle(fontSize: 30, color: Colors.black),
                )),
content_copyCOPY