feat : profile and map

This commit is contained in:
2025-07-28 15:57:30 +03:30
parent 6057976b46
commit d9724f681c
67 changed files with 2835 additions and 444 deletions

View File

@@ -1,16 +1,14 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_core/data/model/response/captcha/captcha_response_model.dart';
import 'package:rasadyar_inspection/data/repositories/auth_repository_imp.dart';
import 'package:rasadyar_inspection/data/model/response/captcha/captcha_response_model.dart';
import 'package:rasadyar_inspection/data/repositories/auth/auth_repository_imp.dart';
import 'package:rasadyar_inspection/injection/inspection_di.dart';
class CaptchaWidgetLogic extends GetxController with StateMixin<CaptchaResponseModel> {
TextEditingController textController = TextEditingController();
RxnString captchaKey = RxnString();
GlobalKey<FormState> formKey = GlobalKey<FormState>();
//AuthRepositoryImpl authRepository = .get<AuthRepositoryImpl>();
final Random random = Random();
AuthRepositoryImpl authRepository = diInspection.get<AuthRepositoryImpl>();
@override
void onInit() {
@@ -29,8 +27,21 @@ class CaptchaWidgetLogic extends GetxController with StateMixin<CaptchaResponseM
Future<void> getCaptcha() async {
change(null, status: RxStatus.loading());
textController.clear();
await Future.delayed(Duration(milliseconds: 800));
captchaKey.value = (random.nextInt(900000) + 100000).toString();
formKey.currentState?.reset();
await Future.delayed(Duration(milliseconds: 200));
await safeCall(
call: () async => authRepository.captcha(),
onSuccess: (result) {
if (result == null) {
change(null, status: RxStatus.error('Failed to load captcha'));
return;
}
captchaKey.value = result.captchaKey;
change(result, status: RxStatus.success());
},
onError: (error, stackTrace) {},
);
change(value, status: RxStatus.success());
}
}

View File

@@ -1,3 +1,4 @@
import 'dart:convert';
import 'dart:math';
import 'package:flutter/cupertino.dart';
@@ -28,12 +29,7 @@ class CaptchaWidget extends GetView<CaptchaWidgetLogic> {
borderRadius: BorderRadius.circular(8),
),
child: controller.obx(
(state) => Center(
child: Text(
controller.captchaKey.value ?? 'دوباره سعی کنید',
style: AppFonts.yekan24Bold,
),
),
(state) => Image.memory(base64Decode(state?.captchaImage ?? ''), fit: BoxFit.cover),
onLoading: const Center(
child: CupertinoActivityIndicator(color: AppColor.blueNormal),
),
@@ -64,9 +60,6 @@ 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;
},