fix : delete liner in captcha widget

This commit is contained in:
2025-07-12 14:46:52 +03:30
parent 0b921fa917
commit 86891db860

View File

@@ -29,17 +29,18 @@ class CaptchaWidget extends GetView<CaptchaWidgetLogic> {
), ),
child: controller.obx( child: controller.obx(
(state) => Center( (state) => Center(
child: Stack( child: Text(
alignment: Alignment.center, controller.captchaKey.value ?? 'دوباره سعی کنید',
children: [ style: AppFonts.yekan24Bold,
CustomPaint(size: const Size(135, 50), painter: _CaptchaLinePainter()),
Text(controller.captchaKey.value ?? 'دوباره سعی کنید', style: AppFonts.yekan24Bold),
],
), ),
), ),
onLoading: const Center(child: CupertinoActivityIndicator(color: AppColor.blueNormal)), onLoading: const Center(
child: CupertinoActivityIndicator(color: AppColor.blueNormal),
),
onError: (error) { onError: (error) {
return Center(child: Text('خطا ', style: AppFonts.yekan13.copyWith(color: Colors.red))); return Center(
child: Text('خطا ', style: AppFonts.yekan13.copyWith(color: Colors.red)),
);
}, },
), ),
), ),
@@ -63,7 +64,8 @@ class CaptchaWidget extends GetView<CaptchaWidgetLogic> {
validator: (value) { validator: (value) {
if (value == null || value.isEmpty) { if (value == null || value.isEmpty) {
return 'کد امنیتی را وارد کنید'; return 'کد امنیتی را وارد کنید';
} else if (controller.captchaKey.value != null && controller.captchaKey.value != value) { } else if (controller.captchaKey.value != null &&
controller.captchaKey.value != value) {
return 'کد امنیتی اشتباه است'; return 'کد امنیتی اشتباه است';
} }
return null; return null;
@@ -72,12 +74,11 @@ class CaptchaWidget extends GetView<CaptchaWidgetLogic> {
if (pass.length == 6) { if (pass.length == 6) {
if (controller.formKey.currentState?.validate() ?? false) { if (controller.formKey.currentState?.validate() ?? false) {
Get.find<AuthLogic>().isDisabled.value = false; Get.find<AuthLogic>().isDisabled.value = false;
} }
} }
}, },
style: AppFonts.yekan13, style: AppFonts.yekan13,
) ),
), ),
), ),
], ],
@@ -97,18 +98,10 @@ class _CaptchaLinePainter extends CustomPainter {
..strokeWidth = 2; ..strokeWidth = 2;
// First line: top-left to bottom-right // First line: top-left to bottom-right
canvas.drawLine( canvas.drawLine(Offset(0, 0), Offset(size.width, size.height), paint1);
Offset(0, 0),
Offset(size.width, size.height),
paint1,
);
// Second line: bottom-left to top-right // Second line: bottom-left to top-right
canvas.drawLine( canvas.drawLine(Offset(0, size.height), Offset(size.width, 0), paint2);
Offset(0, size.height),
Offset(size.width, 0),
paint2,
);
} }
@override @override