38 lines
796 B
Dart
38 lines
796 B
Dart
import 'package:get/get.dart';
|
|
|
|
class ControlController extends GetxController {
|
|
// Variabel untuk menyimpan suhu dan timer
|
|
var temperature = 180.obs; // Gunakan .obs agar bisa dipantau dengan GetX
|
|
var timer = 45.obs;
|
|
|
|
// Fungsi untuk mengurangi suhu
|
|
void decreaseTemperature() {
|
|
if (temperature.value > 0) {
|
|
temperature.value--;
|
|
}
|
|
}
|
|
|
|
// Fungsi untuk menambah suhu
|
|
void increaseTemperature() {
|
|
if (temperature.value < 300) {
|
|
// Batasi suhu maksimum
|
|
temperature.value++;
|
|
}
|
|
}
|
|
|
|
// Fungsi untuk mengurangi waktu
|
|
void decreaseTimer() {
|
|
if (timer.value > 0) {
|
|
timer.value--;
|
|
}
|
|
}
|
|
|
|
// Fungsi untuk menambah waktu
|
|
void increaseTimer() {
|
|
if (timer.value < 60) {
|
|
// Batasi waktu maksimum
|
|
timer.value++;
|
|
}
|
|
}
|
|
}
|