Files
UUVPN/source/lib/model/UserPreference.dart
T
Zeus 1bf69048f3 update ios project
update ios project
2024-07-24 11:51:39 +08:00

36 lines
810 B
Dart

//ignore_for_file: file_names
import 'dart:async';
import 'package:flutter/cupertino.dart';
class UserPreference extends ChangeNotifier {
// Initally Location index is 0
int locationIndex = 0;
// Change current location by call setlocationIndex method(function)
void setlocationIndex(int index) {
locationIndex = index;
notifyListeners();
}
// Setup for coundown service
Duration duration = Duration.zero;
bool isCountDownStart = false;
final Stream _stream = Stream.periodic(const Duration(seconds: 1));
UserPreference() {
_stream.listen((event) {
if (isCountDownStart) {
duration += const Duration(seconds: 1);
notifyListeners();
}
});
}
void get countDownSwitch {
isCountDownStart = !isCountDownStart;
notifyListeners();
}
}