feat : auth for new module

This commit is contained in:
MrM
2025-06-03 22:52:21 +03:30
parent ae18a5f648
commit 2b4c019c55
16 changed files with 314 additions and 133 deletions

View File

@@ -2,6 +2,7 @@ import 'dart:math';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:rasadyar_auth/presentation/pages/auth/logic.dart';
import 'package:rasadyar_auth/presentation/widget/clear_button.dart';
import 'package:rasadyar_core/core.dart';
@@ -64,9 +65,19 @@ class CaptchaWidget extends GetView<CaptchaWidgetLogic> {
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),
@@ -82,10 +93,10 @@ class _CaptchaLinePainter extends CustomPainter {
void paint(Canvas canvas, Size size) {
final random = Random();
final paint1 = Paint()
..color = Color.fromRGBO(random.nextInt(255), random.nextInt(255), random.nextInt(255), 1)
..color = Colors.deepOrange
..strokeWidth = 2;
final paint2 = Paint()
..color = Color.fromRGBO(random.nextInt(255), random.nextInt(255), random.nextInt(255), 1)
..color =Colors.blue
..strokeWidth = 2;
// First line: top-left to bottom-right