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

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Binary file not shown.

View File

@@ -16,7 +16,6 @@ export 'package:flutter_map_animations/flutter_map_animations.dart';
export 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart'; export 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';
export 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart' hide DownloadProgress; export 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart' hide DownloadProgress;
export 'package:flutter_rating_bar/flutter_rating_bar.dart'; export 'package:flutter_rating_bar/flutter_rating_bar.dart';
export 'package:device_preview_plus/device_preview_plus.dart';
export 'package:flutter_screenutil/flutter_screenutil.dart' hide DeviceType; export 'package:flutter_screenutil/flutter_screenutil.dart' hide DeviceType;
export 'package:flutter_secure_storage/flutter_secure_storage.dart'; export 'package:flutter_secure_storage/flutter_secure_storage.dart';
export 'package:flutter_slidable/flutter_slidable.dart'; export 'package:flutter_slidable/flutter_slidable.dart';
@@ -36,8 +35,7 @@ export 'package:image_cropper/image_cropper.dart';
///image picker ///image picker
export 'package:image_picker/image_picker.dart'; export 'package:image_picker/image_picker.dart';
//encryption
//export 'package:encrypt/encrypt.dart' show Encrypted;
//Map and location //Map and location
export 'package:latlong2/latlong.dart'; export 'package:latlong2/latlong.dart';

View File

@@ -49,6 +49,9 @@ class $AssetsIconsGen {
/// File path: assets/icons/bg_auth.svg /// File path: assets/icons/bg_auth.svg
SvgGenImage get bgAuth => const SvgGenImage('assets/icons/bg_auth.svg'); SvgGenImage get bgAuth => const SvgGenImage('assets/icons/bg_auth.svg');
/// File path: assets/icons/bg_auth_dam.svg
SvgGenImage get bgAuthDam => const SvgGenImage('assets/icons/bg_auth_dam.svg');
/// File path: assets/icons/bg_header_user_profile.svg /// File path: assets/icons/bg_header_user_profile.svg
SvgGenImage get bgHeaderUserProfile => const SvgGenImage('assets/icons/bg_header_user_profile.svg'); SvgGenImage get bgHeaderUserProfile => const SvgGenImage('assets/icons/bg_header_user_profile.svg');
@@ -163,6 +166,9 @@ class $AssetsIconsGen {
/// File path: assets/icons/cube_watting.svg /// File path: assets/icons/cube_watting.svg
SvgGenImage get cubeWatting => const SvgGenImage('assets/icons/cube_watting.svg'); SvgGenImage get cubeWatting => const SvgGenImage('assets/icons/cube_watting.svg');
/// File path: assets/icons/dam_pattern.svg
SvgGenImage get damPattern => const SvgGenImage('assets/icons/dam_pattern.svg');
/// File path: assets/icons/diagram.svg /// File path: assets/icons/diagram.svg
SvgGenImage get diagram => const SvgGenImage('assets/icons/diagram.svg'); SvgGenImage get diagram => const SvgGenImage('assets/icons/diagram.svg');
@@ -396,6 +402,7 @@ class $AssetsIconsGen {
arrowLeft, arrowLeft,
arrowRight, arrowRight,
bgAuth, bgAuth,
bgAuthDam,
bgHeaderUserProfile, bgHeaderUserProfile,
boxRemove, boxRemove,
boxTick, boxTick,
@@ -434,6 +441,7 @@ class $AssetsIconsGen {
cubeSearch, cubeSearch,
cubeTopRotation, cubeTopRotation,
cubeWatting, cubeWatting,
damPattern,
diagram, diagram,
directPurchase, directPurchase,
download, download,
@@ -568,6 +576,9 @@ class $AssetsVecGen {
/// File path: assets/vec/bg_auth.svg.vec /// File path: assets/vec/bg_auth.svg.vec
SvgGenImage get bgAuthSvg => const SvgGenImage.vec('assets/vec/bg_auth.svg.vec'); SvgGenImage get bgAuthSvg => const SvgGenImage.vec('assets/vec/bg_auth.svg.vec');
/// File path: assets/vec/bg_auth_dam.svg.vec
SvgGenImage get bgAuthDamSvg => const SvgGenImage.vec('assets/vec/bg_auth_dam.svg.vec');
/// File path: assets/vec/bg_header_user_profile.svg.vec /// File path: assets/vec/bg_header_user_profile.svg.vec
SvgGenImage get bgHeaderUserProfileSvg => const SvgGenImage.vec('assets/vec/bg_header_user_profile.svg.vec'); SvgGenImage get bgHeaderUserProfileSvg => const SvgGenImage.vec('assets/vec/bg_header_user_profile.svg.vec');
@@ -682,6 +693,9 @@ class $AssetsVecGen {
/// File path: assets/vec/cube_watting.svg.vec /// File path: assets/vec/cube_watting.svg.vec
SvgGenImage get cubeWattingSvg => const SvgGenImage.vec('assets/vec/cube_watting.svg.vec'); SvgGenImage get cubeWattingSvg => const SvgGenImage.vec('assets/vec/cube_watting.svg.vec');
/// File path: assets/vec/dam_pattern.svg.vec
SvgGenImage get damPatternSvg => const SvgGenImage.vec('assets/vec/dam_pattern.svg.vec');
/// File path: assets/vec/diagram.svg.vec /// File path: assets/vec/diagram.svg.vec
SvgGenImage get diagramSvg => const SvgGenImage.vec('assets/vec/diagram.svg.vec'); SvgGenImage get diagramSvg => const SvgGenImage.vec('assets/vec/diagram.svg.vec');
@@ -915,6 +929,7 @@ class $AssetsVecGen {
arrowLeftSvg, arrowLeftSvg,
arrowRightSvg, arrowRightSvg,
bgAuthSvg, bgAuthSvg,
bgAuthDamSvg,
bgHeaderUserProfileSvg, bgHeaderUserProfileSvg,
boxRemoveSvg, boxRemoveSvg,
boxTickSvg, boxTickSvg,
@@ -953,6 +968,7 @@ class $AssetsVecGen {
cubeSearchSvg, cubeSearchSvg,
cubeTopRotationSvg, cubeTopRotationSvg,
cubeWattingSvg, cubeWattingSvg,
damPatternSvg,
diagramSvg, diagramSvg,
directPurchaseSvg, directPurchaseSvg,
downloadSvg, downloadSvg,

View File

@@ -132,6 +132,8 @@ class _RTextFieldState extends State<RTextField> {
late TextDirection textDirection; late TextDirection textDirection;
Timer? _debounceTimer; Timer? _debounceTimer;
final GlobalKey<FormFieldState<String>> _formFieldKey =
GlobalKey<FormFieldState<String>>();
TextDirection _detectDirection(String text) { TextDirection _detectDirection(String text) {
final isPersian = RegExp(r'[\u0600-\u06FF]').hasMatch(text); final isPersian = RegExp(r'[\u0600-\u06FF]').hasMatch(text);
@@ -196,13 +198,29 @@ class _RTextFieldState extends State<RTextField> {
return widget.suffixIcon; return widget.suffixIcon;
} }
double _calculateHeight() {
if (!widget.isFullHeight) {
return widget.height;
}
// اگر خطا وجود دارد، ارتفاع اضافی برای نمایش خطا اضافه می‌کنیم
final hasError = _formFieldKey.currentState?.hasError ?? false;
if (hasError) {
// ارتفاع خطا تقریباً 20 پیکسل است (یک خط متن خطا)
return widget.height + 20;
}
return widget.height;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SizedBox( return SizedBox(
height: (widget.height).h, height: _calculateHeight().h,
child: Padding( child: Padding(
padding: widget.padding ?? EdgeInsets.zero, padding: widget.padding ?? EdgeInsets.zero,
child: TextFormField( child: TextFormField(
key: _formFieldKey,
textAlignVertical: TextAlignVertical.center, textAlignVertical: TextAlignVertical.center,
controller: widget.controller, controller: widget.controller,
focusNode: widget.focusNode, focusNode: widget.focusNode,
@@ -210,8 +228,21 @@ class _RTextFieldState extends State<RTextField> {
readOnly: widget.readonly, readOnly: widget.readonly,
minLines: widget.minLines, minLines: widget.minLines,
maxLines: widget.maxLines, maxLines: widget.maxLines,
onChanged: widget.onChanged, onChanged: (value) {
validator: widget.validator, widget.onChanged?.call(value);
},
validator: (value) {
final error = widget.validator?.call(value);
if (widget.isFullHeight) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
setState(() {});
}
});
}
return error;
},
inputFormatters: widget.inputFormatters, inputFormatters: widget.inputFormatters,
enabled: widget.enabled, enabled: widget.enabled,
obscureText: obscure, obscureText: obscure,

View File

@@ -49,14 +49,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.7.0" version: "2.7.0"
asn1lib:
dependency: transitive
description:
name: asn1lib
sha256: "9a8f69025044eb466b9b60ef3bc3ac99b4dc6c158ae9c56d25eeccf5bc56d024"
url: "https://pub.dev"
source: hosted
version: "1.6.5"
async: async:
dependency: transitive dependency: transitive
description: description:
@@ -337,14 +329,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.11" version: "0.7.11"
device_frame_plus:
dependency: transitive
description:
name: device_frame_plus
sha256: ccc94abccd4d9f0a9f19ef239001b3a59896e678ad42601371d7065889f2bf78
url: "https://pub.dev"
source: hosted
version: "1.5.0"
device_info_plus: device_info_plus:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -361,14 +345,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "7.0.3" version: "7.0.3"
device_preview_plus:
dependency: "direct main"
description:
name: device_preview_plus
sha256: eb3e67929c9f04759e0d3708ad91d1018235549bcf8699f8a94909684c6555ae
url: "https://pub.dev"
source: hosted
version: "2.5.5"
dio: dio:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -385,14 +361,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
encrypt:
dependency: "direct main"
description:
name: encrypt
sha256: "62d9aa4670cc2a8798bab89b39fc71b6dfbacf615de6cf5001fb39f7e4a996a2"
url: "https://pub.dev"
source: hosted
version: "5.0.3"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
@@ -1309,14 +1277,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.8" version: "2.1.8"
pointycastle:
dependency: transitive
description:
name: pointycastle
sha256: "4be0097fcf3fd3e8449e53730c631200ebc7b88016acecab2b0da2f0149222fe"
url: "https://pub.dev"
source: hosted
version: "3.9.1"
pool: pool:
dependency: transitive dependency: transitive
description: description:
@@ -1373,22 +1333,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.5.0" version: "1.5.0"
rive:
dependency: "direct main"
description:
name: rive
sha256: "2551a44fa766a7ed3f52aa2b94feda6d18d00edc25dee5f66e72e9b365bb6d6c"
url: "https://pub.dev"
source: hosted
version: "0.13.20"
rive_common:
dependency: transitive
description:
name: rive_common
sha256: "2ba42f80d37a4efd0696fb715787c4785f8a13361e8aea9227c50f1e78cf763a"
url: "https://pub.dev"
source: hosted
version: "0.4.15"
rxdart: rxdart:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -1405,62 +1349,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.1" version: "1.1.1"
shared_preferences:
dependency: transitive
description:
name: shared_preferences
sha256: "2939ae520c9024cb197fc20dee269cd8cdbf564c8b5746374ec6cacdc5169e64"
url: "https://pub.dev"
source: hosted
version: "2.5.4"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
sha256: "83af5c682796c0f7719c2bbf74792d113e40ae97981b8f266fa84574573556bc"
url: "https://pub.dev"
source: hosted
version: "2.4.18"
shared_preferences_foundation:
dependency: transitive
description:
name: shared_preferences_foundation
sha256: "4e7eaffc2b17ba398759f1151415869a34771ba11ebbccd1b0145472a619a64f"
url: "https://pub.dev"
source: hosted
version: "2.5.6"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f"
url: "https://pub.dev"
source: hosted
version: "2.4.1"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80"
url: "https://pub.dev"
source: hosted
version: "2.4.1"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019
url: "https://pub.dev"
source: hosted
version: "2.4.3"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1"
url: "https://pub.dev"
source: hosted
version: "2.4.1"
shelf: shelf:
dependency: transitive dependency: transitive
description: description:
@@ -1836,4 +1724,4 @@ packages:
version: "2.1.0" version: "2.1.0"
sdks: sdks:
dart: ">=3.10.0 <4.0.0" dart: ">=3.10.0 <4.0.0"
flutter: ">=3.35.7" flutter: ">=3.35.0"

View File

@@ -44,7 +44,7 @@ dependencies:
#SVG #SVG
flutter_svg: ^2.2.1 flutter_svg: ^2.2.1
cached_network_image: ^3.4.1 cached_network_image: ^3.4.1
rive: ^0.13.20
#Shimmer #Shimmer
shimmer: ^3.0.0 shimmer: ^3.0.0
@@ -61,9 +61,8 @@ dependencies:
#other #other
permission_handler: ^12.0.1 permission_handler: ^12.0.1
persian_datetime_picker: ^3.2.0 persian_datetime_picker: ^3.2.0
encrypt: ^5.0.3
collection: ^1.19.1 collection: ^1.19.1
device_preview_plus: ^2.5.1
#L10N tools #L10N tools
intl: ^0.20.2 intl: ^0.20.2

View File

@@ -11,98 +11,105 @@ class AuthPage extends GetView<AuthLogic> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body:PopScope( body: PopScope(
canPop: false, canPop: false,
onPopInvokedWithResult: (didPop, result) { onPopInvokedWithResult: (didPop, result) {
Get.back(result: -1); Get.back(result: -1);
}, },
child: Stack( child: Stack(
alignment: Alignment.center, alignment: Alignment.center,
fit: StackFit.expand, fit: StackFit.expand,
children: [ children: [
Assets.vec.bgAuthSvg.svg(fit: BoxFit.fill), Assets.icons.bgAuthDam.svg(fit: BoxFit.fill),
Center( Center(
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10.r), padding: EdgeInsets.symmetric(horizontal: 10.r),
child: FadeTransition( child: FadeTransition(
opacity: controller.textAnimation, opacity: controller.textAnimation,
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
spacing: 12, spacing: 12,
children: [ children: [
Text( Text(
'به سامانه رصدیار خوش آمدید!', 'به سامانه رصدیار خوش آمدید!',
textAlign: TextAlign.right, textAlign: TextAlign.right,
style: AppFonts.yekan25Bold.copyWith(color: Colors.white), style: AppFonts.yekan25Bold.copyWith(
), color: Colors.white,
Text( ),
'سامانه رصد و پایش زنجیره تامین، تولید و توزیع کالا های اساسی', ),
textAlign: TextAlign.center, Text(
style: AppFonts.yekan16.copyWith(color: Colors.white), 'سامانه رصد و پایش زنجیره تامین، تولید و توزیع کالا های اساسی',
), textAlign: TextAlign.center,
], style: AppFonts.yekan16.copyWith(color: Colors.white),
),
],
),
), ),
), ),
), ),
),
Obx(() { Obx(() {
final screenHeight = MediaQuery.of(context).size.height; final screenHeight = MediaQuery.of(context).size.height;
final targetTop = (screenHeight - 676) / 2; final targetTop = (screenHeight - 676) / 2;
return AnimatedPositioned( return AnimatedPositioned(
duration: const Duration(milliseconds: 1200), duration: const Duration(milliseconds: 1200),
curve: Curves.linear, curve: Curves.linear,
top: controller.showCard.value ? targetTop : screenHeight, top: controller.showCard.value ? targetTop : screenHeight,
left: 10.r, left: 10.r,
right: 10.r, right: 10.r,
child: Container( child: Container(
width: 381.w, width: 381.w,
height: 676.h, height: 676.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(40), borderRadius: BorderRadius.circular(40),
), ),
child: Column( child: Column(
children: [ children: [
SizedBox(height: 50.h), SizedBox(height: 50.h),
LogoWidget(), LogoWidget(),
SizedBox(height: 20.h), SizedBox(height: 20.h),
useAndPassFrom(), useAndPassFrom(),
SizedBox(height: 24.h), SizedBox(height: 24.h),
RichText( RichText(
text: TextSpan( text: TextSpan(
children: [ children: [
TextSpan( TextSpan(
text: 'مطالعه بیانیه ', text: 'مطالعه بیانیه ',
style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDark), style: AppFonts.yekan16.copyWith(
), color: AppColor.darkGreyDark,
TextSpan( ),
recognizer: TapGestureRecognizer() ),
..onTap = () { TextSpan(
Get.bottomSheet( recognizer: TapGestureRecognizer()
privacyPolicyWidget(), ..onTap = () {
isScrollControlled: true, Get.bottomSheet(
enableDrag: true, privacyPolicyWidget(),
ignoreSafeArea: false, isScrollControlled: true,
); enableDrag: true,
}, ignoreSafeArea: false,
text: 'حریم خصوصی', );
style: AppFonts.yekan16.copyWith(color: AppColor.blueNormal), },
), text: 'حریم خصوصی',
], style: AppFonts.yekan16.copyWith(
color: AppColor.blueNormal,
),
),
],
),
), ),
), ],
], ),
), ),
), );
); }),
}), ],
], ),
)), ),
); );
} }
@@ -115,17 +122,15 @@ class AuthPage extends GetView<AuthLogic> {
child: Column( child: Column(
children: [ children: [
RTextField( RTextField(
height: 48.h,
isFullHeight: true,
label: 'نام کاربری', label: 'نام کاربری',
maxLength: 11, maxLength: 11,
maxLines: 1, maxLines: 1,
controller: controller.usernameController.value, controller: controller.usernameController.value,
keyboardType: TextInputType.number,
initText: controller.usernameController.value.text, initText: controller.usernameController.value.text,
autofillHints: [AutofillHints.username], autofillHints: [AutofillHints.username],
focusedBorder: OutlineInputBorder( borderColor: AppColor.textColor,
borderRadius: BorderRadius.circular(8),
borderSide: BorderSide(color: AppColor.textColor, width: 1),
),
onChanged: (value) async { onChanged: (value) async {
controller.usernameController.value.text = value; controller.usernameController.value.text = value;
controller.usernameController.refresh(); controller.usernameController.refresh();
@@ -134,14 +139,15 @@ class AuthPage extends GetView<AuthLogic> {
padding: const EdgeInsets.fromLTRB(0, 8, 6, 8), padding: const EdgeInsets.fromLTRB(0, 8, 6, 8),
child: Assets.vec.callSvg.svg(width: 12, height: 12), child: Assets.vec.callSvg.svg(width: 12, height: 12),
), ),
suffixIcon: controller.usernameController.value.text.trim().isNotEmpty suffixIcon:
controller.usernameController.value.text.trim().isNotEmpty
? clearButton(() { ? clearButton(() {
controller.usernameController.value.clear(); controller.usernameController.value.clear();
controller.usernameController.refresh(); controller.usernameController.refresh();
}) })
: null, : null,
validator: (value) { validator: (value) {
/* if (value == null || value.isEmpty) { /* if (value == null || value.isEmpty) {
return '⚠️ شماره موبایل را وارد کنید'; return '⚠️ شماره موبایل را وارد کنید';
} else if (value.length < 10) { } else if (value.length < 10) {
return '⚠️ شماره موبایل باید 11 رقم باشد'; return '⚠️ شماره موبایل باید 11 رقم باشد';
@@ -149,25 +155,20 @@ class AuthPage extends GetView<AuthLogic> {
return null; return null;
}, },
style: AppFonts.yekan13, style: AppFonts.yekan13,
errorStyle: AppFonts.yekan13.copyWith(color: AppColor.redNormal), errorStyle: AppFonts.yekan13.copyWith(
labelStyle: AppFonts.yekan13, color: AppColor.redNormal,
boxConstraints: const BoxConstraints(
maxHeight: 40,
minHeight: 40,
maxWidth: 40,
minWidth: 40,
), ),
labelStyle: AppFonts.yekan13,
), ),
const SizedBox(height: 26), SizedBox(height: 16.h),
ObxValue( ObxValue(
(passwordController) => RTextField( (passwordController) => RTextField(
height: 48.h,
isFullHeight: true,
label: 'رمز عبور', label: 'رمز عبور',
filled: false, filled: false,
obscure: true, obscure: true,
focusedBorder: OutlineInputBorder( borderColor: AppColor.textColor,
borderRadius: BorderRadius.circular(8),
borderSide: BorderSide(color: AppColor.textColor, width: 1),
),
controller: passwordController.value, controller: passwordController.value,
autofillHints: [AutofillHints.password], autofillHints: [AutofillHints.password],
variant: RTextFieldVariant.password, variant: RTextFieldVariant.password,
@@ -182,18 +183,10 @@ class AuthPage extends GetView<AuthLogic> {
return null; return null;
}, },
style: AppFonts.yekan13, style: AppFonts.yekan13,
errorStyle: AppFonts.yekan13.copyWith(color: AppColor.redNormal), errorStyle: AppFonts.yekan13.copyWith(
color: AppColor.redNormal,
),
labelStyle: AppFonts.yekan13, labelStyle: AppFonts.yekan13,
prefixIcon: Padding(
padding: const EdgeInsets.fromLTRB(0, 8, 8, 8),
child: Assets.vec.keySvg.svg(width: 12, height: 12),
),
boxConstraints: const BoxConstraints(
maxHeight: 34,
minHeight: 34,
maxWidth: 34,
minWidth: 34,
),
), ),
controller.passwordController, controller.passwordController,
), ),
@@ -208,36 +201,44 @@ class AuthPage extends GetView<AuthLogic> {
ObxValue((data) { ObxValue((data) {
return Checkbox( return Checkbox(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
visualDensity: VisualDensity(horizontal: -4, vertical: 4), visualDensity: VisualDensity(
horizontal: -4,
vertical: 4,
),
tristate: true, tristate: true,
value: data.value, value: data.value,
onChanged: (value) { onChanged: (value) {
data.value = value ?? false; data.value = value ?? false;
}, },
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(4)), shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4),
),
activeColor: AppColor.blueNormal, activeColor: AppColor.blueNormal,
); );
}, controller.rememberMe), }, controller.rememberMe),
Text( Text(
'مرا به خاطر بسپار', 'مرا به خاطر بسپار',
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark), style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDark,
),
), ),
], ],
), ),
), ),
Obx(() { Obx(() {
return RElevated( return RElevated(
text: 'ورود', text: 'ورود',
backgroundColor: AppColor.blueNormal,
isLoading: controller.isLoading.value, isLoading: controller.isLoading.value,
onPressed: controller.isDisabled.value onPressed: controller.isDisabled.value
? null ? null
: () async { : () async {
await controller.submitLoginForm(); await controller.submitLoginForm();
}, },
width: Get.width, width: Get.width,
height: 48, height: 48.h,
); );
}), }),
], ],
@@ -266,11 +267,16 @@ class AuthPage extends GetView<AuthLogic> {
children: [ children: [
Text( Text(
'بيانيه حريم خصوصی', 'بيانيه حريم خصوصی',
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal), style: AppFonts.yekan16Bold.copyWith(
color: AppColor.blueNormal,
),
), ),
Text( Text(
'اطلاعات مربوط به هر شخص، حریم خصوصی وی محسوب می‌شود. حفاظت و حراست از اطلاعات شخصی در سامانه رصد یار، نه تنها موجب حفظ امنیت کاربران می‌شود، بلکه باعث اعتماد بیشتر و مشارکت آنها در فعالیت‌های جاری می‌گردد. هدف از این بیانیه، آگاه ساختن شما درباره ی نوع و نحوه ی استفاده از اطلاعاتی است که در هنگام استفاده از سامانه رصد یار ، از جانب شما دریافت می‌گردد. شرکت هوشمند سازان خود را ملزم به رعایت حریم خصوصی همه شهروندان و کاربران سامانه دانسته و آن دسته از اطلاعات کاربران را که فقط به منظور ارائه خدمات کفایت می‌کند، دریافت کرده و از انتشار آن یا در اختیار قرار دادن آن به دیگران خودداری مینماید.', 'اطلاعات مربوط به هر شخص، حریم خصوصی وی محسوب می‌شود. حفاظت و حراست از اطلاعات شخصی در سامانه رصد یار، نه تنها موجب حفظ امنیت کاربران می‌شود، بلکه باعث اعتماد بیشتر و مشارکت آنها در فعالیت‌های جاری می‌گردد. هدف از این بیانیه، آگاه ساختن شما درباره ی نوع و نحوه ی استفاده از اطلاعاتی است که در هنگام استفاده از سامانه رصد یار ، از جانب شما دریافت می‌گردد. شرکت هوشمند سازان خود را ملزم به رعایت حریم خصوصی همه شهروندان و کاربران سامانه دانسته و آن دسته از اطلاعات کاربران را که فقط به منظور ارائه خدمات کفایت می‌کند، دریافت کرده و از انتشار آن یا در اختیار قرار دادن آن به دیگران خودداری مینماید.',
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark, height: 1.8), style: AppFonts.yekan14.copyWith(
color: AppColor.bgDark,
height: 1.8,
),
), ),
], ],
), ),
@@ -290,7 +296,9 @@ class AuthPage extends GetView<AuthLogic> {
children: [ children: [
Text( Text(
'چگونگی جمع آوری و استفاده از اطلاعات کاربران', 'چگونگی جمع آوری و استفاده از اطلاعات کاربران',
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal), style: AppFonts.yekan16Bold.copyWith(
color: AppColor.blueNormal,
),
), ),
Text( Text(
'''الف: اطلاعاتی که شما خود در اختيار این سامانه قرار می‌دهيد، شامل موارد زيرهستند: '''الف: اطلاعاتی که شما خود در اختيار این سامانه قرار می‌دهيد، شامل موارد زيرهستند:
@@ -302,7 +310,10 @@ class AuthPage extends GetView<AuthLogic> {
⦁ تعداد بازدیدهای روزانه در درگاه. ⦁ تعداد بازدیدهای روزانه در درگاه.
⦁ هدف ما از دریافت این اطلاعات استفاده از آنها در تحلیل عملکرد کاربران درگاه می باشد تا بتوانیم در خدمت رسانی بهتر عمل کنیم. ⦁ هدف ما از دریافت این اطلاعات استفاده از آنها در تحلیل عملکرد کاربران درگاه می باشد تا بتوانیم در خدمت رسانی بهتر عمل کنیم.
''', ''',
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark, height: 1.8), style: AppFonts.yekan14.copyWith(
color: AppColor.bgDark,
height: 1.8,
),
), ),
], ],
), ),
@@ -322,11 +333,16 @@ class AuthPage extends GetView<AuthLogic> {
children: [ children: [
Text( Text(
'امنیت اطلاعات', 'امنیت اطلاعات',
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal), style: AppFonts.yekan16Bold.copyWith(
color: AppColor.blueNormal,
),
), ),
Text( Text(
'متعهدیم که امنیت اطلاعات شما را تضمین نماییم و برای جلوگیری از هر نوع دسترسی غیرمجاز و افشای اطلاعات شما از همه شیوه‌‌های لازم استفاده می‌کنیم تا امنیت اطلاعاتی را که به صورت آنلاین گردآوری می‌کنیم، حفظ شود. لازم به ذکر است در سامانه ما، ممکن است به سایت های دیگری لینک شوید، وقتی که شما از طریق این لینک‌ها از سامانه ما خارج می‌شوید، توجه داشته باشید که ما بر دیگر سایت ها کنترل نداریم و سازمان تعهدی بر حفظ حریم شخصی آنان در سایت مقصد نخواهد داشت و مراجعه کنندگان میبایست به بیانیه حریم شخصی آن سایت ها مراجعه نمایند.', 'متعهدیم که امنیت اطلاعات شما را تضمین نماییم و برای جلوگیری از هر نوع دسترسی غیرمجاز و افشای اطلاعات شما از همه شیوه‌‌های لازم استفاده می‌کنیم تا امنیت اطلاعاتی را که به صورت آنلاین گردآوری می‌کنیم، حفظ شود. لازم به ذکر است در سامانه ما، ممکن است به سایت های دیگری لینک شوید، وقتی که شما از طریق این لینک‌ها از سامانه ما خارج می‌شوید، توجه داشته باشید که ما بر دیگر سایت ها کنترل نداریم و سازمان تعهدی بر حفظ حریم شخصی آنان در سایت مقصد نخواهد داشت و مراجعه کنندگان میبایست به بیانیه حریم شخصی آن سایت ها مراجعه نمایند.',
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark, height: 1.8), style: AppFonts.yekan14.copyWith(
color: AppColor.bgDark,
height: 1.8,
),
), ),
], ],
), ),
@@ -335,240 +351,4 @@ class AuthPage extends GetView<AuthLogic> {
), ),
); );
} }
/*
Widget sendCodeForm() {
return ObxValue((data) {
return Form(
key: data.value,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 30, vertical: 50),
child: Column(
children: [
SizedBox(height: 26),
ObxValue((phoneController) {
return TextFormField(
controller: phoneController.value,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
gapPadding: 11,
),
labelText: 'شماره موبایل',
labelStyle: AppFonts.yekan13,
errorStyle: AppFonts.yekan13.copyWith(
color: AppColor.redNormal,
),
prefixIconConstraints: BoxConstraints(
maxHeight: 40,
minHeight: 40,
maxWidth: 40,
minWidth: 40,
),
prefixIcon: Padding(
padding: const EdgeInsets.fromLTRB(0, 8, 6, 8),
child: vecWidget(Assets.vecCallSvg),
),
suffix:
phoneController.value.text.trim().isNotEmpty
? clearButton(() {
phoneController.value.clear();
phoneController.refresh();
})
: null,
counterText: '',
),
keyboardType: TextInputType.numberWithOptions(
decimal: false,
signed: false,
),
maxLines: 1,
maxLength: 11,
onChanged: (value) {
if (controller.isOnError.value) {
controller.isOnError.value = !controller.isOnError.value;
data.value.currentState?.reset();
data.refresh();
phoneController.value.text = value;
}
phoneController.refresh();
},
textInputAction: TextInputAction.next,
validator: (value) {
if (value == null) {
return '⚠️ شماره موبایل را وارد کنید';
} else if (value.length < 11) {
return '⚠️ شماره موبایل باید 11 رقم باشد';
}
return null;
},
style: AppFonts.yekan13,
);
}, controller.phoneOtpNumberController),
SizedBox(height: 26),
CaptchaWidget(),
SizedBox(height: 23),
RElevated(
text: 'ارسال رمز یکبار مصرف',
onPressed: () {
if (data.value.currentState?.validate() == true) {
controller.otpStatus.value = OtpStatus.sent;
controller.startTimer();
}
},
width: Get.width,
height: 48,
),
],
),
),
);
}, controller.formKeyOtp);
}
Widget confirmCodeForm() {
return ObxValue((data) {
return Form(
key: data.value,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 30, vertical: 50),
child: Column(
children: [
SizedBox(height: 26),
ObxValue((passwordController) {
return TextFormField(
controller: passwordController.value,
obscureText: controller.hidePassword.value,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
gapPadding: 11,
),
labelText: 'رمز عبور',
labelStyle: AppFonts.yekan13,
errorStyle: AppFonts.yekan13.copyWith(
color: AppColor.redNormal,
),
prefixIconConstraints: BoxConstraints(
maxHeight: 34,
minHeight: 34,
maxWidth: 34,
minWidth: 34,
),
prefixIcon: Padding(
padding: const EdgeInsets.fromLTRB(0, 8, 8, 8),
child: vecWidget(Assets.vecKeySvg),
),
suffix:
passwordController.value.text.trim().isNotEmpty
? GestureDetector(
onTap: () {
controller.hidePassword.value =
!controller.hidePassword.value;
},
child: Icon(
controller.hidePassword.value
? CupertinoIcons.eye
: CupertinoIcons.eye_slash,
),
)
: null,
counterText: '',
),
textInputAction: TextInputAction.done,
keyboardType: TextInputType.visiblePassword,
maxLines: 1,
onChanged: (value) {
if (controller.isOnError.value) {
controller.isOnError.value = !controller.isOnError.value;
data.value.currentState?.reset();
passwordController.value.text = value;
}
passwordController.refresh();
},
validator: (value) {
if (value == null || value.isEmpty) {
return '⚠️ رمز عبور را وارد کنید'; // "Please enter the password"
}
return null;
},
style: AppFonts.yekan13,
);
}, controller.passwordController),
SizedBox(height: 23),
ObxValue((timer) {
if (timer.value == 0) {
return TextButton(
onPressed: () {
controller.otpStatus.value = OtpStatus.reSend;
controller.startTimer();
},
child: Text(
style: AppFonts.yekan13.copyWith(
color: AppColor.blueNormal,
),
'ارسال مجدد کد یکبار مصرف',
),
);
} else {
return Text(
'اعتبار رمز ارسال شده ${controller.timeFormatted}',
style: AppFonts.yekan13,
);
}
}, controller.secondsRemaining),
RichText(
text: TextSpan(
children: [
TextSpan(
text: ' کد ارسال شده به شماره ',
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDark,
),
),
TextSpan(
text: controller.phoneOtpNumberController.value.text,
style: AppFonts.yekan13Bold.copyWith(
color: AppColor.darkGreyDark,
),
),
TextSpan(
recognizer:
TapGestureRecognizer()
..onTap = () {
controller.otpStatus.value = OtpStatus.init;
},
text: ' ویرایش',
style: AppFonts.yekan14.copyWith(
color: AppColor.blueNormal,
),
),
],
),
),
SizedBox(height: 23),
RElevated(
text: 'ورود',
onPressed: () {
if (controller.formKeyOtp.value.currentState?.validate() ==
true) {}
},
width: Get.width,
height: 48,
),
],
),
),
);
}, controller.formKeySentOtp);
}*/
} }

View File

@@ -1,72 +1,21 @@
import 'package:rasadyar_core/core.dart' hide BaseLogic; import 'package:rasadyar_core/core.dart' hide BaseLogic;
import 'package:rasadyar_livestock/features/common/auth/presentation/pages/logic.dart'; import 'package:rasadyar_livestock/features/auth/presentation/pages/logic.dart';
import 'package:rasadyar_livestock/presentation/page/auth/view.dart'; import 'package:rasadyar_livestock/features/auth/presentation/pages/view.dart';
import 'package:rasadyar_livestock/presentation/page/map/logic.dart';
import 'package:rasadyar_livestock/presentation/page/map/widget/map_widget/logic.dart';
import 'package:rasadyar_livestock/presentation/page/profile/logic.dart';
import 'package:rasadyar_livestock/presentation/page/request_tagging/logic.dart';
import 'package:rasadyar_livestock/presentation/page/request_tagging/view.dart';
import 'package:rasadyar_livestock/presentation/page/requests/logic.dart';
import 'package:rasadyar_livestock/presentation/page/root/logic.dart';
import 'package:rasadyar_livestock/presentation/page/root/view.dart';
import 'package:rasadyar_livestock/presentation/page/tagging/logic.dart';
import 'package:rasadyar_livestock/presentation/page/tagging/view.dart';
import 'package:rasadyar_livestock/presentation/widgets/base_page/logic.dart';
import 'package:rasadyar_livestock/presentation/widgets/captcha/logic.dart'; import 'package:rasadyar_livestock/presentation/widgets/captcha/logic.dart';
part 'routes.dart';
part 'app_routes.dart'; sealed class AuthLiveStockPages {
AuthLiveStockPages._();
sealed class LiveStockPages {
LiveStockPages._();
static final pages = [ static final pages = [
GetPage( GetPage(
name: LiveStockRoutes.auth, name: AuthLiveStockRoutes.auth,
page: () => AuthPage(), page: () => AuthPage(),
binding: BindingsBuilder(() { binding: BindingsBuilder(() {
Get.lazyPut(() => AuthLogic()); Get.lazyPut(() => AuthLogic());
Get.lazyPut(() => CaptchaWidgetLogic()); Get.lazyPut(() => CaptchaWidgetLogic());
}), }),
), ),
GetPage(
name: LiveStockRoutes.init,
page: () => RootPage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.put(RootLogic());
Get.lazyPut(() => RequestsLogic());
Get.lazyPut(() => MapLogic());
Get.lazyPut(() => ProfileLogic());
Get.lazyPut(() => MapWidgetLogic());
Get.lazyPut(() => BaseLogic());
}),
children: [
/*GetPage(
name: LiveStockRoutes.requestTagging,
page: () => RequestTaggingPage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => RequestTaggingLogic());
}),
),*/
],
),
GetPage(
name: LiveStockRoutes.requestTagging,
page: () => RequestTaggingPage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => RequestTaggingLogic());
}),
),
GetPage(
name: LiveStockRoutes.tagging,
page: () => TaggingPage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => TaggingLogic());
}),
),
]; ];
} }

View File

@@ -1,13 +1,8 @@
part of 'app_pages.dart'; part of 'pages.dart';
sealed class LiveStockRoutes { sealed class AuthLiveStockRoutes {
LiveStockRoutes._(); AuthLiveStockRoutes._();
static const auth = '/AuthLiveStock'; static const auth = '/AuthLiveStock';
static const init = '/liveStock';
static const requests = '/requests';
static const map = '/map';
static const profile = '/profile';
static const requestTagging = '$requests/tagging';
static const tagging = '/tagging';
} }

View File

@@ -9,6 +9,7 @@ import 'package:rasadyar_livestock/data/repository/auth/auth_repository_imp.dart
import 'package:rasadyar_livestock/data/repository/livestock/livestock_repository.dart'; import 'package:rasadyar_livestock/data/repository/livestock/livestock_repository.dart';
import 'package:rasadyar_livestock/data/repository/livestock/livestock_repository_imp.dart'; import 'package:rasadyar_livestock/data/repository/livestock/livestock_repository_imp.dart';
import 'package:rasadyar_livestock/data/service/live_stock_storage_service.dart'; import 'package:rasadyar_livestock/data/service/live_stock_storage_service.dart';
import 'package:rasadyar_livestock/features/auth/presentation/routes/pages.dart';
import 'package:rasadyar_livestock/hive_registrar.g.dart'; import 'package:rasadyar_livestock/hive_registrar.g.dart';
import 'package:rasadyar_livestock/presentation/routes/app_pages.dart'; import 'package:rasadyar_livestock/presentation/routes/app_pages.dart';
@@ -25,7 +26,10 @@ Future<void> setupLiveStockDI() async {
Get.lazyPut(() => LiveStockStorageService()); Get.lazyPut(() => LiveStockStorageService());
if (tokenService.baseurl.value == null) { if (tokenService.baseurl.value == null) {
await tokenService.saveBaseUrl(Module.inspection, 'https://api.dam.rasadyar.net/'); await tokenService.saveBaseUrl(
Module.inspection,
'https://api.dam.rasadyar.net/',
);
} }
// First register AppInterceptor with lazy callbacks // First register AppInterceptor with lazy callbacks
@@ -48,7 +52,7 @@ Future<void> setupLiveStockDI() async {
}, },
clearTokenCallback: () async { clearTokenCallback: () async {
await tokenService.deleteModuleTokens(Module.liveStocks); await tokenService.deleteModuleTokens(Module.liveStocks);
Get.offAllNamed(LiveStockRoutes.auth, arguments: Module.liveStocks); Get.offAllNamed(AuthLiveStockRoutes.auth, arguments: Module.liveStocks);
}, },
authArguments: Module.liveStocks, authArguments: Module.liveStocks,
), ),
@@ -73,7 +77,8 @@ Future<void> setupLiveStockDI() async {
); );
diLiveStock.registerLazySingleton<AuthRepository>( diLiveStock.registerLazySingleton<AuthRepository>(
() => AuthRepositoryImp(authRemote: diLiveStock.get<AuthRemoteDataSource>()), () =>
AuthRepositoryImp(authRemote: diLiveStock.get<AuthRemoteDataSource>()),
); );
//endregion //endregion
@@ -82,7 +87,9 @@ Future<void> setupLiveStockDI() async {
() => LivestockRemoteDataSourceImp(), () => LivestockRemoteDataSourceImp(),
); );
diLiveStock.registerLazySingleton<TmpLocalDataSource>(() => TmpLocalDataSource()); diLiveStock.registerLazySingleton<TmpLocalDataSource>(
() => TmpLocalDataSource(),
);
diLiveStock.registerLazySingleton<LivestockRepository>( diLiveStock.registerLazySingleton<LivestockRepository>(
() => LivestockRepositoryImp( () => LivestockRepositoryImp(

View File

@@ -2,6 +2,7 @@ import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_livestock/features/auth/presentation/routes/pages.dart';
import 'package:rasadyar_livestock/presentation/routes/app_pages.dart'; import 'package:rasadyar_livestock/presentation/routes/app_pages.dart';
import 'logic.dart'; import 'logic.dart';
@@ -84,7 +85,10 @@ class ProfilePage extends GetView<ProfileLogic> {
children: [ children: [
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 10), padding: const EdgeInsets.symmetric(
horizontal: 30,
vertical: 10,
),
child: userProfileInformation(), child: userProfileInformation(),
), ),
), ),
@@ -99,18 +103,27 @@ class ProfilePage extends GetView<ProfileLogic> {
title: 'تغییر رمز عبور', title: 'تغییر رمز عبور',
selected: true, selected: true,
onPressed: () { onPressed: () {
Get.bottomSheet(changePasswordBottomSheet(), isScrollControlled: true); Get.bottomSheet(
changePasswordBottomSheet(),
isScrollControlled: true,
);
}, },
icon: Assets.vec.lockSvg.path, icon: Assets.vec.lockSvg.path,
), ),
cardActionWidget( cardActionWidget(
title: 'خروج', title: 'خروج',
selected: true, selected: true,
color: ColorFilter.mode(Colors.redAccent, BlendMode.srcIn), color: ColorFilter.mode(
Colors.redAccent,
BlendMode.srcIn,
),
cardColor: Color(0xFFEFEFEF), cardColor: Color(0xFFEFEFEF),
textColor: AppColor.redDarkerText, textColor: AppColor.redDarkerText,
onPressed: () { onPressed: () {
Get.bottomSheet(exitBottomSheet(), isScrollControlled: true); Get.bottomSheet(
exitBottomSheet(),
isScrollControlled: true,
);
}, },
icon: Assets.vec.logoutSvg.path, icon: Assets.vec.logoutSvg.path,
), ),
@@ -157,7 +170,9 @@ class ProfilePage extends GetView<ProfileLogic> {
children: [ children: [
Text( Text(
'اطلاعات هویتی', 'اطلاعات هویتی',
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal), style: AppFonts.yekan16Bold.copyWith(
color: AppColor.blueNormal,
),
), ),
Container(width: 37.w, height: 1.h, color: AppColor.greenNormal), Container(width: 37.w, height: 1.h, color: AppColor.greenNormal),
], ],
@@ -199,7 +214,11 @@ class ProfilePage extends GetView<ProfileLogic> {
content: /*item.province ??*/ 'نامشخص', content: /*item.province ??*/ 'نامشخص',
icon: Assets.vec.pictureFrameSvg.path, icon: Assets.vec.pictureFrameSvg.path,
), ),
itemList(title: 'شهر', content: /* item.city ?? */ 'نامشخص', icon: Assets.vec.mapSvg.path), itemList(
title: 'شهر',
content: /* item.city ?? */ 'نامشخص',
icon: Assets.vec.mapSvg.path,
),
], ],
); );
/* return ObxValue((data) { /* return ObxValue((data) {
@@ -300,12 +319,25 @@ class ProfilePage extends GetView<ProfileLogic> {
child: SvgGenImage.vec(icon).svg( child: SvgGenImage.vec(icon).svg(
width: 20.w, width: 20.w,
height: 20.h, height: 20.h,
colorFilter: ColorFilter.mode(AppColor.mediumGreyNormalActive, BlendMode.srcIn), colorFilter: ColorFilter.mode(
AppColor.mediumGreyNormalActive,
BlendMode.srcIn,
),
), ),
), ),
Text(title, style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyNormalActive)), Text(
title,
style: AppFonts.yekan12.copyWith(
color: AppColor.mediumGreyNormalActive,
),
),
Spacer(), Spacer(),
Text(content, style: AppFonts.yekan13.copyWith(color: AppColor.mediumGreyNormalHover)), Text(
content,
style: AppFonts.yekan13.copyWith(
color: AppColor.mediumGreyNormalHover,
),
),
], ],
), ),
); );
@@ -330,7 +362,9 @@ class ProfilePage extends GetView<ProfileLogic> {
padding: EdgeInsets.all(8), padding: EdgeInsets.all(8),
decoration: ShapeDecoration( decoration: ShapeDecoration(
color: cardColor ?? AppColor.blueLight, color: cardColor ?? AppColor.blueLight,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
), ),
child: SvgGenImage.vec(icon).svg( child: SvgGenImage.vec(icon).svg(
width: 40, width: 40,
@@ -347,7 +381,9 @@ class ProfilePage extends GetView<ProfileLogic> {
Text( Text(
title, title,
style: AppFonts.yekan10.copyWith( style: AppFonts.yekan10.copyWith(
color: textColor ?? (selected ? AppColor.blueNormal : AppColor.blueLightActive), color:
textColor ??
(selected ? AppColor.blueNormal : AppColor.blueLightActive),
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
@@ -365,7 +401,9 @@ class ProfilePage extends GetView<ProfileLogic> {
children: [ children: [
Text( Text(
'ویرایش اطلاعات هویتی', 'ویرایش اطلاعات هویتی',
style: AppFonts.yekan16Bold.copyWith(color: AppColor.darkGreyDarkHover), style: AppFonts.yekan16Bold.copyWith(
color: AppColor.darkGreyDarkHover,
),
), ),
Container( Container(
@@ -437,7 +475,9 @@ class ProfilePage extends GetView<ProfileLogic> {
children: [ children: [
Text( Text(
'عکس پروفایل', 'عکس پروفایل',
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal), style: AppFonts.yekan16Bold.copyWith(
color: AppColor.blueNormal,
),
), ),
ObxValue((data) { ObxValue((data) {
return Container( return Container(
@@ -446,15 +486,26 @@ class ProfilePage extends GetView<ProfileLogic> {
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColor.lightGreyNormal, color: AppColor.lightGreyNormal,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1, color: AppColor.blackLight), border: Border.all(
width: 1,
color: AppColor.blackLight,
),
), ),
child: Center( child: Center(
child: data.value == null child: data.value == null
? Padding( ? Padding(
padding: const EdgeInsets.fromLTRB(30, 10, 10, 30), padding: const EdgeInsets.fromLTRB(
30,
10,
10,
30,
),
child: Image.network(''), child: Image.network(''),
) )
: Image.file(File(data.value!.path), fit: BoxFit.cover), : Image.file(
File(data.value!.path),
fit: BoxFit.cover,
),
), ),
); );
}, controller.selectedImage), }, controller.selectedImage),
@@ -467,14 +518,18 @@ class ProfilePage extends GetView<ProfileLogic> {
text: 'گالری', text: 'گالری',
width: 150.w, width: 150.w,
height: 40.h, height: 40.h,
textStyle: AppFonts.yekan20.copyWith(color: Colors.white), textStyle: AppFonts.yekan20.copyWith(
color: Colors.white,
),
onPressed: () async { onPressed: () async {
controller.selectedImage.value = await controller.imagePicker.pickImage( controller.selectedImage.value = await controller
source: ImageSource.gallery, .imagePicker
imageQuality: 60, .pickImage(
maxWidth: 1080, source: ImageSource.gallery,
maxHeight: 720, imageQuality: 60,
); maxWidth: 1080,
maxHeight: 720,
);
}, },
), ),
SizedBox(width: 16), SizedBox(width: 16),
@@ -482,14 +537,18 @@ class ProfilePage extends GetView<ProfileLogic> {
text: 'دوربین', text: 'دوربین',
width: 150.w, width: 150.w,
height: 40.h, height: 40.h,
textStyle: AppFonts.yekan20.copyWith(color: AppColor.blueNormal), textStyle: AppFonts.yekan20.copyWith(
color: AppColor.blueNormal,
),
onPressed: () async { onPressed: () async {
controller.selectedImage.value = await controller.imagePicker.pickImage( controller.selectedImage.value = await controller
source: ImageSource.camera, .imagePicker
imageQuality: 60, .pickImage(
maxWidth: 1080, source: ImageSource.camera,
maxHeight: 720, imageQuality: 60,
); maxWidth: 1080,
maxHeight: 720,
);
}, },
), ),
], ],
@@ -568,7 +627,9 @@ class ProfilePage extends GetView<ProfileLogic> {
children: [ children: [
Text( Text(
'تغییر رمز عبور', 'تغییر رمز عبور',
style: AppFonts.yekan16Bold.copyWith(color: AppColor.darkGreyDarkHover), style: AppFonts.yekan16Bold.copyWith(
color: AppColor.darkGreyDarkHover,
),
), ),
SizedBox(), SizedBox(),
RTextField( RTextField(
@@ -664,7 +725,10 @@ class ProfilePage extends GetView<ProfileLogic> {
child: Column( child: Column(
spacing: 8, spacing: 8,
children: [ children: [
Text('خروج', style: AppFonts.yekan16Bold.copyWith(color: AppColor.error)), Text(
'خروج',
style: AppFonts.yekan16Bold.copyWith(color: AppColor.error),
),
SizedBox(), SizedBox(),
Text( Text(
'آیا مطمئن هستید که می‌خواهید از حساب کاربری خود خارج شوید؟', 'آیا مطمئن هستید که می‌خواهید از حساب کاربری خود خارج شوید؟',
@@ -687,7 +751,10 @@ class ProfilePage extends GetView<ProfileLogic> {
.deleteModuleTokens(Module.liveStocks) .deleteModuleTokens(Module.liveStocks)
.then((value) { .then((value) {
Get.back(); Get.back();
Get.offAllNamed(LiveStockRoutes.auth, arguments: Module.chicken); Get.offAllNamed(
AuthLiveStockRoutes.auth,
arguments: Module.liveStocks,
);
}); });
}, },
), ),

View File

@@ -1,19 +1,4 @@
import 'package:rasadyar_core/core.dart' hide BaseLogic; import 'package:rasadyar_livestock/features/auth/presentation/routes/pages.dart';
import 'package:rasadyar_livestock/presentation/page/auth/logic.dart';
import 'package:rasadyar_livestock/presentation/page/auth/view.dart';
import 'package:rasadyar_livestock/presentation/page/map/logic.dart';
import 'package:rasadyar_livestock/presentation/page/map/widget/map_widget/logic.dart';
import 'package:rasadyar_livestock/presentation/page/profile/logic.dart';
import 'package:rasadyar_livestock/presentation/page/request_tagging/logic.dart';
import 'package:rasadyar_livestock/presentation/page/request_tagging/view.dart';
import 'package:rasadyar_livestock/presentation/page/requests/logic.dart';
import 'package:rasadyar_livestock/presentation/page/root/logic.dart';
import 'package:rasadyar_livestock/presentation/page/root/view.dart';
import 'package:rasadyar_livestock/presentation/page/tagging/logic.dart';
import 'package:rasadyar_livestock/presentation/page/tagging/view.dart';
import 'package:rasadyar_livestock/presentation/widgets/base_page/logic.dart';
import 'package:rasadyar_livestock/presentation/widgets/captcha/logic.dart';
part 'app_routes.dart'; part 'app_routes.dart';
@@ -21,7 +6,13 @@ sealed class LiveStockPages {
LiveStockPages._(); LiveStockPages._();
static final pages = [ static final pages = [
GetPage(
//region Auth Pages
...AuthLiveStockPages.pages,
//endregion
/* GetPage(
name: LiveStockRoutes.auth, name: LiveStockRoutes.auth,
page: () => AuthPage(), page: () => AuthPage(),
binding: BindingsBuilder(() { binding: BindingsBuilder(() {
@@ -67,6 +58,6 @@ sealed class LiveStockPages {
binding: BindingsBuilder(() { binding: BindingsBuilder(() {
Get.lazyPut(() => TaggingLogic()); Get.lazyPut(() => TaggingLogic());
}), }),
), ), */
]; ];
} }

View File

@@ -3,7 +3,8 @@ part of 'app_pages.dart';
sealed class LiveStockRoutes { sealed class LiveStockRoutes {
LiveStockRoutes._(); LiveStockRoutes._();
static const auth = '/AuthLiveStock'; static const auth = AuthLiveStockRoutes.auth;
static const init = '/liveStock'; static const init = '/liveStock';
static const requests = '/requests'; static const requests = '/requests';
static const map = '/map'; static const map = '/map';

View File

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