68 lines
1.7 KiB
Dart
68 lines
1.7 KiB
Dart
import 'package:flutter/animation.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:rasadyar_app/presentation/routes/app_pages.dart';
|
|
|
|
class SplashLogic extends GetxController with GetTickerProviderStateMixin {
|
|
late final AnimationController scaleController;
|
|
late final AnimationController rotateController;
|
|
Rxn<Animation<double>> scaleAnimation = Rxn();
|
|
Rxn<Animation<double>> rotationAnimation = Rxn();
|
|
|
|
@override
|
|
void onInit() {
|
|
super.onInit();
|
|
scaleController = AnimationController(
|
|
vsync: this,
|
|
duration: const Duration(milliseconds: 1500),
|
|
);
|
|
|
|
rotateController = AnimationController(
|
|
vsync: this,
|
|
duration: const Duration(milliseconds: 8000),
|
|
);
|
|
|
|
scaleAnimation.value = Tween<double>(
|
|
begin: 0.8,
|
|
end: 1.2,
|
|
).animate(scaleController);
|
|
|
|
rotationAnimation.value = Tween<double>(
|
|
begin: 0.0,
|
|
end: 1,
|
|
).animate(rotateController);
|
|
|
|
rotateController.forward();
|
|
rotateController.addStatusListener((status) {
|
|
if (status == AnimationStatus.completed) {
|
|
rotateController.repeat();
|
|
} else if (status == AnimationStatus.dismissed) {
|
|
rotateController.forward();
|
|
}
|
|
});
|
|
|
|
scaleController.forward();
|
|
scaleController.addStatusListener((status) {
|
|
if (status == AnimationStatus.completed) {
|
|
scaleController.reverse();
|
|
} else if (status == AnimationStatus.dismissed) {
|
|
scaleController.forward();
|
|
}
|
|
});
|
|
}
|
|
|
|
@override
|
|
void onReady() {
|
|
super.onReady();
|
|
Future.delayed(const Duration(seconds: 1), () {
|
|
Get.offAllNamed(AppPaths.authWithUserAndPass);
|
|
});
|
|
}
|
|
|
|
@override
|
|
void onClose() {
|
|
rotateController.dispose();
|
|
scaleController.dispose();
|
|
super.onClose();
|
|
}
|
|
}
|