fix : memory leak animation

This commit is contained in:
2025-09-03 12:04:57 +03:30
parent 8e9768daf6
commit bdf5344451
3 changed files with 88 additions and 84 deletions

View File

@@ -89,7 +89,7 @@ class ModulesLogic extends GetxController {
selectedIndex.value = index; selectedIndex.value = index;
await Future.delayed(Duration(milliseconds: 300)); await Future.delayed(Duration(milliseconds: 300));
selectedIndex.value = null; selectedIndex.value = null;
// saveModule(module); // saveModule(module);
await navigateToModule(module); await navigateToModule(module);
} }
@@ -102,9 +102,9 @@ class ModulesLogic extends GetxController {
isLoading.value = !isLoading.value; isLoading.value = !isLoading.value;
} }
await Get.toNamed(target.key, arguments: module); var args = await Get.toNamed(target.key, arguments: module);
if (target.value?[1] != null) { if (target.value?[1] != null && args == -1) {
await target.value?[1]?.call(); await target.value?[1]?.call();
} }
} }

View File

@@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/chicken.dart'; import 'package:rasadyar_chicken/chicken.dart';
import 'package:rasadyar_chicken/data/common/dio_error_handler.dart'; import 'package:rasadyar_chicken/data/common/dio_error_handler.dart';
import 'package:rasadyar_chicken/data/di/chicken_di.dart'; import 'package:rasadyar_chicken/data/di/chicken_di.dart';
import 'package:rasadyar_chicken/data/models/request/login_request/login_request_model.dart';
import 'package:rasadyar_chicken/data/models/response/user_info/user_info_model.dart'; import 'package:rasadyar_chicken/data/models/response/user_info/user_info_model.dart';
import 'package:rasadyar_chicken/data/models/response/user_profile_model/user_profile_model.dart'; import 'package:rasadyar_chicken/data/models/response/user_profile_model/user_profile_model.dart';
import 'package:rasadyar_chicken/data/repositories/auth/auth_repository.dart'; import 'package:rasadyar_chicken/data/repositories/auth/auth_repository.dart';
@@ -72,6 +71,7 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
@override @override
void onClose() { void onClose() {
_textAnimationController.dispose();
_timer?.cancel(); _timer?.cancel();
super.onClose(); super.onClose();
} }
@@ -105,7 +105,6 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
return isCaptchaValid && isFormValid; return isCaptchaValid && isFormValid;
} }
Future<void> submitLoginForm() async { Future<void> submitLoginForm() async {
if (!_isFormValid()) return; if (!_isFormValid()) return;
AuthRepository authTmp = diChicken.get<AuthRepository>(); AuthRepository authTmp = diChicken.get<AuthRepository>();

View File

@@ -10,95 +10,100 @@ class AuthPage extends GetView<AuthLogic> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
iLog("AuthPage");
return Scaffold( return Scaffold(
body: Stack( body: PopScope(
alignment: Alignment.center, canPop: false,
fit: StackFit.expand, onPopInvokedWithResult: (didPop, result) {
Get.back(result: -1);
},
child: Stack(
alignment: Alignment.center,
fit: StackFit.expand,
children: [ children: [
Assets.vec.bgAuthSvg.svg(fit: BoxFit.fill), Assets.vec.bgAuthSvg.svg(fit: BoxFit.fill),
Center( Center(
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10.r), padding: EdgeInsets.symmetric(horizontal: 10.r),
child: FadeTransition( child: FadeTransition(
opacity: controller.textAnimation, opacity: controller.textAnimation,
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
spacing: 12, spacing: 12,
children: [ children: [
Text( Text(
'به سامانه رصدیار خوش آمدید!', 'به سامانه رصدیار خوش آمدید!',
textAlign: TextAlign.right, textAlign: TextAlign.right,
style: AppFonts.yekan25Bold.copyWith(color: Colors.white), style: AppFonts.yekan25Bold.copyWith(color: Colors.white),
), ),
Text( Text(
'سامانه رصد و پایش زنجیره تامین، تولید و توزیع کالا های اساسی', 'سامانه رصد و پایش زنجیره تامین، تولید و توزیع کالا های اساسی',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: Colors.white), style: AppFonts.yekan16.copyWith(color: Colors.white),
), ),
], ],
),
), ),
), ),
), ),
),
Obx(() { Obx(() {
final screenHeight = MediaQuery.of(context).size.height; final screenHeight = MediaQuery.of(context).size.height;
final targetTop = (screenHeight - 676) / 2; final targetTop = (screenHeight - 676) / 2;
return AnimatedPositioned( return AnimatedPositioned(
duration: const Duration(milliseconds: 1200), duration: const Duration(milliseconds: 1200),
curve: Curves.linear, curve: Curves.linear,
top: controller.showCard.value ? targetTop : screenHeight, top: controller.showCard.value ? targetTop : screenHeight,
left: 10.r, left: 10.r,
right: 10.r, right: 10.r,
child: Container( child: Container(
width: 381.w, width: 381.w,
height: 676.h, height: 676.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(40), borderRadius: BorderRadius.circular(40),
), ),
child: Column( child: Column(
children: [ children: [
SizedBox(height: 50.h), SizedBox(height: 50.h),
LogoWidget(), LogoWidget(),
SizedBox(height: 20.h), SizedBox(height: 20.h),
useAndPassFrom(), useAndPassFrom(),
SizedBox(height: 24.h), SizedBox(height: 24.h),
RichText( RichText(
text: TextSpan( text: TextSpan(
children: [ children: [
TextSpan( TextSpan(
text: 'مطالعه بیانیه ', text: 'مطالعه بیانیه ',
style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDark), style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDark),
), ),
TextSpan( TextSpan(
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () { ..onTap = () {
Get.bottomSheet( Get.bottomSheet(
privacyPolicyWidget(), privacyPolicyWidget(),
isScrollControlled: true, isScrollControlled: true,
enableDrag: true, enableDrag: true,
ignoreSafeArea: false, ignoreSafeArea: false,
); );
}, },
text: 'حریم خصوصی', text: 'حریم خصوصی',
style: AppFonts.yekan16.copyWith(color: AppColor.blueNormal), style: AppFonts.yekan16.copyWith(color: AppColor.blueNormal),
), ),
], ],
),
), ),
), ],
], ),
), ),
), );
); }),
}), ],
], ),
), ),
); );
} }