feat : new loading widget
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_core/presentation/widget/loading/logic.dart';
|
||||
|
||||
class LoadingWidget extends StatelessWidget {
|
||||
LoadingWidget({super.key});
|
||||
|
||||
final controller = Get.put(LoadingWidgetLogic());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
||||
spacing: 16.h,
|
||||
children: [
|
||||
Center(
|
||||
child: Assets.anim.loading.lottie(width: 120.w, height: 120.h),
|
||||
),
|
||||
|
||||
FadeTransition(
|
||||
opacity: controller.textAnimation,
|
||||
child: Text(
|
||||
'در حال بارگذاری ...',
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
19
packages/core/lib/presentation/widget/loading/logic.dart
Normal file
19
packages/core/lib/presentation/widget/loading/logic.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LoadingWidgetLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
late AnimationController _textAnimationController;
|
||||
late Animation<double> textAnimation;
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
_textAnimationController =
|
||||
AnimationController(vsync: this, duration: const Duration(milliseconds: 1200))
|
||||
..repeat(reverse: true);
|
||||
|
||||
textAnimation = CurvedAnimation(parent: _textAnimationController, curve: Curves.easeInOut);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class LoadingWidget extends StatelessWidget {
|
||||
const LoadingWidget({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(child: Assets.anim.loading.lottie(
|
||||
width: 120.w,
|
||||
height: 120.h,
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user