From 60c58ef17e334126eb7173e77034a4e396320c9f Mon Sep 17 00:00:00 2001 From: "mr.mojtaba" Date: Wed, 24 Dec 2025 11:51:41 +0330 Subject: [PATCH] chore: clean up unused imports, update routing for authentication pages, and enhance UI components in the profile and captcha widgets --- assets/icons/dam_pattern.svg | 68 +++ assets/vec/bg_auth_dam.svg.vec | Bin 0 -> 640 bytes assets/vec/dam_pattern.svg.vec | Bin 0 -> 632 bytes .../submit_inspection_response_schema.json | 4 + packages/core/lib/core.dart | 4 +- .../lib/presentation/common/assets.gen.dart | 16 + .../presentation/widget/inputs/r_input.dart | 37 +- packages/core/pubspec.lock | 114 +--- packages/core/pubspec.yaml | 5 +- .../auth/presentation/pages/view.dart | 502 +++++------------- .../auth/presentation/routes/pages.dart | 63 +-- .../auth/presentation/routes/routes.dart | 13 +- .../lib/injection/live_stock_di.dart | 15 +- .../lib/presentation/page/profile/view.dart | 133 +++-- .../lib/presentation/routes/app_pages.dart | 27 +- .../lib/presentation/routes/app_routes.dart | 3 +- .../presentation/widgets/captcha/view.dart | 49 +- 17 files changed, 428 insertions(+), 625 deletions(-) create mode 100644 assets/icons/dam_pattern.svg create mode 100644 assets/vec/bg_auth_dam.svg.vec create mode 100644 assets/vec/dam_pattern.svg.vec diff --git a/assets/icons/dam_pattern.svg b/assets/icons/dam_pattern.svg new file mode 100644 index 0000000..8f7ca71 --- /dev/null +++ b/assets/icons/dam_pattern.svg @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/vec/bg_auth_dam.svg.vec b/assets/vec/bg_auth_dam.svg.vec new file mode 100644 index 0000000000000000000000000000000000000000..fcfe36bc36b20258b560212e5f9de7bf11eff162 GIT binary patch literal 640 zcmYe&?Okcn*%AT~*nTdg+r>EyX2mqN-&|uG? z&d9(XeaNv?@&Cc3e_NfIzgf6|s;lr&bh(%q4T<_ zGo3w`-gJID+r{~G%u(mKs%cKub8mp%2(nk2k%@sFWI50)Kv#)?m>@GvH}itcgzyoh zBDUEN#x`Qd)f9 zd0BKW(7m&qn;EVg*FX-$|NkFGF#;nH P$YTP=9*|;YUkcn*%AT~*nTdg+r>EyX2mqN-&|uG? z&d9(XeaNv?@&Cc3e_NfIzgf6|{k0Teos z?nl9))Z=@?`Tl`qm%V1EokR4KfcnlkOZFsy={%ml&J92JJE!%&b*}PQ=iFfX(0Sd| zna-X|Z#uu7?c#ho=BRUA)ikH-xi`RW1lcRi$i%=7vK;6YpsPecOpuwTn|Z-zLih+$ zkzLMZ-nMBDleWsa*jY+Au8xs+*)cWEQR|Pqi-QfH^FuoWmrblwo#*UP2kQr!BhARn zzy>k`Xaf_o7~HTsOPzsg7#PlmH#^x#A9Z?~804h9-_7~y@A*zK`#YR#?~6KLG&<)T zaJSp}VAfgZUwwa_n;F`jiwjg-va6k)x#KKc{+v4K#PH4uY!1jg138e1|Np}%MqtDN Pc}&1q15(Tk%s>hNoCUh% literal 0 HcmV?d00001 diff --git a/packages/chicken/lib/features/poultry_science/data/model/request/submit_inspection/submit_inspection_response_schema.json b/packages/chicken/lib/features/poultry_science/data/model/request/submit_inspection/submit_inspection_response_schema.json index 270c9a8..22034ac 100644 --- a/packages/chicken/lib/features/poultry_science/data/model/request/submit_inspection/submit_inspection_response_schema.json +++ b/packages/chicken/lib/features/poultry_science/data/model/request/submit_inspection/submit_inspection_response_schema.json @@ -431,3 +431,7 @@ + + + + diff --git a/packages/core/lib/core.dart b/packages/core/lib/core.dart index b071a46..f7a61ff 100644 --- a/packages/core/lib/core.dart +++ b/packages/core/lib/core.dart @@ -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_tile_caching/flutter_map_tile_caching.dart' hide DownloadProgress; 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_secure_storage/flutter_secure_storage.dart'; export 'package:flutter_slidable/flutter_slidable.dart'; @@ -36,8 +35,7 @@ export 'package:image_cropper/image_cropper.dart'; ///image picker export 'package:image_picker/image_picker.dart'; -//encryption -//export 'package:encrypt/encrypt.dart' show Encrypted; + //Map and location export 'package:latlong2/latlong.dart'; diff --git a/packages/core/lib/presentation/common/assets.gen.dart b/packages/core/lib/presentation/common/assets.gen.dart index 1108d38..abe9e58 100644 --- a/packages/core/lib/presentation/common/assets.gen.dart +++ b/packages/core/lib/presentation/common/assets.gen.dart @@ -49,6 +49,9 @@ class $AssetsIconsGen { /// File path: 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 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 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 SvgGenImage get diagram => const SvgGenImage('assets/icons/diagram.svg'); @@ -396,6 +402,7 @@ class $AssetsIconsGen { arrowLeft, arrowRight, bgAuth, + bgAuthDam, bgHeaderUserProfile, boxRemove, boxTick, @@ -434,6 +441,7 @@ class $AssetsIconsGen { cubeSearch, cubeTopRotation, cubeWatting, + damPattern, diagram, directPurchase, download, @@ -568,6 +576,9 @@ class $AssetsVecGen { /// File path: 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 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 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 SvgGenImage get diagramSvg => const SvgGenImage.vec('assets/vec/diagram.svg.vec'); @@ -915,6 +929,7 @@ class $AssetsVecGen { arrowLeftSvg, arrowRightSvg, bgAuthSvg, + bgAuthDamSvg, bgHeaderUserProfileSvg, boxRemoveSvg, boxTickSvg, @@ -953,6 +968,7 @@ class $AssetsVecGen { cubeSearchSvg, cubeTopRotationSvg, cubeWattingSvg, + damPatternSvg, diagramSvg, directPurchaseSvg, downloadSvg, diff --git a/packages/core/lib/presentation/widget/inputs/r_input.dart b/packages/core/lib/presentation/widget/inputs/r_input.dart index af0d2f1..1aa6a81 100644 --- a/packages/core/lib/presentation/widget/inputs/r_input.dart +++ b/packages/core/lib/presentation/widget/inputs/r_input.dart @@ -132,6 +132,8 @@ class _RTextFieldState extends State { late TextDirection textDirection; Timer? _debounceTimer; + final GlobalKey> _formFieldKey = + GlobalKey>(); TextDirection _detectDirection(String text) { final isPersian = RegExp(r'[\u0600-\u06FF]').hasMatch(text); @@ -196,13 +198,29 @@ class _RTextFieldState extends State { 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 Widget build(BuildContext context) { return SizedBox( - height: (widget.height).h, + height: _calculateHeight().h, child: Padding( padding: widget.padding ?? EdgeInsets.zero, child: TextFormField( + key: _formFieldKey, textAlignVertical: TextAlignVertical.center, controller: widget.controller, focusNode: widget.focusNode, @@ -210,8 +228,21 @@ class _RTextFieldState extends State { readOnly: widget.readonly, minLines: widget.minLines, maxLines: widget.maxLines, - onChanged: widget.onChanged, - validator: widget.validator, + onChanged: (value) { + 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, enabled: widget.enabled, obscureText: obscure, diff --git a/packages/core/pubspec.lock b/packages/core/pubspec.lock index 2b06e71..470f692 100644 --- a/packages/core/pubspec.lock +++ b/packages/core/pubspec.lock @@ -49,14 +49,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.7.0" - asn1lib: - dependency: transitive - description: - name: asn1lib - sha256: "9a8f69025044eb466b9b60ef3bc3ac99b4dc6c158ae9c56d25eeccf5bc56d024" - url: "https://pub.dev" - source: hosted - version: "1.6.5" async: dependency: transitive description: @@ -337,14 +329,6 @@ packages: url: "https://pub.dev" source: hosted 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: dependency: "direct main" description: @@ -361,14 +345,6 @@ packages: url: "https://pub.dev" source: hosted 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: dependency: "direct main" description: @@ -385,14 +361,6 @@ packages: url: "https://pub.dev" source: hosted 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: dependency: transitive description: @@ -1309,14 +1277,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" - pointycastle: - dependency: transitive - description: - name: pointycastle - sha256: "4be0097fcf3fd3e8449e53730c631200ebc7b88016acecab2b0da2f0149222fe" - url: "https://pub.dev" - source: hosted - version: "3.9.1" pool: dependency: transitive description: @@ -1373,22 +1333,6 @@ packages: url: "https://pub.dev" source: hosted 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: dependency: "direct main" description: @@ -1405,62 +1349,6 @@ packages: url: "https://pub.dev" source: hosted 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: dependency: transitive description: @@ -1836,4 +1724,4 @@ packages: version: "2.1.0" sdks: dart: ">=3.10.0 <4.0.0" - flutter: ">=3.35.7" + flutter: ">=3.35.0" diff --git a/packages/core/pubspec.yaml b/packages/core/pubspec.yaml index 40a9c26..10814da 100644 --- a/packages/core/pubspec.yaml +++ b/packages/core/pubspec.yaml @@ -44,7 +44,7 @@ dependencies: #SVG flutter_svg: ^2.2.1 cached_network_image: ^3.4.1 - rive: ^0.13.20 + #Shimmer shimmer: ^3.0.0 @@ -61,9 +61,8 @@ dependencies: #other permission_handler: ^12.0.1 persian_datetime_picker: ^3.2.0 - encrypt: ^5.0.3 collection: ^1.19.1 - device_preview_plus: ^2.5.1 + #L10N tools intl: ^0.20.2 diff --git a/packages/livestock/lib/features/auth/presentation/pages/view.dart b/packages/livestock/lib/features/auth/presentation/pages/view.dart index b17a41b..636a3da 100644 --- a/packages/livestock/lib/features/auth/presentation/pages/view.dart +++ b/packages/livestock/lib/features/auth/presentation/pages/view.dart @@ -11,98 +11,105 @@ class AuthPage extends GetView { @override Widget build(BuildContext context) { return Scaffold( - body:PopScope( - canPop: false, - onPopInvokedWithResult: (didPop, result) { - Get.back(result: -1); - }, - child: Stack( - alignment: Alignment.center, - fit: StackFit.expand, - children: [ - Assets.vec.bgAuthSvg.svg(fit: BoxFit.fill), + body: PopScope( + canPop: false, + onPopInvokedWithResult: (didPop, result) { + Get.back(result: -1); + }, + child: Stack( + alignment: Alignment.center, + fit: StackFit.expand, + children: [ + Assets.icons.bgAuthDam.svg(fit: BoxFit.fill), - Center( - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 10.r), - child: FadeTransition( - opacity: controller.textAnimation, - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - spacing: 12, - children: [ - Text( - 'به سامانه رصدیار خوش آمدید!', - textAlign: TextAlign.right, - style: AppFonts.yekan25Bold.copyWith(color: Colors.white), - ), - Text( - 'سامانه رصد و پایش زنجیره تامین، تولید و توزیع کالا های اساسی', - textAlign: TextAlign.center, - style: AppFonts.yekan16.copyWith(color: Colors.white), - ), - ], + Center( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 10.r), + child: FadeTransition( + opacity: controller.textAnimation, + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + spacing: 12, + children: [ + Text( + 'به سامانه رصدیار خوش آمدید!', + textAlign: TextAlign.right, + style: AppFonts.yekan25Bold.copyWith( + color: Colors.white, + ), + ), + Text( + 'سامانه رصد و پایش زنجیره تامین، تولید و توزیع کالا های اساسی', + textAlign: TextAlign.center, + style: AppFonts.yekan16.copyWith(color: Colors.white), + ), + ], + ), ), ), ), - ), - Obx(() { - final screenHeight = MediaQuery.of(context).size.height; - final targetTop = (screenHeight - 676) / 2; + Obx(() { + final screenHeight = MediaQuery.of(context).size.height; + final targetTop = (screenHeight - 676) / 2; - return AnimatedPositioned( - duration: const Duration(milliseconds: 1200), - curve: Curves.linear, - top: controller.showCard.value ? targetTop : screenHeight, - left: 10.r, - right: 10.r, - child: Container( - width: 381.w, - height: 676.h, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(40), - ), - child: Column( - children: [ - SizedBox(height: 50.h), - LogoWidget(), - SizedBox(height: 20.h), - useAndPassFrom(), - SizedBox(height: 24.h), - RichText( - text: TextSpan( - children: [ - TextSpan( - text: 'مطالعه بیانیه ', - style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDark), - ), - TextSpan( - recognizer: TapGestureRecognizer() - ..onTap = () { - Get.bottomSheet( - privacyPolicyWidget(), - isScrollControlled: true, - enableDrag: true, - ignoreSafeArea: false, - ); - }, - text: 'حریم خصوصی', - style: AppFonts.yekan16.copyWith(color: AppColor.blueNormal), - ), - ], + return AnimatedPositioned( + duration: const Duration(milliseconds: 1200), + curve: Curves.linear, + top: controller.showCard.value ? targetTop : screenHeight, + left: 10.r, + right: 10.r, + child: Container( + width: 381.w, + height: 676.h, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(40), + ), + child: Column( + children: [ + SizedBox(height: 50.h), + LogoWidget(), + SizedBox(height: 20.h), + useAndPassFrom(), + SizedBox(height: 24.h), + RichText( + text: TextSpan( + children: [ + TextSpan( + text: 'مطالعه بیانیه ', + style: AppFonts.yekan16.copyWith( + color: AppColor.darkGreyDark, + ), + ), + TextSpan( + recognizer: TapGestureRecognizer() + ..onTap = () { + Get.bottomSheet( + privacyPolicyWidget(), + isScrollControlled: true, + enableDrag: true, + ignoreSafeArea: false, + ); + }, + text: 'حریم خصوصی', + style: AppFonts.yekan16.copyWith( + color: AppColor.blueNormal, + ), + ), + ], + ), ), - ), - ], + ], + ), ), - ), - ); - }), - ], - )), + ); + }), + ], + ), + ), ); } @@ -115,17 +122,15 @@ class AuthPage extends GetView { child: Column( children: [ RTextField( + height: 48.h, + isFullHeight: true, label: 'نام کاربری', maxLength: 11, maxLines: 1, controller: controller.usernameController.value, - keyboardType: TextInputType.number, initText: controller.usernameController.value.text, autofillHints: [AutofillHints.username], - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(8), - borderSide: BorderSide(color: AppColor.textColor, width: 1), - ), + borderColor: AppColor.textColor, onChanged: (value) async { controller.usernameController.value.text = value; controller.usernameController.refresh(); @@ -134,14 +139,15 @@ class AuthPage extends GetView { padding: const EdgeInsets.fromLTRB(0, 8, 6, 8), child: Assets.vec.callSvg.svg(width: 12, height: 12), ), - suffixIcon: controller.usernameController.value.text.trim().isNotEmpty + suffixIcon: + controller.usernameController.value.text.trim().isNotEmpty ? clearButton(() { controller.usernameController.value.clear(); controller.usernameController.refresh(); }) : null, validator: (value) { - /* if (value == null || value.isEmpty) { + /* if (value == null || value.isEmpty) { return '⚠️ شماره موبایل را وارد کنید'; } else if (value.length < 10) { return '⚠️ شماره موبایل باید 11 رقم باشد'; @@ -149,25 +155,20 @@ class AuthPage extends GetView { return null; }, style: AppFonts.yekan13, - errorStyle: AppFonts.yekan13.copyWith(color: AppColor.redNormal), - labelStyle: AppFonts.yekan13, - boxConstraints: const BoxConstraints( - maxHeight: 40, - minHeight: 40, - maxWidth: 40, - minWidth: 40, + errorStyle: AppFonts.yekan13.copyWith( + color: AppColor.redNormal, ), + labelStyle: AppFonts.yekan13, ), - const SizedBox(height: 26), + SizedBox(height: 16.h), ObxValue( (passwordController) => RTextField( + height: 48.h, + isFullHeight: true, label: 'رمز عبور', filled: false, obscure: true, - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(8), - borderSide: BorderSide(color: AppColor.textColor, width: 1), - ), + borderColor: AppColor.textColor, controller: passwordController.value, autofillHints: [AutofillHints.password], variant: RTextFieldVariant.password, @@ -182,18 +183,10 @@ class AuthPage extends GetView { return null; }, style: AppFonts.yekan13, - errorStyle: AppFonts.yekan13.copyWith(color: AppColor.redNormal), + errorStyle: AppFonts.yekan13.copyWith( + color: AppColor.redNormal, + ), 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, ), @@ -208,36 +201,44 @@ class AuthPage extends GetView { ObxValue((data) { return Checkbox( materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - visualDensity: VisualDensity(horizontal: -4, vertical: 4), + visualDensity: VisualDensity( + horizontal: -4, + vertical: 4, + ), tristate: true, value: data.value, onChanged: (value) { data.value = value ?? false; }, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(4)), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(4), + ), activeColor: AppColor.blueNormal, ); }, controller.rememberMe), Text( 'مرا به خاطر بسپار', - style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark), + style: AppFonts.yekan14.copyWith( + color: AppColor.darkGreyDark, + ), ), ], ), ), - Obx(() { return RElevated( text: 'ورود', + backgroundColor: AppColor.blueNormal, isLoading: controller.isLoading.value, onPressed: controller.isDisabled.value ? null : () async { await controller.submitLoginForm(); }, + width: Get.width, - height: 48, + height: 48.h, ); }), ], @@ -266,11 +267,16 @@ class AuthPage extends GetView { children: [ Text( 'بيانيه حريم خصوصی', - style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal), + style: AppFonts.yekan16Bold.copyWith( + color: AppColor.blueNormal, + ), ), 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 { children: [ Text( 'چگونگی جمع آوری و استفاده از اطلاعات کاربران', - style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal), + style: AppFonts.yekan16Bold.copyWith( + color: AppColor.blueNormal, + ), ), Text( '''الف: اطلاعاتی که شما خود در اختيار این سامانه قرار می‌دهيد، شامل موارد زيرهستند: @@ -302,7 +310,10 @@ class AuthPage extends GetView { ⦁ تعداد بازدیدهای روزانه در درگاه. ⦁ هدف ما از دریافت این اطلاعات استفاده از آنها در تحلیل عملکرد کاربران درگاه می باشد تا بتوانیم در خدمت رسانی بهتر عمل کنیم. ''', - 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 { children: [ Text( 'امنیت اطلاعات', - style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal), + style: AppFonts.yekan16Bold.copyWith( + color: AppColor.blueNormal, + ), ), 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 { ), ); } - - /* - 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); - }*/ } diff --git a/packages/livestock/lib/features/auth/presentation/routes/pages.dart b/packages/livestock/lib/features/auth/presentation/routes/pages.dart index bb937a2..2146e8f 100644 --- a/packages/livestock/lib/features/auth/presentation/routes/pages.dart +++ b/packages/livestock/lib/features/auth/presentation/routes/pages.dart @@ -1,72 +1,21 @@ import 'package:rasadyar_core/core.dart' hide BaseLogic; -import 'package:rasadyar_livestock/features/common/auth/presentation/pages/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/features/auth/presentation/pages/logic.dart'; +import 'package:rasadyar_livestock/features/auth/presentation/pages/view.dart'; import 'package:rasadyar_livestock/presentation/widgets/captcha/logic.dart'; +part 'routes.dart'; -part 'app_routes.dart'; - -sealed class LiveStockPages { - LiveStockPages._(); +sealed class AuthLiveStockPages { + AuthLiveStockPages._(); static final pages = [ GetPage( - name: LiveStockRoutes.auth, + name: AuthLiveStockRoutes.auth, page: () => AuthPage(), binding: BindingsBuilder(() { Get.lazyPut(() => AuthLogic()); 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()); - }), - ), ]; } diff --git a/packages/livestock/lib/features/auth/presentation/routes/routes.dart b/packages/livestock/lib/features/auth/presentation/routes/routes.dart index 823279b..fb09eea 100644 --- a/packages/livestock/lib/features/auth/presentation/routes/routes.dart +++ b/packages/livestock/lib/features/auth/presentation/routes/routes.dart @@ -1,13 +1,8 @@ -part of 'app_pages.dart'; +part of 'pages.dart'; -sealed class LiveStockRoutes { - LiveStockRoutes._(); +sealed class AuthLiveStockRoutes { + AuthLiveStockRoutes._(); 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'; + } diff --git a/packages/livestock/lib/injection/live_stock_di.dart b/packages/livestock/lib/injection/live_stock_di.dart index 16230be..fa190aa 100644 --- a/packages/livestock/lib/injection/live_stock_di.dart +++ b/packages/livestock/lib/injection/live_stock_di.dart @@ -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_imp.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/presentation/routes/app_pages.dart'; @@ -25,7 +26,10 @@ Future setupLiveStockDI() async { Get.lazyPut(() => LiveStockStorageService()); 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 @@ -48,7 +52,7 @@ Future setupLiveStockDI() async { }, clearTokenCallback: () async { await tokenService.deleteModuleTokens(Module.liveStocks); - Get.offAllNamed(LiveStockRoutes.auth, arguments: Module.liveStocks); + Get.offAllNamed(AuthLiveStockRoutes.auth, arguments: Module.liveStocks); }, authArguments: Module.liveStocks, ), @@ -73,7 +77,8 @@ Future setupLiveStockDI() async { ); diLiveStock.registerLazySingleton( - () => AuthRepositoryImp(authRemote: diLiveStock.get()), + () => + AuthRepositoryImp(authRemote: diLiveStock.get()), ); //endregion @@ -82,7 +87,9 @@ Future setupLiveStockDI() async { () => LivestockRemoteDataSourceImp(), ); - diLiveStock.registerLazySingleton(() => TmpLocalDataSource()); + diLiveStock.registerLazySingleton( + () => TmpLocalDataSource(), + ); diLiveStock.registerLazySingleton( () => LivestockRepositoryImp( diff --git a/packages/livestock/lib/presentation/page/profile/view.dart b/packages/livestock/lib/presentation/page/profile/view.dart index ee0dd10..acefc0e 100644 --- a/packages/livestock/lib/presentation/page/profile/view.dart +++ b/packages/livestock/lib/presentation/page/profile/view.dart @@ -2,6 +2,7 @@ import 'dart:io'; import 'package:flutter/material.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 'logic.dart'; @@ -84,7 +85,10 @@ class ProfilePage extends GetView { children: [ Expanded( child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 10), + padding: const EdgeInsets.symmetric( + horizontal: 30, + vertical: 10, + ), child: userProfileInformation(), ), ), @@ -99,18 +103,27 @@ class ProfilePage extends GetView { title: 'تغییر رمز عبور', selected: true, onPressed: () { - Get.bottomSheet(changePasswordBottomSheet(), isScrollControlled: true); + Get.bottomSheet( + changePasswordBottomSheet(), + isScrollControlled: true, + ); }, icon: Assets.vec.lockSvg.path, ), cardActionWidget( title: 'خروج', selected: true, - color: ColorFilter.mode(Colors.redAccent, BlendMode.srcIn), + color: ColorFilter.mode( + Colors.redAccent, + BlendMode.srcIn, + ), cardColor: Color(0xFFEFEFEF), textColor: AppColor.redDarkerText, onPressed: () { - Get.bottomSheet(exitBottomSheet(), isScrollControlled: true); + Get.bottomSheet( + exitBottomSheet(), + isScrollControlled: true, + ); }, icon: Assets.vec.logoutSvg.path, ), @@ -157,7 +170,9 @@ class ProfilePage extends GetView { children: [ 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), ], @@ -199,7 +214,11 @@ class ProfilePage extends GetView { content: /*item.province ??*/ 'نامشخص', 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) { @@ -300,12 +319,25 @@ class ProfilePage extends GetView { child: SvgGenImage.vec(icon).svg( width: 20.w, 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(), - 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 { padding: EdgeInsets.all(8), decoration: ShapeDecoration( color: cardColor ?? AppColor.blueLight, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), ), child: SvgGenImage.vec(icon).svg( width: 40, @@ -347,7 +381,9 @@ class ProfilePage extends GetView { Text( title, style: AppFonts.yekan10.copyWith( - color: textColor ?? (selected ? AppColor.blueNormal : AppColor.blueLightActive), + color: + textColor ?? + (selected ? AppColor.blueNormal : AppColor.blueLightActive), ), textAlign: TextAlign.center, ), @@ -365,7 +401,9 @@ class ProfilePage extends GetView { children: [ Text( 'ویرایش اطلاعات هویتی', - style: AppFonts.yekan16Bold.copyWith(color: AppColor.darkGreyDarkHover), + style: AppFonts.yekan16Bold.copyWith( + color: AppColor.darkGreyDarkHover, + ), ), Container( @@ -437,7 +475,9 @@ class ProfilePage extends GetView { children: [ Text( 'عکس پروفایل', - style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal), + style: AppFonts.yekan16Bold.copyWith( + color: AppColor.blueNormal, + ), ), ObxValue((data) { return Container( @@ -446,15 +486,26 @@ class ProfilePage extends GetView { decoration: BoxDecoration( color: AppColor.lightGreyNormal, borderRadius: BorderRadius.circular(8), - border: Border.all(width: 1, color: AppColor.blackLight), + border: Border.all( + width: 1, + color: AppColor.blackLight, + ), ), child: Center( child: data.value == null ? Padding( - padding: const EdgeInsets.fromLTRB(30, 10, 10, 30), + padding: const EdgeInsets.fromLTRB( + 30, + 10, + 10, + 30, + ), child: Image.network(''), ) - : Image.file(File(data.value!.path), fit: BoxFit.cover), + : Image.file( + File(data.value!.path), + fit: BoxFit.cover, + ), ), ); }, controller.selectedImage), @@ -467,14 +518,18 @@ class ProfilePage extends GetView { text: 'گالری', width: 150.w, height: 40.h, - textStyle: AppFonts.yekan20.copyWith(color: Colors.white), + textStyle: AppFonts.yekan20.copyWith( + color: Colors.white, + ), onPressed: () async { - controller.selectedImage.value = await controller.imagePicker.pickImage( - source: ImageSource.gallery, - imageQuality: 60, - maxWidth: 1080, - maxHeight: 720, - ); + controller.selectedImage.value = await controller + .imagePicker + .pickImage( + source: ImageSource.gallery, + imageQuality: 60, + maxWidth: 1080, + maxHeight: 720, + ); }, ), SizedBox(width: 16), @@ -482,14 +537,18 @@ class ProfilePage extends GetView { text: 'دوربین', width: 150.w, height: 40.h, - textStyle: AppFonts.yekan20.copyWith(color: AppColor.blueNormal), + textStyle: AppFonts.yekan20.copyWith( + color: AppColor.blueNormal, + ), onPressed: () async { - controller.selectedImage.value = await controller.imagePicker.pickImage( - source: ImageSource.camera, - imageQuality: 60, - maxWidth: 1080, - maxHeight: 720, - ); + controller.selectedImage.value = await controller + .imagePicker + .pickImage( + source: ImageSource.camera, + imageQuality: 60, + maxWidth: 1080, + maxHeight: 720, + ); }, ), ], @@ -568,7 +627,9 @@ class ProfilePage extends GetView { children: [ Text( 'تغییر رمز عبور', - style: AppFonts.yekan16Bold.copyWith(color: AppColor.darkGreyDarkHover), + style: AppFonts.yekan16Bold.copyWith( + color: AppColor.darkGreyDarkHover, + ), ), SizedBox(), RTextField( @@ -664,7 +725,10 @@ class ProfilePage extends GetView { child: Column( spacing: 8, children: [ - Text('خروج', style: AppFonts.yekan16Bold.copyWith(color: AppColor.error)), + Text( + 'خروج', + style: AppFonts.yekan16Bold.copyWith(color: AppColor.error), + ), SizedBox(), Text( 'آیا مطمئن هستید که می‌خواهید از حساب کاربری خود خارج شوید؟', @@ -687,7 +751,10 @@ class ProfilePage extends GetView { .deleteModuleTokens(Module.liveStocks) .then((value) { Get.back(); - Get.offAllNamed(LiveStockRoutes.auth, arguments: Module.chicken); + Get.offAllNamed( + AuthLiveStockRoutes.auth, + arguments: Module.liveStocks, + ); }); }, ), diff --git a/packages/livestock/lib/presentation/routes/app_pages.dart b/packages/livestock/lib/presentation/routes/app_pages.dart index 7050ae6..738a0d3 100644 --- a/packages/livestock/lib/presentation/routes/app_pages.dart +++ b/packages/livestock/lib/presentation/routes/app_pages.dart @@ -1,19 +1,4 @@ -import 'package:rasadyar_core/core.dart' hide BaseLogic; -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'; - +import 'package:rasadyar_livestock/features/auth/presentation/routes/pages.dart'; part 'app_routes.dart'; @@ -21,7 +6,13 @@ sealed class LiveStockPages { LiveStockPages._(); static final pages = [ - GetPage( + + //region Auth Pages + ...AuthLiveStockPages.pages, + //endregion + + + /* GetPage( name: LiveStockRoutes.auth, page: () => AuthPage(), binding: BindingsBuilder(() { @@ -67,6 +58,6 @@ sealed class LiveStockPages { binding: BindingsBuilder(() { Get.lazyPut(() => TaggingLogic()); }), - ), + ), */ ]; } diff --git a/packages/livestock/lib/presentation/routes/app_routes.dart b/packages/livestock/lib/presentation/routes/app_routes.dart index 823279b..251a0db 100644 --- a/packages/livestock/lib/presentation/routes/app_routes.dart +++ b/packages/livestock/lib/presentation/routes/app_routes.dart @@ -3,7 +3,8 @@ part of 'app_pages.dart'; sealed class LiveStockRoutes { LiveStockRoutes._(); - static const auth = '/AuthLiveStock'; + static const auth = AuthLiveStockRoutes.auth; + static const init = '/liveStock'; static const requests = '/requests'; static const map = '/map'; diff --git a/packages/livestock/lib/presentation/widgets/captcha/view.dart b/packages/livestock/lib/presentation/widgets/captcha/view.dart index fbc98f1..5784882 100644 --- a/packages/livestock/lib/presentation/widgets/captcha/view.dart +++ b/packages/livestock/lib/presentation/widgets/captcha/view.dart @@ -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 { @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 { 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 { return null; }, onChanged: (pass) { - if (pass.length == 6) { - if (controller.formKey.currentState?.validate() ?? false) { - Get.find().isDisabled.value = false; - } + if (controller.formKey.currentState?.validate() ?? false) { + Get.find().isDisabled.value = false; } }, style: AppFonts.yekan13,