diff --git a/packages/auth/lib/presentation/widget/captcha/logic.dart b/packages/auth/lib/presentation/widget/captcha/logic.dart index 4644ca8..2628483 100644 --- a/packages/auth/lib/presentation/widget/captcha/logic.dart +++ b/packages/auth/lib/presentation/widget/captcha/logic.dart @@ -7,7 +7,7 @@ import 'package:rasadyar_auth/data/repositories/auth_repository_imp.dart'; import 'package:rasadyar_core/core.dart'; class CaptchaWidgetLogic extends GetxController with StateMixin { - Rx textController = TextEditingController().obs; + TextEditingController textController = TextEditingController(); RxnString captchaKey = RxnString(); GlobalKey formKey = GlobalKey(); AuthRepositoryImpl authRepository = diAuth.get(); @@ -23,6 +23,7 @@ class CaptchaWidgetLogic extends GetxController with StateMixin { ), onLoading: const Center(child: CupertinoActivityIndicator(color: AppColor.blueNormal)), onError: (error) { - return const Center(child: Text('خطا در بارگذاری کد امنیتی', style: AppFonts.yekan13)); + return Center(child: Text('خطا ', style: AppFonts.yekan13.copyWith(color: Colors.red))); }, ), ), @@ -50,36 +50,34 @@ class CaptchaWidget extends GetView { child: Form( key: controller.formKey, autovalidateMode: AutovalidateMode.disabled, - child: ObxValue((data) { - return RTextField( - label: 'کد امنیتی', - controller: data.value, - keyboardType: TextInputType.numberWithOptions(decimal: false, signed: false), - maxLines: 1, - maxLength: 6, - suffixIcon: (data.value.text.trim().isNotEmpty ?? false) - ? clearButton(() => controller.textController.value.clear()) - : null, + child: RTextField( + label: 'کد امنیتی', + controller: controller.textController, + keyboardType: TextInputType.numberWithOptions(decimal: false, signed: false), + maxLines: 1, + maxLength: 6, + suffixIcon: (controller.textController.text.trim().isNotEmpty ?? false) + ? clearButton(() => controller.textController.clear()) + : null, - validator: (value) { - if (value == null || value.isEmpty) { - return 'کد امنیتی را وارد کنید'; - } else if (controller.captchaKey.value != null && controller.captchaKey.value != value) { - return 'کد امنیتی اشتباه است'; - } - return null; - }, - onChanged: (pass) { - if(pass.length== 6) { - if(controller.formKey.currentState?.validate()??false) { - Get.find().isDisabled.value = false; + validator: (value) { + if (value == null || value.isEmpty) { + return 'کد امنیتی را وارد کنید'; + } else if (controller.captchaKey.value != null && controller.captchaKey.value != value) { + return 'کد امنیتی اشتباه است'; + } + return null; + }, + onChanged: (pass) { + if(pass.length== 6) { + if(controller.formKey.currentState?.validate()??false) { + Get.find().isDisabled.value = false; - } } - }, - style: AppFonts.yekan13, - ); - }, controller.textController), + } + }, + style: AppFonts.yekan13, + ) ), ), ],