You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
|
|
import 'package:appinio_swiper/appinio_swiper.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
|
|
|
|
|
class MarathonProvider extends ChangeNotifier {
|
|
|
|
|
final AppinioSwiperController swiperController = AppinioSwiperController();
|
|
|
|
|
|
|
|
|
|
bool _itsMarathonTime = false;
|
|
|
|
|
|
|
|
|
|
bool get itsMarathonTime => _itsMarathonTime;
|
|
|
|
|
|
|
|
|
|
set itsMarathonTime(bool value) {
|
|
|
|
|
_itsMarathonTime = value;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Timer timer = Timer.periodic(const Duration(seconds: 1), (Timer timer) {});
|
|
|
|
|
int start = 20;
|
|
|
|
|
|
|
|
|
|
void startTimer() {
|
|
|
|
|
start = 20;
|
|
|
|
|
const Duration oneSec = Duration(seconds: 1);
|
|
|
|
|
timer = Timer.periodic(
|
|
|
|
|
oneSec,
|
|
|
|
|
(Timer timer) {
|
|
|
|
|
if (start == 0) {
|
|
|
|
|
swiperController.swipeLeft();
|
|
|
|
|
timer.cancel();
|
|
|
|
|
} else {
|
|
|
|
|
start--;
|
|
|
|
|
}
|
|
|
|
|
notifyListeners();
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void cancelTimer() {
|
|
|
|
|
timer.cancel();
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
}
|