Merge branch with resolved conflicts - restructured features and added new modules
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
import 'package:rasadyar_chicken/features/common/profile/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/common/presentation/page/profile/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/base_page/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class GlobalBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut(() => BaseLogic(), fenix: true);
|
||||
// Register ChickenBaseLogic and also as BasePageLogic/BaseLogic for compatibility
|
||||
// Since ChickenBaseLogic extends BasePageLogic, we can use the same instance
|
||||
Get.lazyPut<ChickenBaseLogic>(() => ChickenBaseLogic(), fenix: true);
|
||||
// Register the same instance as BasePageLogic/BaseLogic
|
||||
Get.lazyPut<BasePageLogic>(() => Get.find<ChickenBaseLogic>(), fenix: true);
|
||||
Get.lazyPut(() => ProfileLogic(), fenix: true);
|
||||
|
||||
//root logics
|
||||
|
||||
@@ -1,237 +1,69 @@
|
||||
import 'package:rasadyar_chicken/features/common/auth/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/common/auth/view.dart';
|
||||
import 'package:rasadyar_chicken/features/common/role/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/common/role/view.dart';
|
||||
import 'package:rasadyar_chicken/features/common/common.dart';
|
||||
import 'package:rasadyar_chicken/features/kill_house/action/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/kill_house/action/view.dart';
|
||||
import 'package:rasadyar_chicken/features/kill_house/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/kill_house/root/view.dart';
|
||||
import 'package:rasadyar_chicken/features/kill_house/submit_request/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/kill_house/submit_request/view.dart';
|
||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/buy_in_province_entered/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_farm_inspection/poultry_farm_inspection.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/active_hatching/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/active_hatching/view.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/farm/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/farm/view.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/genocide/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/genocide/view.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/home/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/inspection/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/inspection/view.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/killing_registration/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/killing_registration/view.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/poultry_action/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/poultry_action/view.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/root/view.dart';
|
||||
import 'package:rasadyar_chicken/features/poultry_science/poultry_science.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/steward.dart';
|
||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/warehouse_and_distribution.dart'
|
||||
as warehouse;
|
||||
import 'package:rasadyar_chicken/features/province_operator/province_operator.dart';
|
||||
import 'package:rasadyar_chicken/features/province_inspector/province_inspector.dart';
|
||||
import 'package:rasadyar_chicken/features/city_jahad/city_jahad.dart';
|
||||
import 'package:rasadyar_chicken/features/vet_farm/vet_farm.dart';
|
||||
import 'package:rasadyar_chicken/features/super_admin/super_admin.dart';
|
||||
import 'package:rasadyar_chicken/features/province_supervisor/province_supervisor.dart';
|
||||
import 'package:rasadyar_chicken/features/jahad/jahad.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/global_binding.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/base_page/logic.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/captcha/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_chicken/features/kill_house/warehouse_and_distribution/warehouse_and_distribution.dart'
|
||||
as warehouse;
|
||||
|
||||
sealed class ChickenPages {
|
||||
ChickenPages._();
|
||||
|
||||
static final pages = [
|
||||
GetPage(
|
||||
name: ChickenRoutes.auth,
|
||||
page: () => AuthPage(),
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => AuthLogic());
|
||||
Get.lazyPut(() => CaptchaWidgetLogic());
|
||||
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
|
||||
}),
|
||||
),
|
||||
|
||||
GetPage(
|
||||
name: ChickenRoutes.role,
|
||||
page: () => RolePage(),
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => RoleLogic());
|
||||
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
|
||||
}),
|
||||
),
|
||||
//region Common Pages
|
||||
...CommonPages.pages,
|
||||
//endregion
|
||||
|
||||
//region Steward Pages
|
||||
GetPage(
|
||||
name: ChickenRoutes.initSteward,
|
||||
page: () => StewardRootPage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
bindings: [
|
||||
GlobalBinding(),
|
||||
BindingsBuilder(() {
|
||||
Get.lazyPut(() => ChickenBaseLogic(), fenix: true);
|
||||
Get.lazyPut(() => StewardRootLogic());
|
||||
Get.lazyPut(() => HomeLogic());
|
||||
Get.lazyPut(() => BuyLogic());
|
||||
Get.lazyPut(() => SaleLogic());
|
||||
Get.lazyPut(() => SegmentationLogic());
|
||||
}),
|
||||
],
|
||||
),
|
||||
|
||||
GetPage(
|
||||
name: ChickenRoutes.homeSteward,
|
||||
page: () => HomePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.put(HomeLogic());
|
||||
Get.lazyPut(() => ChickenBaseLogic());
|
||||
}),
|
||||
),
|
||||
|
||||
//sales
|
||||
GetPage(
|
||||
name: ChickenRoutes.saleSteward,
|
||||
page: () => SalePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => SaleLogic());
|
||||
Get.lazyPut(() => ChickenBaseLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceBuyersLogic());
|
||||
Get.lazyPut(() => StewardRootLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: ChickenRoutes.salesOutOfProvinceSteward,
|
||||
page: () => SalesOutOfProvincePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => SalesOutOfProvinceLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceBuyersLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceSalesListLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: ChickenRoutes.salesOutOfProvinceBuyerSteward,
|
||||
page: () => SalesOutOfProvinceBuyersPage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => SalesOutOfProvinceLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceBuyersLogic());
|
||||
Get.lazyPut(() => SalesOutOfProvinceSalesListLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: ChickenRoutes.salesInProvinceSteward,
|
||||
page: () => SalesInProvincePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => ChickenBaseLogic());
|
||||
Get.lazyPut(() => SalesInProvinceLogic());
|
||||
}),
|
||||
),
|
||||
|
||||
//buy
|
||||
GetPage(
|
||||
name: ChickenRoutes.buySteward,
|
||||
page: () => BuyPage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => ChickenBaseLogic());
|
||||
Get.lazyPut(() => BuyLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: ChickenRoutes.buysOutOfProvinceSteward,
|
||||
page: () => BuyOutOfProvincePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => ChickenBaseLogic());
|
||||
Get.lazyPut(() => BuyOutOfProvinceLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: ChickenRoutes.buysInProvinceSteward,
|
||||
page: () => BuyInProvincePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => ChickenBaseLogic());
|
||||
Get.lazyPut(() => BuyInProvinceLogic());
|
||||
Get.lazyPut(() => BuyInProvinceWaitingLogic());
|
||||
Get.lazyPut(() => BuyInProvinceAllLogic());
|
||||
}),
|
||||
),
|
||||
|
||||
...StewardPages.pages,
|
||||
//endregion
|
||||
|
||||
//region Poultry science Pages
|
||||
GetPage(
|
||||
name: ChickenRoutes.initPoultryScience,
|
||||
page: () => PoultryScienceRootPage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
bindings: [
|
||||
GlobalBinding(),
|
||||
BindingsBuilder(() {
|
||||
Get.lazyPut(() => PoultryScienceRootLogic());
|
||||
Get.lazyPut(() => PoultryScienceHomeLogic());
|
||||
Get.lazyPut(() => PoultryActionLogic());
|
||||
}),
|
||||
],
|
||||
),
|
||||
...PoultrySciencePages.pages,
|
||||
//endregion
|
||||
|
||||
GetPage(
|
||||
name: ChickenRoutes.inspectionPoultryScience,
|
||||
page: () => InspectionPoultrySciencePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => InspectionPoultryScienceLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: ChickenRoutes.actionPoultryScience,
|
||||
page: () => PoultryActionPage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => PoultryActionLogic());
|
||||
}),
|
||||
),
|
||||
//region Province Operator Pages
|
||||
...ProvinceOperatorPages.pages,
|
||||
//endregion
|
||||
|
||||
GetPage(
|
||||
name: ChickenRoutes.farmPoultryScience,
|
||||
page: () => FarmPage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => FarmLogic());
|
||||
Get.lazyPut(() => PoultryScienceHomeLogic());
|
||||
Get.lazyPut(() => PoultryScienceRootLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: ChickenRoutes.activeHatchingPoultryScience,
|
||||
page: () => ActiveHatchingPage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => ActiveHatchingLogic());
|
||||
Get.lazyPut(() => PoultryScienceRootLogic());
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: ChickenRoutes.genocidePoultryScience,
|
||||
page: () => GenocidePage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => GenocideLogic());
|
||||
Get.lazyPut(() => PoultryScienceRootLogic());
|
||||
Get.lazyPut(() => KillingRegistrationLogic(), fenix: true);
|
||||
}),
|
||||
),
|
||||
GetPage(
|
||||
name: ChickenRoutes.killingRegistrationPoultryScience,
|
||||
page: () => KillingRegistrationPage(),
|
||||
middlewares: [AuthMiddleware()],
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => KillingRegistrationLogic());
|
||||
Get.lazyPut(() => GenocideLogic());
|
||||
Get.lazyPut(() => PoultryScienceRootLogic());
|
||||
}),
|
||||
),
|
||||
//region Province Inspector Pages
|
||||
...ProvinceInspectorPages.pages,
|
||||
//endregion
|
||||
|
||||
//region City Jahad Pages
|
||||
...CityJahadPages.pages,
|
||||
//endregion
|
||||
|
||||
//region Vet Farm Pages
|
||||
...VetFarmPages.pages,
|
||||
//endregion
|
||||
|
||||
//region Super Admin Pages
|
||||
...SuperAdminPages.pages,
|
||||
//endregion
|
||||
|
||||
//region Province Supervisor Pages
|
||||
...ProvinceSupervisorPages.pages,
|
||||
//endregion
|
||||
|
||||
//region Jahad Pages
|
||||
...JahadPages.pages,
|
||||
//endregion
|
||||
|
||||
//region Poultry Farm Inspection
|
||||
|
||||
@@ -1,39 +1,14 @@
|
||||
import 'package:rasadyar_chicken/features/common/presentation/routes/routes.dart';
|
||||
|
||||
sealed class ChickenRoutes {
|
||||
ChickenRoutes._();
|
||||
|
||||
static const auth = '/AuthChicken';
|
||||
static const _base = '/chicken';
|
||||
static const role = '$_base/role';
|
||||
static const String profile = '$_base/profile';
|
||||
static const auth = CommonRoutes.auth;
|
||||
|
||||
//region Steward Routes
|
||||
static const _steward = '$_base/steward';
|
||||
static const initSteward = '$_steward/';
|
||||
static const homeSteward = '$_steward/home';
|
||||
static const buySteward = '$_steward/buy';
|
||||
static const saleSteward = '$_steward/sale';
|
||||
static const segmentationSteward = '$_steward/segmentation';
|
||||
|
||||
//buys
|
||||
static const buysOutOfProvinceSteward = '$buySteward/buyOutOfProvince';
|
||||
static const buysInProvinceSteward = '$buySteward/buyInProvince';
|
||||
|
||||
//sales
|
||||
static const salesInProvinceSteward = '$saleSteward/SalesInProvince';
|
||||
static const salesOutOfProvinceSteward = '$saleSteward/saleOutOfProvince';
|
||||
static const salesOutOfProvinceBuyerSteward = '$saleSteward/saleOutOfProvinceBuyer ';
|
||||
|
||||
//endregion
|
||||
|
||||
//region Poultry Science Routes
|
||||
static const _poultryScience = '$_base/poultryScience';
|
||||
static const initPoultryScience = '$_poultryScience/';
|
||||
static const actionPoultryScience = '$_poultryScience/action';
|
||||
static const inspectionPoultryScience = '$_poultryScience/inspection';
|
||||
static const farmPoultryScience = '$_poultryScience/farm';
|
||||
static const activeHatchingPoultryScience = '$_poultryScience/activeHatching';
|
||||
static const genocidePoultryScience = '$_poultryScience/genocidePoultryScience';
|
||||
static const killingRegistrationPoultryScience = '$genocidePoultryScience/KillingRegistration';
|
||||
|
||||
//endregion
|
||||
|
||||
|
||||
@@ -19,4 +19,44 @@ const int killHouseWarehouseAndDistributionSaleKey = 110;
|
||||
|
||||
|
||||
|
||||
//endregion
|
||||
|
||||
//region poultry science Keys
|
||||
const int poultryScienceActionKey = 109;
|
||||
|
||||
//endregion
|
||||
|
||||
//region province operator Keys
|
||||
const int provinceOperatorActionKey = 110;
|
||||
|
||||
//endregion
|
||||
|
||||
//region province inspector Keys
|
||||
const int provinceInspectorActionKey = 111;
|
||||
|
||||
//endregion
|
||||
|
||||
//region city jahad Keys
|
||||
const int cityJahadActionKey = 112;
|
||||
|
||||
//endregion
|
||||
|
||||
//region vet farm Keys
|
||||
const int vetFarmActionKey = 113;
|
||||
|
||||
//endregion
|
||||
|
||||
//region super admin Keys
|
||||
const int superAdminActionKey = 114;
|
||||
|
||||
//endregion
|
||||
|
||||
//region province supervisor Keys
|
||||
const int provinceSupervisorActionKey = 115;
|
||||
|
||||
//endregion
|
||||
|
||||
//region jahad Keys
|
||||
const int jahadActionKey = 116;
|
||||
|
||||
//endregion
|
||||
|
||||
@@ -1,19 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/features/common/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
const int timeDebounce = 1200;
|
||||
|
||||
void handleGeneric(DioException error, [void Function()? onError]) {
|
||||
Get.showSnackbar(_errorSnackBar('اعتبار توکن شما منقضی شده است لطفا دوباره وارد شوید'));
|
||||
Get.showSnackbar(
|
||||
_errorSnackBar('اعتبار توکن شما منقضی شده است لطفا دوباره وارد شوید'),
|
||||
);
|
||||
|
||||
Get.offAllNamed(ChickenRoutes.auth, arguments: Module.chicken);
|
||||
Get.offAllNamed(CommonRoutes.auth, arguments: Module.chicken);
|
||||
}
|
||||
|
||||
GetSnackBar _errorSnackBar(String message) {
|
||||
return GetSnackBar(
|
||||
titleText: Text('خطا', style: AppFonts.yekan14.copyWith(color: Colors.white)),
|
||||
messageText: Text(message, style: AppFonts.yekan12.copyWith(color: Colors.white)),
|
||||
titleText: Text(
|
||||
'خطا',
|
||||
style: AppFonts.yekan14.copyWith(color: Colors.white),
|
||||
),
|
||||
messageText: Text(
|
||||
message,
|
||||
style: AppFonts.yekan12.copyWith(color: Colors.white),
|
||||
),
|
||||
backgroundColor: AppColor.error,
|
||||
margin: EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
borderRadius: 12,
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
||||
import 'package:rasadyar_chicken/data/repositories/chicken/chicken_repository.dart';
|
||||
import 'package:rasadyar_chicken/features/common/data/repositories/common/common_repository.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import '../../../data/models/response/user_profile/user_profile.dart';
|
||||
import '../../../features/common/data/model/response/user_profile/user_profile.dart';
|
||||
|
||||
class ChickenBaseLogic extends BasePageLogic {
|
||||
var tokenService = Get.find<TokenStorageService>();
|
||||
ChickenRepository chickenRepository = diChicken.get<ChickenRepository>();
|
||||
CommonRepository commonRepository = diChicken.get<CommonRepository>();
|
||||
|
||||
Rx<Resource<UserProfile>> userProfile = Rx<Resource<UserProfile>>(Resource.loading());
|
||||
Rx<Resource<UserProfile>> userProfile = Rx<Resource<UserProfile>>(
|
||||
Resource.loading(),
|
||||
);
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
@@ -19,8 +21,9 @@ class ChickenBaseLogic extends BasePageLogic {
|
||||
Future<void> getUserProfile() async {
|
||||
userProfile.value = Resource.loading();
|
||||
await safeCall<UserProfile?>(
|
||||
call: () async =>
|
||||
await chickenRepository.getUserProfile(token: tokenService.accessToken.value!),
|
||||
call: () async => await commonRepository.getUserProfile(
|
||||
token: tokenService.accessToken.value!,
|
||||
),
|
||||
onSuccess: (result) {
|
||||
if (result != null) {
|
||||
userProfile.value = Resource.success(result);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/features/common/auth/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/common/presentation/page/auth/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
@@ -12,98 +10,90 @@ class CaptchaWidget extends GetView<CaptchaWidgetLogic> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: controller.getCaptcha,
|
||||
child: Container(
|
||||
width: 135,
|
||||
height: 50,
|
||||
alignment: Alignment.center,
|
||||
clipBehavior: Clip.antiAliasWithSaveLayer,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.whiteNormalHover,
|
||||
border: Border.all(color: Colors.grey.shade300),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: controller.obx(
|
||||
(state) => Text(
|
||||
state ?? '',
|
||||
style: AppFonts.yekan20Bold.copyWith(color: Colors.black, letterSpacing: 2.5),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
onLoading: const Center(
|
||||
child: CupertinoActivityIndicator(color: AppColor.blueNormal),
|
||||
),
|
||||
onError: (error) {
|
||||
return Center(
|
||||
child: Text('خطا ', style: AppFonts.yekan13.copyWith(color: Colors.red)),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Form(
|
||||
key: controller.formKey,
|
||||
autovalidateMode: AutovalidateMode.disabled,
|
||||
child: RTextField(
|
||||
label: 'کد امنیتی',
|
||||
controller: controller.textController,
|
||||
focusedBorder: OutlineInputBorder(
|
||||
return SizedBox(
|
||||
height: 50.h,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: controller.getCaptcha,
|
||||
child: Container(
|
||||
width: 135.w,
|
||||
height: 50.h,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.whiteNormalHover,
|
||||
border: Border.all(color: Colors.grey.shade300),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: AppColor.textColor, width: 1),
|
||||
),
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: false, signed: false),
|
||||
maxLines: 1,
|
||||
maxLength: 6,
|
||||
suffixIcon: (controller.textController.text.trim().isNotEmpty ?? false)
|
||||
? clearButton(() => controller.textController.clear())
|
||||
: null,
|
||||
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'کد امنیتی را وارد کنید';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
onChanged: (pass) {
|
||||
if (pass.length == 6) {
|
||||
if (controller.formKey.currentState?.validate() ?? false) {
|
||||
Get.find<AuthLogic>().isDisabled.value = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
style: AppFonts.yekan13,
|
||||
child: controller.obx(
|
||||
(state) => Text(
|
||||
state ?? '',
|
||||
style: AppFonts.yekan20Bold.copyWith(
|
||||
color: Colors.black,
|
||||
letterSpacing: 2.5,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
onLoading: const Center(
|
||||
child: CupertinoActivityIndicator(color: AppColor.blueNormal),
|
||||
),
|
||||
onError: (error) {
|
||||
return Center(
|
||||
child: Text(
|
||||
'خطا ',
|
||||
style: AppFonts.yekan13.copyWith(color: Colors.red),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
const SizedBox(width: 8),
|
||||
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),
|
||||
),
|
||||
keyboardType: TextInputType.numberWithOptions(
|
||||
decimal: false,
|
||||
signed: false,
|
||||
),
|
||||
filled: false,
|
||||
borderColor: Colors.grey.shade300,
|
||||
maxLines: 1,
|
||||
maxLength: 6,
|
||||
suffixIcon: (controller.textController.text.trim().isNotEmpty)
|
||||
? clearButton(() => controller.textController.clear())
|
||||
: null,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'کد امنیتی را وارد کنید';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
onChanged: (pass) {
|
||||
if (pass.length == 6) {
|
||||
if (controller.formKey.currentState?.validate() ?? false) {
|
||||
Get.find<AuthLogic>().isDisabled.value = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
style: AppFonts.yekan13,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _CaptchaLinePainter extends CustomPainter {
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
final random = Random();
|
||||
final paint1 = Paint()
|
||||
..color = Colors.deepOrange
|
||||
..strokeWidth = 2;
|
||||
final paint2 = Paint()
|
||||
..color = Colors.blue
|
||||
..strokeWidth = 2;
|
||||
|
||||
// First line: top-left to bottom-right
|
||||
canvas.drawLine(Offset(0, 0), Offset(size.width, size.height), paint1);
|
||||
|
||||
// Second line: bottom-left to top-right
|
||||
canvas.drawLine(Offset(0, size.height), Offset(size.width, 0), paint2);
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(covariant CustomPainter oldDelegate) => false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
import 'package:rasadyar_chicken/features/steward/root/logic.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/pages/root/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
enum WidelyUsedType { edit, normal }
|
||||
@@ -8,8 +7,6 @@ class WidelyUsedLogic extends GetxController {
|
||||
Rx<WidelyUsedType> type = WidelyUsedType.normal.obs;
|
||||
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
||||
|
||||
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/features/steward/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
@@ -39,7 +39,10 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
controller.rootLogic.currentPage.value = 0;
|
||||
controller.rootLogic.currentPage.refresh();
|
||||
await Future.delayed(Duration(milliseconds: 100));
|
||||
Get.toNamed(ChickenRoutes.buysOutOfProvinceSteward, id: stewardFirstKey);
|
||||
Get.toNamed(
|
||||
StewardRoutes.buysOutOfProvinceSteward,
|
||||
id: stewardFirstKey,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -52,7 +55,10 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
controller.rootLogic.currentPage.value = 0;
|
||||
controller.rootLogic.currentPage.refresh();
|
||||
await Future.delayed(Duration(milliseconds: 100));
|
||||
Get.toNamed(ChickenRoutes.buysInProvinceSteward, id: stewardFirstKey);
|
||||
Get.toNamed(
|
||||
StewardRoutes.buysInProvinceSteward,
|
||||
id: stewardFirstKey,
|
||||
);
|
||||
},
|
||||
isOnEdit: false,
|
||||
),
|
||||
@@ -65,7 +71,10 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
controller.rootLogic.currentPage.value = 1;
|
||||
controller.rootLogic.currentPage.refresh();
|
||||
await Future.delayed(Duration(milliseconds: 100));
|
||||
Get.toNamed(ChickenRoutes.salesOutOfProvinceSteward, id: stewardSecondKey);
|
||||
Get.toNamed(
|
||||
StewardRoutes.salesOutOfProvinceSteward,
|
||||
id: stewardSecondKey,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -77,7 +86,10 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
controller.rootLogic.currentPage.value = 1;
|
||||
controller.rootLogic.currentPage.refresh();
|
||||
await Future.delayed(Duration(milliseconds: 100));
|
||||
Get.toNamed(ChickenRoutes.salesInProvinceSteward, id: stewardSecondKey);
|
||||
Get.toNamed(
|
||||
StewardRoutes.salesInProvinceSteward,
|
||||
id: stewardSecondKey,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -93,7 +105,11 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 0.50, color: const Color(0xFFA9A9A9)),
|
||||
),
|
||||
child: Text('پر کاربردها', textAlign: TextAlign.right, style: AppFonts.yekan16),
|
||||
child: Text(
|
||||
'پر کاربردها',
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan16,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -126,20 +142,27 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: ShapeDecoration(
|
||||
color: cardColor ?? Color(0xFFBECDFF),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
width: 40.w,
|
||||
height: 40.h,
|
||||
decoration: ShapeDecoration(
|
||||
color: labelColor ?? AppColor.blueNormal,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.all(4),
|
||||
child: SvgGenImage.vec(iconPath).svg(
|
||||
width: 24.w,
|
||||
height: 24.h,
|
||||
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
colorFilter: ColorFilter.mode(
|
||||
Colors.white,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
@@ -152,7 +175,9 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: ShapeDecoration(
|
||||
color: Colors.white60,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -172,9 +197,16 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
child: Container(
|
||||
width: 16,
|
||||
height: 16,
|
||||
decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.white),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Icon(CupertinoIcons.minus, color: AppColor.error, size: 15),
|
||||
child: Icon(
|
||||
CupertinoIcons.minus,
|
||||
color: AppColor.error,
|
||||
size: 15,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -183,7 +215,12 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(title, style: AppFonts.yekan10.copyWith(color: textColor ?? AppColor.textColor)),
|
||||
Text(
|
||||
title,
|
||||
style: AppFonts.yekan10.copyWith(
|
||||
color: textColor ?? AppColor.textColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -201,16 +238,24 @@ class WidelyUsedWidget extends StatelessWidget {
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: ShapeDecoration(
|
||||
color: const Color(0xFFD9F7F0),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: Assets.vec.messageAddSvg.svg(
|
||||
width: 40,
|
||||
height: 40,
|
||||
colorFilter: ColorFilter.mode(AppColor.greenNormal, BlendMode.srcIn),
|
||||
colorFilter: ColorFilter.mode(
|
||||
AppColor.greenNormal,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
Text('افزودن', style: AppFonts.yekan10.copyWith(color: AppColor.greenDarkHover)),
|
||||
Text(
|
||||
'افزودن',
|
||||
style: AppFonts.yekan10.copyWith(color: AppColor.greenDarkHover),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user