fix : splash animation
feat : auth with password chore : app Architecture
This commit is contained in:
67
lib/presentation/pages/splash/logic.dart
Normal file
67
lib/presentation/pages/splash/logic.dart
Normal file
@@ -0,0 +1,67 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user