fix : injection and base page

This commit is contained in:
2025-09-27 13:52:54 +03:30
parent 0a98c57d75
commit be83996a02
5 changed files with 48 additions and 25 deletions

View File

@@ -68,7 +68,6 @@ class ModulesLogic extends GetxController {
@override
void onClose() {
eLog("ModulesLogic closed");
super.onClose();
}
@@ -114,9 +113,9 @@ class ModulesLogic extends GetxController {
isLoading.value = !isLoading.value;
}
await Get.toNamed(target.key, arguments: module);
var res = await Get.toNamed(target.key, arguments: module);
if (target.value?[1] != null) {
if (target.value?[1] != null && res == -1) {
await target.value?[1]?.call();
}
}

View File

@@ -53,8 +53,6 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
@override
void onInit() {
super.onInit();
fLog(Get.arguments.toString());
_textAnimationController =
AnimationController(vsync: this, duration: const Duration(milliseconds: 1200))
..repeat(reverse: true, count: 2).whenComplete(() {
@@ -107,8 +105,7 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
AuthRepository authTmp = diChicken.get<AuthRepository>();
isLoading.value = true;
await safeCall<UserProfileModel?>(
call: () =>
authTmp.login(
call: () => authTmp.login(
authRequest: {
"username": usernameController.value.text,
"password": passwordController.value.text,
@@ -136,11 +133,14 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
} else {
Get.offAllNamed(ChickenRoutes.initSteward);
}
},
onError: (error, stackTrace) {
if (error is DioException) {
diChicken.get<DioErrorHandler>().handle(error);
if ((error.type == DioExceptionType.unknown) ||
(error.type == DioExceptionType.connectionError)) {
getUserInfo(usernameController.value.text);
}
}
captchaController.getCaptcha();
},
@@ -155,6 +155,7 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
onSuccess: (result) async {
if (result != null) {
await newSetupAuthDI(result.backend ?? '');
await diChicken.allReady();
}
},
onError: (error, stackTrace) {

View File

@@ -26,7 +26,7 @@ class AuthPage extends GetView<AuthLogic> {
),
vecPath: Assets.vec.chickenPatternSvg.path,
),
onPopScopTaped: () => Get.back(result: "HHHHHHHHEloo"),
onPopScopTaped: () => Get.back(result: -1),
child: Stack(
children: [
Center(

View File

@@ -81,6 +81,7 @@ class ChickenBasePage extends GetView<BaseLogic> {
return BasePage(
routes: routes,
routesWidget: routesWidget,
onPopScopTaped: onPopScopTaped,
widgets: widgets,
child: child,
scrollable: scrollable,

View File

@@ -85,6 +85,27 @@ class BasePage extends GetView<BaseLogic> {
@override
Widget build(BuildContext context) {
return _pageBuilder();
}
Widget _pageBuilder() {
if (onPopScopTaped != null) {
return PopScope(
canPop: false,
onPopInvokedWithResult: (didPop, result) {
if (!didPop) {
onPopScopTaped!();
}
},
child: Scaffold(
backgroundColor: AppColor.bgLight,
appBar: appBar,
body: _buildBody(),
floatingActionButtonLocation: floatingActionButtonLocation,
floatingActionButton: floatingActionButton,
),
);
} else {
return Scaffold(
backgroundColor: AppColor.bgLight,
appBar: appBar,
@@ -93,4 +114,5 @@ class BasePage extends GetView<BaseLogic> {
floatingActionButton: floatingActionButton,
);
}
}
}