fix : text filed error in auth page

This commit is contained in:
2025-07-06 20:44:11 +03:30
parent d6f7cb4930
commit 1c732efc2f
2 changed files with 28 additions and 29 deletions

View File

@@ -7,7 +7,7 @@ import 'package:rasadyar_auth/data/repositories/auth_repository_imp.dart';
import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_core/core.dart';
class CaptchaWidgetLogic extends GetxController with StateMixin<CaptchaResponseModel> { class CaptchaWidgetLogic extends GetxController with StateMixin<CaptchaResponseModel> {
Rx<TextEditingController> textController = TextEditingController().obs; TextEditingController textController = TextEditingController();
RxnString captchaKey = RxnString(); RxnString captchaKey = RxnString();
GlobalKey<FormState> formKey = GlobalKey<FormState>(); GlobalKey<FormState> formKey = GlobalKey<FormState>();
AuthRepositoryImpl authRepository = diAuth.get<AuthRepositoryImpl>(); AuthRepositoryImpl authRepository = diAuth.get<AuthRepositoryImpl>();
@@ -23,6 +23,7 @@ class CaptchaWidgetLogic extends GetxController with StateMixin<CaptchaResponseM
@override @override
void onClose() { void onClose() {
textController.value.dispose(); textController.value.dispose();
textController.close();
super.onClose(); super.onClose();
} }

View File

@@ -39,7 +39,7 @@ class CaptchaWidget extends GetView<CaptchaWidgetLogic> {
), ),
onLoading: const Center(child: CupertinoActivityIndicator(color: AppColor.blueNormal)), onLoading: const Center(child: CupertinoActivityIndicator(color: AppColor.blueNormal)),
onError: (error) { onError: (error) {
return const Center(child: Text('خطا در بارگذاری کد امنیتی', style: AppFonts.yekan13)); return Center(child: Text('خطا ', style: AppFonts.yekan13.copyWith(color: Colors.red)));
}, },
), ),
), ),
@@ -50,15 +50,14 @@ class CaptchaWidget extends GetView<CaptchaWidgetLogic> {
child: Form( child: Form(
key: controller.formKey, key: controller.formKey,
autovalidateMode: AutovalidateMode.disabled, autovalidateMode: AutovalidateMode.disabled,
child: ObxValue((data) { child: RTextField(
return RTextField(
label: 'کد امنیتی', label: 'کد امنیتی',
controller: data.value, controller: controller.textController,
keyboardType: TextInputType.numberWithOptions(decimal: false, signed: false), keyboardType: TextInputType.numberWithOptions(decimal: false, signed: false),
maxLines: 1, maxLines: 1,
maxLength: 6, maxLength: 6,
suffixIcon: (data.value.text.trim().isNotEmpty ?? false) suffixIcon: (controller.textController.text.trim().isNotEmpty ?? false)
? clearButton(() => controller.textController.value.clear()) ? clearButton(() => controller.textController.clear())
: null, : null,
validator: (value) { validator: (value) {
@@ -78,8 +77,7 @@ class CaptchaWidget extends GetView<CaptchaWidgetLogic> {
} }
}, },
style: AppFonts.yekan13, style: AppFonts.yekan13,
); )
}, controller.textController),
), ),
), ),
], ],