73 lines
2.0 KiB
Dart
73 lines
2.0 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';
|
|
import '../auth/google_sign.dart';
|
|
import '../auth/login_controller.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() async {
|
|
print(box.read(BoxName.email));
|
|
print(box.read(BoxName.phone));
|
|
print(box.read(BoxName.isVerified));
|
|
print('---------');
|
|
Timer(const Duration(seconds: 5), () async {
|
|
box.read(BoxName.onBoarding) == null
|
|
? Get.off(() => OnBoardingPage())
|
|
: box.read(BoxName.email) != null &&
|
|
box.read(BoxName.phone) != null &&
|
|
box.read(BoxName.isVerified) == '1'
|
|
// ? Get.off(() => const MapPagePassenger())
|
|
? await Get.put(LoginController()).loginFromSignInGoogle(
|
|
box.read(BoxName.passengerID).toString(),
|
|
box.read(BoxName.email).toString(),
|
|
)
|
|
: Get.off(() => LoginPage());
|
|
});
|
|
}
|
|
|
|
@override
|
|
void onClose() {
|
|
animationController.dispose();
|
|
super.onClose();
|
|
}
|
|
}
|