refactor : base page

This commit is contained in:
2025-09-25 17:25:55 +03:30
parent fd9de4f80c
commit 5ac8342bb3
30 changed files with 471 additions and 455 deletions

View File

@@ -1,3 +1,4 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:
- hive_ce: true

View File

@@ -2,11 +2,6 @@ import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
class CustomNavigationObserver extends NavigatorObserver {
bool _isWorkDone = false;
void setInjectionDone() {
_isWorkDone = true;
}
@override
void didPush(Route route, Route? previousRoute) async {

View File

@@ -0,0 +1,4 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:
- hive_ce: true

View File

@@ -1,5 +1,6 @@
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_chicken/presentation/widget/captcha/view.dart';
import 'package:rasadyar_core/core.dart';
@@ -10,102 +11,110 @@ class AuthPage extends GetView<AuthLogic> {
@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),
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),
),
],
),
return ChickenBasePage(
isFullScreen: true,
backGroundWidget: BackGroundWidget(
gradient: LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [
const Color(0xFFB2C9FF).withValues(alpha: 1.0), // 0%
const Color(0xFF40BB93).withValues(alpha: 0.11), // 50%
const Color(0xFF93B6D3).withValues(alpha: 1.0), // 100%
],
stops: const [0.0, 0.5, 1.0],
),
vecPath: Assets.vec.chickenPatternSvg.path,
),
onPopScopTaped: () => Get.back(result: -1),
child: Stack(
children: [
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: AppColor.darkGreyDarkActive),
),
Text(
'سامانه رصد و پایش زنجیره تامین، تولید و توزیع کالا های اساسی',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkActive),
),
],
),
),
),
),
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(
title: 'سامانه رصدطیور',
),
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(
vecPath: Assets.vec.rasadToyorSvg.path,
width: 85.w,
height: 85.h,
titleStyle: AppFonts.yekan20Bold.copyWith(color: Color(0xFF4665AF)),
title: 'رصدطیور',
),
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),
),
],
),
),
],
),
),
);
}),
],
),
);
}
@@ -341,5 +350,4 @@ class AuthPage extends GetView<AuthLogic> {
),
);
}
}

View File

@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/common/fa_user_role.dart';
import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
@@ -10,14 +11,9 @@ class RolePage extends GetView<RoleLogic> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: chickenAppBar(
hasBack: false,
hasFilter: false,
hasSearch: false,
isBase: false,
),
body: Column(
return ChickenBasePage(
isBase: true,
child: Column(
children: [
Assets.images.selectRole.image(
height: 212.h,
@@ -78,6 +74,7 @@ Widget roleCard({
height: height?.h ?? 48.h,
margin: EdgeInsets.all(8.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.r),
border: Border.all(color: AppColor.blueNormal, width: 1.w),
),

View File

@@ -15,6 +15,7 @@ class FarmPage extends GetView<FarmLogic> {
hasFilter: false,
hasSearch: false,
isBase: true,
routes: [],
backId: poultryFirstKey,
widgets: [firstTagInformation(), farmListWidget()],

View File

@@ -2,7 +2,7 @@ import 'package:flutter/cupertino.dart' hide LinearGradient;
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_core/presentation/widget/custom/information_card_widget.dart';
@@ -13,72 +13,71 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColor.bgLight,
appBar: chickenAppBar(
hasBack: false,
hasFilter: false,
hasSearch: false,
return ChickenBasePage(
isBase: true,
hasNotification: true,
hasNews: true,
scrollable: true,
),
body: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Column(
children: [
SizedBox(height: 22.h),
InkWell(
onTap: () {
controller.isExpanded.value = !controller.isExpanded.value;
},
child: Stack(
clipBehavior: Clip.none,
children: [
Container(
margin: EdgeInsetsGeometry.all(6),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 0.50, color: const Color(0xFFA9A9A9)),
),
widgets: [
SizedBox(height: 8.h),
InkWell(
onTap: () {
controller.isExpanded.value = !controller.isExpanded.value;
},
child: Stack(
clipBehavior: Clip.none,
children: [
Container(
margin: EdgeInsetsGeometry.all(6),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 0.50, color: const Color(0xFFA9A9A9)),
),
child: ObxValue((data) {
return AnimatedSize(
duration: Duration(milliseconds: 300),
child: data.value ? mainItemWidget() : mainItemWidgetExpanded(),
);
}, controller.isExpanded),
),
Positioned(
top: -4,
right: 20,
child: Container(
color: Colors.white,
padding: EdgeInsets.symmetric(horizontal: 8),
child: Row(
spacing: 8,
children: [
Assets.vec.chicken2Svg.svg(
width: 16.w,
height: 16.h,
colorFilter: ColorFilter.mode(AppColor.iconColor, BlendMode.srcIn),
),
Text(
'اطلاعات فارم‌ها',
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: AppColor.iconColor),
),
],
),
),
),
],
child: ObxValue((data) {
return AnimatedSize(
duration: Duration(milliseconds: 300),
child: data.value ? mainItemWidget() : mainItemWidgetExpanded(),
);
}, controller.isExpanded),
),
),
SizedBox(height: 10),
widelyWidget(),
SizedBox(height: 20),
],
Positioned(
top: -10,
right: 20,
child: Container(
height: 32.h,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 0.50, color: const Color(0xFFA9A9A9)),
),
padding: EdgeInsets.symmetric(horizontal: 8),
child: Row(
spacing: 8,
children: [
Assets.vec.chicken2Svg.svg(
width: 16.w,
height: 16.h,
colorFilter: ColorFilter.mode(AppColor.blueDark, BlendMode.srcIn),
),
Text(
'اطلاعات فارم‌ها',
textAlign: TextAlign.right,
style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor),
),
],
),
),
),
],
),
),
),
SizedBox(height: 10),
widelyWidget(),
SizedBox(height: 20),
],
);
}
@@ -87,39 +86,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(height: 8),
/* Row(
spacing: 8,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 40,
height: 40,
decoration: ShapeDecoration(
shape: RoundedRectangleBorder(
side: BorderSide(width: 0.25, color: const Color(0xFFB0B0B0)),
borderRadius: BorderRadius.circular(4),
),
),
child: Assets.images.liveChicken.image(
width: 40.w,
height: 40.h,
fit: BoxFit.cover,
),
),
Text(
'فارم ها',
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkActive),
),
Spacer(),
Icon(CupertinoIcons.chevron_down, size: 18),
],
),*/
firstTagInformation(),
secondTagInformation(),
],
children: [SizedBox(height: 8), firstTagInformation(), secondTagInformation()],
),
);
}
@@ -246,8 +213,9 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
return Container(
margin: EdgeInsetsGeometry.all(6),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1, color: AppColor.borderColor),
border: Border.all(width: 0.50, color: const Color(0xFFA9A9A9)),
),
child: Stack(
clipBehavior: Clip.none,
@@ -312,10 +280,15 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
),
),
Positioned(
top: -12,
top: -17,
right: 11,
child: Container(
color: Colors.white,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 0.50, color: const Color(0xFFA9A9A9)),
),
child: Text('پر کاربردها', textAlign: TextAlign.right, style: AppFonts.yekan16),
),
),

View File

@@ -5,7 +5,6 @@ import 'package:rasadyar_chicken/data/models/response/hatching/hatching_models.d
import 'package:rasadyar_chicken/data/models/response/hatching_report/hatching_report.dart';
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_chicken/presentation/widget/page_route.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
@@ -23,24 +22,14 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
onSearchChanged: (data) => controller.setSearchValue(data),
backId: poultryFirstKey,
routes: controller.routesName,
//routesWidget: ObxValue((route) => buildContainerPageRoute(route), controller.routesName),
child: Stack(
children: [
Positioned.fill(
child: Assets.vec.chickenPatternSvg.svg(
fit: BoxFit.cover,
colorFilter: ColorFilter.mode(Color(0xFFC3CBDA), BlendMode.srcIn),
),
),
SizedBox(height: 50, child: segmentWidget()),
Expanded(
child: ObxValue((data) {
return data.value == 0 ? hatchingWidget() : reportWidget();
}, controller.selectedSegmentIndex),
),
],
),
//routesWidget: ObxValue((route) => buildContainerPageRoute(route), controller.routesName),
widgets: [
SizedBox(height: 50, child: segmentWidget()),
ObxValue((data) {
return data.value == 0 ? hatchingWidget() : reportWidget();
}, controller.selectedSegmentIndex),
],
);
}

View File

@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
@@ -10,16 +10,7 @@ class PoultryActionPage extends GetView<PoultryActionLogic> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: chickenAppBar(hasBack: false, hasFilter: false, hasSearch: false, isBase: false),
body: Stack(
fit: StackFit.expand,
children: [
Positioned.fill(child: Assets.vec.chickenPatternSvg.svg(fit: BoxFit.cover,)),
Positioned.fill(child: gridWidget()),
],
)
);
return ChickenBasePage(isBase: true, hasNews: true, hasNotification: true, child: gridWidget());
}
Widget gridWidget() {

View File

@@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
import 'package:rasadyar_chicken/presentation/routes/pages.dart';
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
import 'package:rasadyar_chicken/presentation/utils/nested_keys_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
@@ -14,118 +15,92 @@ class PoultryScienceRootPage extends GetView<PoultryScienceRootLogic> {
@override
Widget build(BuildContext context) {
return ObxValue((data) {
return PopScope(
canPop: false,
onPopInvokedWithResult: (didPop, result) async {
final nestedKey = Get.nestedKey(controller.getNestedKey());
final currentNavigator = nestedKey?.currentState;
return ChickenBasePage(
isFullScreen: true,
child: ObxValue((data) {
return Stack(
children: [
IndexedStack(
children: [
Navigator(
key: Get.nestedKey(poultryFirstKey),
onGenerateRoute: (settings) {
final page = ChickenPages.pages.firstWhere(
(e) => e.name == settings.name,
orElse: () => ChickenPages.pages.firstWhere(
(e) => e.name == ChickenRoutes.actionPoultryScience,
),
);
if (currentNavigator?.canPop() ?? false) {
currentNavigator?.pop();
} else {
final now = DateTime.now();
if (_lastBackPressed == null ||
now.difference(_lastBackPressed!) > Duration(seconds: 2)) {
_lastBackPressed = now;
Get.snackbar(
'خروج از برنامه',
'برای خروج دوباره بازگشت را بزنید',
snackPosition: SnackPosition.TOP,
duration: Duration(seconds: 2),
backgroundColor: AppColor.warning,
);
} else {
await SystemNavigator.pop();
}
}
},
child: Scaffold(
backgroundColor: AppColor.bgLight,
body: Stack(
children: [
IndexedStack(
children: [
Navigator(
key: Get.nestedKey(poultryFirstKey),
onGenerateRoute: (settings) {
final page = ChickenPages.pages.firstWhere(
(e) => e.name == settings.name,
orElse: () => ChickenPages.pages.firstWhere(
(e) => e.name == ChickenRoutes.actionPoultryScience,
),
);
return buildRouteFromGetPage(page);
return buildRouteFromGetPage(page);
},
),
Navigator(
key: Get.nestedKey(poultrySecondKey),
onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[1]),
),
Navigator(
key: Get.nestedKey(poultryThirdKey),
onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[2]),
),
],
index: data.value,
),
Positioned(
right: 0,
left: 0,
bottom: 0,
child: RBottomNavigation(
mainAxisAlignment: MainAxisAlignment.spaceAround,
items: [
RBottomNavigationItem(
label: 'عملیات',
icon: Assets.vec.settingSvg.path,
isSelected: controller.currentPage.value == 0,
onTap: () {
Get.nestedKey(
poultrySecondKey,
)?.currentState?.popUntil((route) => route.isFirst);
Get.nestedKey(
poultryFirstKey,
)?.currentState?.popUntil((route) => route.isFirst);
controller.changePage(0);
},
),
Navigator(
key: Get.nestedKey(poultrySecondKey),
onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[1]),
RBottomNavigationItem(
label: 'خانه',
icon: Assets.vec.homeSvg.path,
isSelected: controller.currentPage.value == 1,
onTap: () {
Get.nestedKey(
poultryFirstKey,
)?.currentState?.popUntil((route) => route.isFirst);
Get.nestedKey(
poultryThirdKey,
)?.currentState?.popUntil((route) => route.isFirst);
controller.changePage(1);
},
),
Navigator(
key: Get.nestedKey(poultryThirdKey),
onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[2]),
RBottomNavigationItem(
label: 'پروفایل',
icon: Assets.vec.profileCircleSvg.path,
isSelected: controller.currentPage.value == 2,
onTap: () {
Get.nestedKey(
poultryFirstKey,
)?.currentState?.popUntil((route) => route.isFirst);
Get.nestedKey(
poultrySecondKey,
)?.currentState?.popUntil((route) => route.isFirst);
controller.changePage(2);
},
),
],
index: data.value,
),
Positioned(
right: 0,
left: 0,
bottom: 0,
child: RBottomNavigation(
mainAxisAlignment: MainAxisAlignment.spaceAround,
items: [
RBottomNavigationItem(
label: 'عملیات',
icon: Assets.vec.settingSvg.path,
isSelected: controller.currentPage.value == 0,
onTap: () {
Get.nestedKey(
poultrySecondKey,
)?.currentState?.popUntil((route) => route.isFirst);
Get.nestedKey(
poultryFirstKey,
)?.currentState?.popUntil((route) => route.isFirst);
controller.changePage(0);
},
),
RBottomNavigationItem(
label: 'خانه',
icon: Assets.vec.homeSvg.path,
isSelected: controller.currentPage.value == 1,
onTap: () {
Get.nestedKey(
poultryFirstKey,
)?.currentState?.popUntil((route) => route.isFirst);
Get.nestedKey(
poultryThirdKey,
)?.currentState?.popUntil((route) => route.isFirst);
controller.changePage(1);
},
),
RBottomNavigationItem(
label: 'پروفایل',
icon: Assets.vec.profileCircleSvg.path,
isSelected: controller.currentPage.value == 2,
onTap: () {
Get.nestedKey(
poultryFirstKey,
)?.currentState?.popUntil((route) => route.isFirst);
Get.nestedKey(
poultrySecondKey,
)?.currentState?.popUntil((route) => route.isFirst);
controller.changePage(2);
},
),
],
),
),
],
),
),
);
}, controller.currentPage);
),
],
);
}, controller.currentPage),
);
}
}

View File

@@ -1,14 +1,12 @@
import 'package:rasadyar_chicken/presentation/pages/common/profile/logic.dart';
import 'package:rasadyar_core/core.dart';
class GlobalBinding extends Bindings {
@override
void dependencies() {
Get.put(BaseLogic(), permanent: true);
Get.lazyPut(() => BaseLogic(), fenix: true);
Get.lazyPut(() => ProfileLogic(), fenix: true);
//root logics
}
}

View File

@@ -33,6 +33,7 @@ sealed class ChickenPages {
binding: BindingsBuilder(() {
Get.lazyPut(() => AuthLogic());
Get.lazyPut(() => CaptchaWidgetLogic());
Get.lazyPut(() => BaseLogic(), fenix: true);
}),
),
@@ -41,10 +42,10 @@ sealed class ChickenPages {
page: () => RolePage(),
binding: BindingsBuilder(() {
Get.lazyPut(() => RoleLogic());
Get.lazyPut(() => BaseLogic(), fenix: true);
}),
),
//region Steward Pages
GetPage(
name: ChickenRoutes.initSteward,
@@ -53,6 +54,7 @@ sealed class ChickenPages {
bindings: [
GlobalBinding(),
BindingsBuilder(() {
Get.lazyPut(() => BaseLogic(), fenix: true);
Get.lazyPut(() => StewardRootLogic());
Get.lazyPut(() => HomeLogic());
Get.lazyPut(() => BuyLogic());
@@ -67,6 +69,7 @@ sealed class ChickenPages {
page: () => HomePage(),
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.put(HomeLogic());
Get.lazyPut(() => BaseLogic());
}),
@@ -160,7 +163,6 @@ sealed class ChickenPages {
Get.lazyPut(() => PoultryActionLogic());
}),
],
),
GetPage(
@@ -169,7 +171,6 @@ sealed class ChickenPages {
middlewares: [AuthMiddleware()],
binding: BindingsBuilder(() {
Get.lazyPut(() => InspectionPoultryScienceLogic());
}),
),
GetPage(
@@ -207,7 +208,7 @@ sealed class ChickenPages {
binding: BindingsBuilder(() {
Get.lazyPut(() => GenocideLogic());
Get.lazyPut(() => PoultryScienceRootLogic());
Get.lazyPut(() => KillingRegistrationLogic(),fenix: true);
Get.lazyPut(() => KillingRegistrationLogic(), fenix: true);
}),
),
GetPage(

View File

@@ -30,7 +30,8 @@ RAppBar chickenAppBar({
onNewsTap: onNewsTap,
backgroundColor: AppColor.blueNormal,
children: [
Text('رصدطیور', style: AppFonts.yekan16Bold),
const SizedBox(width: 6),
Text('رصدطیور', style: AppFonts.yekan16Bold.copyWith(color: Colors.white)),
const SizedBox(width: 6),
Assets.vec.chickenSvg.svg(height: 24, width: 24),
],

View File

@@ -3,7 +3,7 @@ import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/back_ground.dart';
import 'package:rasadyar_core/core.dart';
class ChickenBasePage extends GetView<BaseLogic> {
class ChickenBasePage extends StatefulWidget {
const ChickenBasePage({
super.key,
this.hasBack = true,
@@ -28,21 +28,22 @@ class ChickenBasePage extends GetView<BaseLogic> {
this.floatingActionButton,
this.filteringWidget,
this.backGroundWidget,
}) : assert(
(routes != null) || routesWidget != null,
'Either routes or routesWidget must be provided.',
);
this.isFullScreen = false,
this.onPopScopTaped,
});
//AppBar properties`
final bool hasBack;
final bool hasFilter;
final bool hasSearch;
final bool isBase;
final bool isFullScreen;
final bool hasNotification;
final bool hasNews;
final int? backId;
final VoidCallback? onBackTap;
final VoidCallback? onPopScopTaped;
final VoidCallback? onFilterTap;
final VoidCallback? onSearchTap;
final VoidCallback? onNewsTap;
@@ -61,13 +62,44 @@ class ChickenBasePage extends GetView<BaseLogic> {
final BackGroundWidget? backGroundWidget;
@override
State<ChickenBasePage> createState() => _ChickenBasePageState();
}
class _ChickenBasePageState extends State<ChickenBasePage> {
int? _lastBackId;
@override
void initState() {
super.initState();
_lastBackId = widget.backId;
tLog(_lastBackId);
tLog(widget.backId);
}
@override
void didChangeDependencies() {
fLog('didChangeDependencies');
fLog(_lastBackId);
fLog(widget.backId);
super.didChangeDependencies();
}
@override
void didUpdateWidget(covariant ChickenBasePage oldWidget) {
dLog('didUpdateWidget');
dLog(_lastBackId);
dLog(widget.backId);
super.didUpdateWidget(oldWidget);
}
void _onFilterTap() {
if (hasFilter && filteringWidget != null) {
if (widget.hasFilter && widget.filteringWidget != null) {
final currentRoute = ModalRoute.of(Get.context!);
if (currentRoute?.isCurrent != true) return;
Get.bottomSheet(
filteringWidget!,
widget.filteringWidget!,
isScrollControlled: true,
isDismissible: true,
enableDrag: true,
@@ -77,28 +109,60 @@ class ChickenBasePage extends GetView<BaseLogic> {
@override
Widget build(BuildContext context) {
return BasePage(
routes: routes,
routesWidget: routesWidget,
widgets: widgets,
child: child,
scrollable: scrollable,
floatingActionButtonLocation: floatingActionButtonLocation,
floatingActionButton: floatingActionButton,
backGroundWidget: backGroundWidget ?? chickenBackground(),
appBar: chickenAppBar(
isBase: isBase,
hasBack: isBase ? false : hasBack,
onBackTap: onBackTap,
onNewsTap: onNewsTap,
hasFilter: hasFilter,
hasSearch: hasSearch,
hasNews: hasNews,
hasNotification: hasNotification,
backId: backId,
onNotificationTap: onNotificationTap,
onFilterTap: hasFilter ? _onFilterTap : null,
onSearchTap: hasSearch ? controller.toggleSearch : null,
return PopScope(
canPop: false,
onPopInvokedWithResult: (didPop, result) {
iLog('PopScope onPopInvokedWithResult:==> ${widget.backId}');
iLog('PopScope onPopInvokedWithResult:==> $_lastBackId}');
iLog('PopScope onPopInvokedWithResult:==> ${widget.onPopScopTaped}');
iLog('PopScope onPopInvokedWithResult:==> ${widget.onBackTap}');
// چک کردن و مدیریت برگشت با backId
if (widget.backId != null) {
final navigatorState = Get.nestedKey(widget.backId!)?.currentState;
if (navigatorState != null && navigatorState.canPop()) {
Get.back(id: widget.backId!); // پاپ با استفاده از backId
} else {
// اگر هیچ صفحه‌ای برای پاپ موجود نیست
if (widget.onPopScopTaped != null) {
widget.onPopScopTaped!();
} else {
Get.back();
}
}
} else {
// اگر backId نداشته باشد
if (widget.onPopScopTaped != null) {
widget.onPopScopTaped!();
} else {
Get.back();
}
}
},
child: BasePage(
routes: widget.routes,
routesWidget: widget.routesWidget,
widgets: widget.widgets,
child: widget.child,
scrollable: widget.scrollable,
floatingActionButtonLocation: widget.floatingActionButtonLocation,
floatingActionButton: widget.floatingActionButton,
backGroundWidget: widget.backGroundWidget ?? chickenBackground(),
appBar: widget.isFullScreen
? null
: chickenAppBar(
isBase: widget.isBase,
hasBack: widget.isBase ? false : widget.hasBack,
onNewsTap: widget.onNewsTap,
hasFilter: widget.hasFilter,
hasSearch: widget.hasSearch,
hasNews: widget.hasNews,
backId: widget.backId,
onBackTap: widget.onBackTap,
hasNotification: widget.hasNotification,
onNotificationTap: widget.onNotificationTap,
onFilterTap: widget.hasFilter ? _onFilterTap : null,
//onSearchTap: widget.hasSearch ? controller.toggleSearch : null,
),
),
);
}

View File

@@ -3,7 +3,7 @@ description: A starting point for Dart libraries or applications.
version: 1.3.2+3
environment:
sdk: ^3.9.0
sdk: ^3.9.2
dependencies:

View File

@@ -1,3 +1,4 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:
- hive_ce: true

View File

@@ -13,7 +13,9 @@ class BasePage extends GetView<BaseLogic> {
this.floatingActionButton,
this.appBar,
this.backGroundWidget,
}) ;
this.onPopScopTaped,
this.backId,
});
final List<String>? routes;
final Breadcrumb? routesWidget;
@@ -24,6 +26,8 @@ class BasePage extends GetView<BaseLogic> {
final BackGroundWidget? backGroundWidget;
final FloatingActionButtonLocation? floatingActionButtonLocation;
final Widget? floatingActionButton;
final VoidCallback? onPopScopTaped;
final int? backId;
Widget _buildHeader() {
return Column(
@@ -36,7 +40,11 @@ class BasePage extends GetView<BaseLogic> {
}
Widget _buildBody() {
final content = [_buildHeader(), if (child != null) Expanded(child: child!), ...?widgets];
final content = [
if (routes != null || routesWidget != null) _buildHeader(),
if (child != null) Expanded(child: child!),
...?widgets,
];
if (scrollable) {
if (backGroundWidget != null) {
@@ -61,7 +69,7 @@ class BasePage extends GetView<BaseLogic> {
if (backGroundWidget != null) {
return Stack(
children: [
?backGroundWidget,
Positioned.fill(child: backGroundWidget!),
Column(children: content),
],
);
@@ -71,18 +79,12 @@ class BasePage extends GetView<BaseLogic> {
@override
Widget build(BuildContext context) {
return PopScope(
canPop: false,
onPopInvokedWithResult: (didPop, result) {
if (!didPop) appBar?.onBackTap?.call();
},
child: Scaffold(
backgroundColor: AppColor.bgLight,
appBar: appBar,
body: _buildBody(),
floatingActionButtonLocation: floatingActionButtonLocation,
floatingActionButton: floatingActionButton,
),
return Scaffold(
backgroundColor: AppColor.bgLight,
appBar: appBar,
body: _buildBody(),
floatingActionButtonLocation: floatingActionButtonLocation,
floatingActionButton: floatingActionButton,
);
}
}

View File

@@ -1,12 +1,9 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/presentation/common/assets.gen.dart';
import '../../../../core.dart';
class BackGroundWidget extends StatelessWidget {
const BackGroundWidget({
super.key,
required this.gradient,
required this.vecPath,
});
const BackGroundWidget({super.key, required this.gradient, required this.vecPath});
final Gradient gradient;
final String vecPath;
@@ -14,10 +11,10 @@ class BackGroundWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
width: Get.width,
height: Get.height,
decoration: BoxDecoration(gradient: gradient),
child: SvgGenImage.vec(vecPath).svg(fit: BoxFit.cover),
);
}
}

View File

@@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
@@ -65,8 +67,7 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
children: [
if (children != null) ...children!,
if (hasNews || hasBack || hasSearch || hasNotification || hasFilter)
const Spacer(),
if (hasNews || hasBack || hasSearch || hasNotification || hasFilter) const Spacer(),
if (hasNews)
GestureDetector(
@@ -79,26 +80,23 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
if (hasNews) SizedBox(width: 8.w),
if (hasNotification)
Badge.count(
count: 2,
child: Icon(CupertinoIcons.bell_fill, color: Colors.white),
),
Badge.count(count: 2, child: Icon(CupertinoIcons.bell_fill, color: Colors.white)),
if (hasNotification) SizedBox(width: 8.w),
if (hasFilter)
GestureDetector(
onTap: onFilterTap,
child: Assets.vec.filterSvg.svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
if (!isBase) ...{
if (hasFilter)
GestureDetector(
onTap: onFilterTap,
child: Assets.vec.filterSvg.svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
),
),
if (hasBack) SizedBox(width: 8.w),
if (hasSearch) SearchWidget(),
if (hasSearch) SizedBox(width: 8.w),
if (hasBack) SizedBox(width: 8.w),
if (hasSearch) SearchWidget(),
if (hasSearch) SizedBox(width: 8.w),
},
if (hasBack)
GestureDetector(
onTap: onBackTap ?? () => Get.back(id: backId),
@@ -120,8 +118,7 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
}
@override
Size get preferredSize =>
Size.fromHeight(kToolbarHeight + (bottom?.preferredSize.height ?? 0));
Size get preferredSize => Size.fromHeight(kToolbarHeight + (bottom?.preferredSize.height ?? 0));
MainAxisAlignment _getMainAxisAlignment() {
if (centerTitle) {
@@ -173,21 +170,15 @@ class RAppBar2 extends StatelessWidget implements PreferredSizeWidget {
excludeHeaderSemantics: true,
scrolledUnderElevation: 0,
centerTitle: centerTitle,
titleTextStyle:
titleTextStyle ?? AppFonts.yekan16.copyWith(color: Colors.white),
titleTextStyle: titleTextStyle ?? AppFonts.yekan16.copyWith(color: Colors.white),
title: Row(
children: [
if (leading != null) ...{
Padding(padding: const EdgeInsets.only(right: 6), child: leading),
},
if (title != null) ...[
Text(title!),
if (iconTitle != null) const SizedBox(width: 8),
],
if (title != null) ...[Text(title!), if (iconTitle != null) const SizedBox(width: 8)],
if (iconTitle != null) ...{const SizedBox(width: 8)},
if (iconTitle != null) ...{
SvgGenImage.vec(iconTitle!).svg(width: 24, height: 24),
},
if (iconTitle != null) ...{SvgGenImage.vec(iconTitle!).svg(width: 24, height: 24)},
],
),
titleSpacing: 8,
@@ -201,10 +192,7 @@ class RAppBar2 extends StatelessWidget implements PreferredSizeWidget {
child: Assets.vec.arrowLeftSvg.svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(
iconColor ?? Colors.white,
BlendMode.srcIn,
),
colorFilter: ColorFilter.mode(iconColor ?? Colors.white, BlendMode.srcIn),
),
),
),

View File

@@ -130,7 +130,9 @@ class InformationTag extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
height: (data.height ?? 82).h,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(8)),
decoration: BoxDecoration(
border: Border.all(color: const Color(0xFFA9A9A9) ,width:0.50),
borderRadius: BorderRadius.circular(8)),
clipBehavior: Clip.hardEdge,
child: Row(
children: [

View File

@@ -2,23 +2,49 @@ import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
class LogoWidget extends StatelessWidget {
const LogoWidget({super.key, this.title});
final String? title ;
const LogoWidget({
super.key,
this.title,
this.height,
this.width,
this.vecPath,
this.svgPath,
this.imagePath,
this.titleStyle,
});
final String? title;
final String? vecPath;
final String? svgPath;
final String? imagePath;
final num? width;
final num? height;
final TextStyle? titleStyle;
@override
Widget build(BuildContext context) {
return Column(
children: [
Row(),
Assets.images.innerSplash.image(
width: 120.w,
height: 120.h,
),
buildLogo(),
SizedBox(height: 8.h),
Text(
title??'سامانه رصدیار',
style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyNormal),
title ?? 'سامانه رصدیار',
style:titleStyle?? AppFonts.yekan16.copyWith(color: AppColor.darkGreyNormal),
),
],
);
}
Widget buildLogo() {
if (vecPath != null) {
return SvgGenImage.vec(vecPath!).svg(width: width?.w ?? 120.w, height: height?.h ?? 120.h);
} else if (svgPath != null) {
return SvgGenImage(vecPath!).svg(width: width?.w ?? 120.w, height: height?.h ?? 120.h);
} else if (imagePath != null) {
return AssetGenImage(imagePath!).image(width: width?.w ?? 120.w, height: height?.h ?? 120.h);
} else {
return Assets.images.innerSplash.image(width: 120.w, height: 120.h);
}
}
}

View File

@@ -333,10 +333,10 @@ packages:
dependency: "direct main"
description:
name: device_preview_plus
sha256: "45f9154c3213e470df1aa54326757ccf3cc6fb1f04396bced6ad1a7bfc9d6400"
sha256: "2ebe9cf25ed46875c9c1b745d0438df9e4c49f7bcf9ea466c88efbcffcc73ab7"
url: "https://pub.dev"
source: hosted
version: "2.5.0"
version: "2.5.1"
dio:
dependency: "direct main"
description:
@@ -1852,4 +1852,4 @@ packages:
version: "2.1.0"
sdks:
dart: ">=3.9.2 <4.0.0"
flutter: ">=3.35.3"
flutter: ">=3.35.4"

View File

@@ -4,7 +4,7 @@ publish_to: none
version: 1.2.0+2
environment:
sdk: ^3.9.0
sdk: ^3.9.2
dependencies:
flutter:

View File

@@ -1,3 +1,4 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:
- hive_ce: true

View File

@@ -333,10 +333,10 @@ packages:
dependency: transitive
description:
name: device_preview_plus
sha256: "45f9154c3213e470df1aa54326757ccf3cc6fb1f04396bced6ad1a7bfc9d6400"
sha256: "2ebe9cf25ed46875c9c1b745d0438df9e4c49f7bcf9ea466c88efbcffcc73ab7"
url: "https://pub.dev"
source: hosted
version: "2.5.0"
version: "2.5.1"
dio:
dependency: transitive
description:
@@ -1859,4 +1859,4 @@ packages:
version: "2.1.0"
sdks:
dart: ">=3.9.2 <4.0.0"
flutter: ">=3.35.3"
flutter: ">=3.35.4"

View File

@@ -4,7 +4,7 @@ publish_to: 'none'
version: 1.2.0
environment:
sdk: ^3.9.0
sdk: ^3.9.2
dependencies:
flutter:

View File

@@ -1,3 +1,4 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:
- hive_ce: true

View File

@@ -5,7 +5,7 @@ publish_to: 'none'
# repository: https://github.com/my_org/my_repo
environment:
sdk: ^3.9.0
sdk: ^3.9.2
dependencies:

View File

@@ -317,10 +317,10 @@ packages:
dependency: transitive
description:
name: device_preview_plus
sha256: "45f9154c3213e470df1aa54326757ccf3cc6fb1f04396bced6ad1a7bfc9d6400"
sha256: "2ebe9cf25ed46875c9c1b745d0438df9e4c49f7bcf9ea466c88efbcffcc73ab7"
url: "https://pub.dev"
source: hosted
version: "2.5.0"
version: "2.5.1"
dio:
dependency: transitive
description:
@@ -1839,4 +1839,4 @@ packages:
version: "2.1.0"
sdks:
dart: ">=3.9.2 <4.0.0"
flutter: ">=3.35.3"
flutter: ">=3.35.4"

View File

@@ -4,7 +4,7 @@ publish_to: 'none'
version: 1.3.8+6
environment:
sdk: ^3.9.0
sdk: ^3.9.2
dependencies:
flutter: