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();
|
||||
}
|
||||
}
|
||||
48
lib/presentation/pages/splash/view.dart
Normal file
48
lib/presentation/pages/splash/view.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rasadyar_app/presentation/common/app_color.dart';
|
||||
import 'package:rasadyar_app/presentation/common/assets.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class SplashPage extends GetView<SplashLogic> {
|
||||
const SplashPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.blueDarker,
|
||||
body: Center(
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
ObxValue((data) {
|
||||
return ScaleTransition(
|
||||
scale: data.value!,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 1),
|
||||
child: Image.asset(
|
||||
Assets.imagesInnerSplash,
|
||||
width: 190,
|
||||
height: 190,
|
||||
),
|
||||
),
|
||||
);
|
||||
}, controller.scaleAnimation),
|
||||
|
||||
ObxValue((data) {
|
||||
return RotationTransition(
|
||||
turns: data.value!,
|
||||
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 1),
|
||||
child: Image.asset(Assets.imagesOutterSplash),
|
||||
),
|
||||
);
|
||||
}, controller.rotationAnimation),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user