import 'dart:async'; import 'package:SEFER/controller/auth/captin/login_captin_controller.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import '../../constant/box_name.dart'; import '../../main.dart'; import '../../onbording_page.dart'; import '../../views/auth/captin/login_captin.dart'; class SplashScreenController extends GetxController with SingleGetTickerProviderMixin { late AnimationController animationController; late Animation zoomInAnimation; late Animation zoomOutAnimation; @override void onInit() { super.onInit(); animationController = AnimationController( vsync: this, duration: const Duration(seconds: 4), ); zoomInAnimation = Tween(begin: 1.0, end: 1.5).animate( CurvedAnimation( parent: animationController, curve: Curves.easeInOut, ), ); zoomOutAnimation = Tween(begin: 1.5, end: 1.0).animate( CurvedAnimation( parent: animationController, curve: Curves.easeInOut, ), ); animationController.repeat(reverse: true); startTimer(); } void startTimer() async { debugPrint('onBoarding: ${box.read(BoxName.onBoarding)}'); debugPrint('emailDriver: ${box.read(BoxName.emailDriver)}'); debugPrint('phoneDriver: ${box.read(BoxName.phoneDriver)}'); debugPrint('phoneVerified: ${box.read(BoxName.phoneVerified)}'); Timer(const Duration(seconds: 5), () async { box.read(BoxName.onBoarding) == null ? Get.off(() => OnBoardingPage()) : box.read(BoxName.emailDriver) != null && box.read(BoxName.phoneDriver) != null && box.read(BoxName.phoneVerified) == '1' ? await Get.put(LoginCaptinController()).loginFromSignInGoogle( box.read(BoxName.driverID).toString(), box.read(BoxName.emailDriver)) : Get.off(() => LoginCaptin()); }); } @override void onClose() { animationController.dispose(); super.onClose(); } }