fix : injection and base page
This commit is contained in:
@@ -68,7 +68,6 @@ class ModulesLogic extends GetxController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
eLog("ModulesLogic closed");
|
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,9 +113,9 @@ class ModulesLogic extends GetxController {
|
|||||||
isLoading.value = !isLoading.value;
|
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();
|
await target.value?[1]?.call();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,8 +53,6 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
|||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
||||||
fLog(Get.arguments.toString());
|
|
||||||
_textAnimationController =
|
_textAnimationController =
|
||||||
AnimationController(vsync: this, duration: const Duration(milliseconds: 1200))
|
AnimationController(vsync: this, duration: const Duration(milliseconds: 1200))
|
||||||
..repeat(reverse: true, count: 2).whenComplete(() {
|
..repeat(reverse: true, count: 2).whenComplete(() {
|
||||||
@@ -107,8 +105,7 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
|||||||
AuthRepository authTmp = diChicken.get<AuthRepository>();
|
AuthRepository authTmp = diChicken.get<AuthRepository>();
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
await safeCall<UserProfileModel?>(
|
await safeCall<UserProfileModel?>(
|
||||||
call: () =>
|
call: () => authTmp.login(
|
||||||
authTmp.login(
|
|
||||||
authRequest: {
|
authRequest: {
|
||||||
"username": usernameController.value.text,
|
"username": usernameController.value.text,
|
||||||
"password": passwordController.value.text,
|
"password": passwordController.value.text,
|
||||||
@@ -136,11 +133,14 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
|||||||
} else {
|
} else {
|
||||||
Get.offAllNamed(ChickenRoutes.initSteward);
|
Get.offAllNamed(ChickenRoutes.initSteward);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
onError: (error, stackTrace) {
|
onError: (error, stackTrace) {
|
||||||
if (error is DioException) {
|
if (error is DioException) {
|
||||||
diChicken.get<DioErrorHandler>().handle(error);
|
diChicken.get<DioErrorHandler>().handle(error);
|
||||||
|
if ((error.type == DioExceptionType.unknown) ||
|
||||||
|
(error.type == DioExceptionType.connectionError)) {
|
||||||
|
getUserInfo(usernameController.value.text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
captchaController.getCaptcha();
|
captchaController.getCaptcha();
|
||||||
},
|
},
|
||||||
@@ -155,6 +155,7 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
|||||||
onSuccess: (result) async {
|
onSuccess: (result) async {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
await newSetupAuthDI(result.backend ?? '');
|
await newSetupAuthDI(result.backend ?? '');
|
||||||
|
await diChicken.allReady();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onError: (error, stackTrace) {
|
onError: (error, stackTrace) {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class AuthPage extends GetView<AuthLogic> {
|
|||||||
),
|
),
|
||||||
vecPath: Assets.vec.chickenPatternSvg.path,
|
vecPath: Assets.vec.chickenPatternSvg.path,
|
||||||
),
|
),
|
||||||
onPopScopTaped: () => Get.back(result: "HHHHHHHHEloo"),
|
onPopScopTaped: () => Get.back(result: -1),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Center(
|
Center(
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ class ChickenBasePage extends GetView<BaseLogic> {
|
|||||||
return BasePage(
|
return BasePage(
|
||||||
routes: routes,
|
routes: routes,
|
||||||
routesWidget: routesWidget,
|
routesWidget: routesWidget,
|
||||||
|
onPopScopTaped: onPopScopTaped,
|
||||||
widgets: widgets,
|
widgets: widgets,
|
||||||
child: child,
|
child: child,
|
||||||
scrollable: scrollable,
|
scrollable: scrollable,
|
||||||
|
|||||||
@@ -85,6 +85,27 @@ class BasePage extends GetView<BaseLogic> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
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(
|
return Scaffold(
|
||||||
backgroundColor: AppColor.bgLight,
|
backgroundColor: AppColor.bgLight,
|
||||||
appBar: appBar,
|
appBar: appBar,
|
||||||
@@ -94,3 +115,4 @@ class BasePage extends GetView<BaseLogic> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user