61 lines
1.5 KiB
Dart
61 lines
1.5 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:SEFER/views/auth/login_page.dart';
|
|
|
|
import '../../constant/box_name.dart';
|
|
import '../../main.dart';
|
|
import '../../onbording_page.dart';
|
|
import '../../views/home/map_page_passenger.dart';
|
|
|
|
class SplashScreenController extends GetxController
|
|
with SingleGetTickerProviderMixin {
|
|
late AnimationController animationController;
|
|
late Animation<double> zoomInAnimation;
|
|
late Animation<double> zoomOutAnimation;
|
|
|
|
@override
|
|
void onInit() {
|
|
super.onInit();
|
|
|
|
animationController = AnimationController(
|
|
vsync: this,
|
|
duration: const Duration(seconds: 4),
|
|
);
|
|
|
|
zoomInAnimation = Tween<double>(begin: 1.0, end: 1.5).animate(
|
|
CurvedAnimation(
|
|
parent: animationController,
|
|
curve: Curves.easeInOut,
|
|
),
|
|
);
|
|
|
|
zoomOutAnimation = Tween<double>(begin: 1.5, end: 1.0).animate(
|
|
CurvedAnimation(
|
|
parent: animationController,
|
|
curve: Curves.easeInOut,
|
|
),
|
|
);
|
|
|
|
animationController.repeat(reverse: true);
|
|
startTimer();
|
|
}
|
|
|
|
void startTimer() {
|
|
Timer(const Duration(seconds: 4), () {
|
|
box.read(BoxName.onBoarding) == null
|
|
? Get.off(() => OnBoardingPage())
|
|
: box.read(BoxName.email) != null
|
|
? Get.off(() => const MapPagePassenger())
|
|
: Get.off(() => LoginPage());
|
|
});
|
|
}
|
|
|
|
@override
|
|
void onClose() {
|
|
animationController.dispose();
|
|
super.onClose();
|
|
}
|
|
}
|