chore: clean up unused imports, update routing for authentication pages, and enhance UI components in the profile and captcha widgets

This commit is contained in:
2025-12-24 11:51:41 +03:30
parent 3eccf492ff
commit 60c58ef17e
17 changed files with 428 additions and 625 deletions

View File

@@ -1,10 +1,9 @@
import 'dart:convert';
import 'dart:math';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_livestock/presentation/page/auth/logic.dart';
import 'package:rasadyar_livestock/features/auth/presentation/pages/logic.dart';
import 'logic.dart';
@@ -14,13 +13,13 @@ class CaptchaWidget extends GetView<CaptchaWidgetLogic> {
@override
Widget build(BuildContext context) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: controller.getCaptcha,
child: Container(
width: 135,
height: 50,
height: 50.h,
clipBehavior: Clip.antiAliasWithSaveLayer,
decoration: BoxDecoration(
color: AppColor.whiteNormalHover,
@@ -28,38 +27,50 @@ class CaptchaWidget extends GetView<CaptchaWidgetLogic> {
borderRadius: BorderRadius.circular(8),
),
child: controller.obx(
(state) => Image.memory(base64Decode(state?.captchaImage ?? ''), fit: BoxFit.cover),
(state) => Image.memory(
base64Decode(state?.captchaImage ?? ''),
fit: BoxFit.cover,
),
onLoading: const Center(
child: CupertinoActivityIndicator(color: AppColor.blueNormal),
),
onError: (error) {
return Center(
child: Text('خطا ', style: AppFonts.yekan13.copyWith(color: Colors.red)),
child: Text(
'خطا ',
style: AppFonts.yekan13.copyWith(color: Colors.red),
),
);
},
),
),
),
const SizedBox(width: 8),
SizedBox(width: 2.w),
IconButton(
onPressed: controller.getCaptcha,
icon: Icon(Icons.refresh, color: AppColor.textColor),
),
SizedBox(width: 2.w),
Expanded(
child: Form(
key: controller.formKey,
autovalidateMode: AutovalidateMode.disabled,
child: RTextField(
height: 50.h,
isFullHeight: true,
label: 'کد امنیتی',
controller: controller.textController,
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderSide: BorderSide(color: AppColor.textColor, width: 1),
borderColor: AppColor.textColor,
keyboardType: TextInputType.numberWithOptions(
decimal: false,
signed: false,
),
keyboardType: TextInputType.numberWithOptions(decimal: false, signed: false),
maxLines: 1,
maxLength: 6,
suffixIcon: (controller.textController.text.trim().isNotEmpty ?? false)
? clearButton(() => controller.textController.clear())
: null,
suffix: clearButton(() => controller.textController.clear()),
validator: (value) {
if (value == null || value.isEmpty) {
return 'کد امنیتی را وارد کنید';
@@ -67,10 +78,8 @@ class CaptchaWidget extends GetView<CaptchaWidgetLogic> {
return null;
},
onChanged: (pass) {
if (pass.length == 6) {
if (controller.formKey.currentState?.validate() ?? false) {
Get.find<AuthLogic>().isDisabled.value = false;
}
if (controller.formKey.currentState?.validate() ?? false) {
Get.find<AuthLogic>().isDisabled.value = false;
}
},
style: AppFonts.yekan13,