fix : text filed error in auth page
This commit is contained in:
@@ -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<CaptchaResponseModel> {
|
||||
Rx<TextEditingController> textController = TextEditingController().obs;
|
||||
TextEditingController textController = TextEditingController();
|
||||
RxnString captchaKey = RxnString();
|
||||
GlobalKey<FormState> formKey = GlobalKey<FormState>();
|
||||
AuthRepositoryImpl authRepository = diAuth.get<AuthRepositoryImpl>();
|
||||
@@ -23,6 +23,7 @@ class CaptchaWidgetLogic extends GetxController with StateMixin<CaptchaResponseM
|
||||
@override
|
||||
void onClose() {
|
||||
textController.value.dispose();
|
||||
textController.close();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class CaptchaWidget extends GetView<CaptchaWidgetLogic> {
|
||||
),
|
||||
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<CaptchaWidgetLogic> {
|
||||
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<AuthLogic>().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<AuthLogic>().isDisabled.value = false;
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
style: AppFonts.yekan13,
|
||||
);
|
||||
}, controller.textController),
|
||||
}
|
||||
},
|
||||
style: AppFonts.yekan13,
|
||||
)
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user