feat: sale out of the province

This commit is contained in:
2025-06-17 11:46:09 +03:30
parent 4c40bfa43e
commit f5088027ba
5 changed files with 286 additions and 101 deletions

View File

@@ -1,8 +1,6 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/chicken.dart';
import 'package:rasadyar_chicken/data/models/response/kill_house_distribution_info/kill_house_distribution_info.dart';
import 'package:rasadyar_chicken/presentation/pages/buys_out_of_province/view.dart';
import 'package:rasadyar_chicken/presentation/pages/sales_out_of_province/view.dart';
import 'package:rasadyar_core/core.dart';
class RootPage extends GetView<RootLogic> {
@@ -17,35 +15,37 @@ class RootPage extends GetView<RootLogic> {
children: [
Navigator(
key: controller.navigatorKeys[0],
onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[0]),
onGenerateRoute: (settings) =>
GetPageRoute(page: () => controller.pages[0]),
),
Navigator(
key: Get.nestedKey(1),
onGenerateRoute: (settings) {
Widget page;
if (settings.name == ChickenRoutes.outOfProvince) {
page = controller.pages[1];
} else if (settings.name == ChickenRoutes.salesOutOfProvince) {
page = SalesOutOfProvincePage();
} else if (settings.name == ChickenRoutes.buysOutOfProvince) {
page = BuysOutOfProvincePage();
} else {
page = controller.pages[1];
}
return GetPageRoute(page: () => page);
final page = ChickenPages.pages.firstWhere(
(e) => e.name == settings.name,
orElse: () => ChickenPages.pages.firstWhere(
(e) => e.name == ChickenRoutes.outOfProvince,
),
);
return buildRouteFromGetPage(page);
},
),
Navigator(
key: controller.navigatorKeys[2],
onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[2]),
onGenerateRoute: (settings) =>
GetPageRoute(page: () => controller.pages[2]),
),
Navigator(
key: controller.navigatorKeys[3],
onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[3]),
onGenerateRoute: (settings) =>
GetPageRoute(page: () => controller.pages[3]),
),
Navigator(
key: controller.navigatorKeys[4],
onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[4]),
onGenerateRoute: (settings) =>
GetPageRoute(page: () => controller.pages[4]),
),
],
index: data.value,
@@ -106,7 +106,10 @@ class RootPage extends GetView<RootLogic> {
return Container(
height: 70,
width: Get.width / 2,
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
clipBehavior: Clip.hardEdge,
child: Row(
children: [
@@ -127,7 +130,9 @@ class RootPage extends GetView<RootLogic> {
Text(
'بارهای امروز',
textAlign: TextAlign.right,
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
style: AppFonts.yekan14.copyWith(
color: AppColor.blueNormal,
),
),
],
),
@@ -177,19 +182,26 @@ class RootPage extends GetView<RootLogic> {
height: 82,
decoration: BoxDecoration(
color: bgLabelColor,
borderRadius: BorderRadius.only(topRight: Radius.circular(8), bottomRight: Radius.circular(8)),
borderRadius: BorderRadius.only(
topRight: Radius.circular(8),
bottomRight: Radius.circular(8),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 4,
children: [
SvgGenImage.vec(
iconPath,
).svg(width: 24, height: 24, colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn)),
SvgGenImage.vec(iconPath).svg(
width: 24,
height: 24,
colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn),
),
Text(
title,
textAlign: TextAlign.right,
style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive),
style: AppFonts.yekan14.copyWith(
color: AppColor.mediumGreyDarkActive,
),
),
],
),
@@ -200,7 +212,10 @@ class RootPage extends GetView<RootLogic> {
child: Container(
decoration: BoxDecoration(
color: bgDescriptionColor,
borderRadius: BorderRadius.only(topLeft: Radius.circular(8), bottomLeft: Radius.circular(8)),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
bottomLeft: Radius.circular(8),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
@@ -209,12 +224,16 @@ class RootPage extends GetView<RootLogic> {
Text(
description,
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
style: AppFonts.yekan16.copyWith(
color: AppColor.mediumGreyDarkActive,
),
),
Text(
unit,
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
style: AppFonts.yekan12.copyWith(
color: AppColor.mediumGreyDarkActive,
),
),
],
),
@@ -259,17 +278,23 @@ class RootPage extends GetView<RootLogic> {
Text(
title,
textAlign: TextAlign.right,
style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive),
style: AppFonts.yekan14.copyWith(
color: AppColor.mediumGreyDarkActive,
),
),
Text(
description,
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
style: AppFonts.yekan16.copyWith(
color: AppColor.mediumGreyDarkActive,
),
),
Text(
unit,
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
style: AppFonts.yekan12.copyWith(
color: AppColor.mediumGreyDarkActive,
),
),
],
),
@@ -288,9 +313,11 @@ class RootPage extends GetView<RootLogic> {
),
),
child: Center(
child: SvgGenImage.vec(
iconPath,
).svg(width: 24, height: 24, colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn)),
child: SvgGenImage.vec(iconPath).svg(
width: 24,
height: 24,
colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn),
),
),
),
),
@@ -299,7 +326,11 @@ class RootPage extends GetView<RootLogic> {
);
}
Widget widelyUsed({required String title, required String iconPath, required VoidCallback onTap}) {
Widget widelyUsed({
required String title,
required String iconPath,
required VoidCallback onTap,
}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
@@ -311,14 +342,18 @@ class RootPage extends GetView<RootLogic> {
padding: EdgeInsets.all(4),
decoration: ShapeDecoration(
color: const Color(0xFFBECDFF),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child: Container(
width: 40,
height: 40,
decoration: ShapeDecoration(
color: AppColor.blueNormal,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child: SvgGenImage.vec(iconPath).svg(
width: 24,
@@ -328,7 +363,10 @@ class RootPage extends GetView<RootLogic> {
),
),
),
Text(title, style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)),
Text(
title,
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
),
],
);
}
@@ -345,16 +383,24 @@ class RootPage extends GetView<RootLogic> {
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),
),
],
);
}
@@ -501,7 +547,9 @@ class RootPage extends GetView<RootLogic> {
child: Text(
title,
textAlign: TextAlign.right,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
),
Flexible(
@@ -509,7 +557,9 @@ class RootPage extends GetView<RootLogic> {
child: Text(
value,
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
),
],
@@ -535,18 +585,30 @@ class RootPage extends GetView<RootLogic> {
Text(
'اطلاعات ارسالی',
textAlign: TextAlign.right,
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
style: AppFonts.yekan16Bold.copyWith(
color: AppColor.blueNormal,
),
),
const SizedBox(height: 12),
buildRow('فروش و توزیع داخل استان (کیلوگرم)', model.stewardAllocationsWeight!.toInt().toString()),
buildRow('فروش و توزیع خارج استان (کیلوگرم)', model.freeSalesWeight!.toInt().toString()),
buildRow(
'فروش و توزیع داخل استان (کیلوگرم)',
model.stewardAllocationsWeight!.toInt().toString(),
),
buildRow(
'فروش و توزیع خارج استان (کیلوگرم)',
model.freeSalesWeight!.toInt().toString(),
),
],
)
: const Center(child: CircularProgressIndicator()),
);
}
Widget cardWidget({required String title, required String iconPath, required VoidCallback onTap}) {
Widget cardWidget({
required String title,
required String iconPath,
required VoidCallback onTap,
}) {
return Container(
width: Get.width / 4,
height: 130,

View File

@@ -11,8 +11,6 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
Widget build(BuildContext context) {
return Scaffold(
appBar: RAppBar(
title: 'رصدطیور',
iconTitle: Assets.vec.chickenSvg.path,
titleTextStyle: AppFonts.yekan16Bold.copyWith(color: Colors.white),
centerTitle: true,
hasBack: true,
@@ -24,12 +22,18 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
mainAxisSize: MainAxisSize.min,
spacing: 6,
children: [
Assets.vec.cubeSearchSvg.svg(
Assets.vec.chickenSvg.svg(
width: 24,
height: 24,
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
colorFilter: const ColorFilter.mode(
Colors.white,
BlendMode.srcIn,
),
),
Text(
'رصدطیور',
style: AppFonts.yekan16Bold.copyWith(color: Colors.white),
),
Text('خرید خارج استان', style: AppFonts.yekan16Bold.copyWith(color: Colors.white)),
],
),
additionalActions: [
@@ -47,123 +51,182 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
SizedBox(width: 8),
],
),
body: ListView.separated(
padding: EdgeInsets.fromLTRB(8, 8, 18, 80),
itemBuilder: (context, index) {
return ObxValue(
(data) => GestureDetector(
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
routePageWidget(),
saleListWidget(),
],
),
floatingActionButton: RFab.add(onPressed: () {}),
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
);
}
ListView saleListWidget() {
return ListView.separated(
shrinkWrap: true,
padding: EdgeInsets.fromLTRB(8, 8, 18, 80),
itemBuilder: (context, index) {
return ObxValue(
(data) => saleListItem(data, index),
controller.isExpandedList,
);
},
separatorBuilder: (context, index) => SizedBox(height: 8),
itemCount: 5,
);
}
GestureDetector saleListItem(RxList<int> data, int index) {
return GestureDetector(
onTap: () {
if(data.contains(index)){
if (data.contains(index)) {
controller.isExpandedList.remove(index);
}else{
} else {
controller.isExpandedList.add(index);
}
},
child: AnimatedContainer(
duration: Duration(milliseconds: 400),
alignment: Alignment.center,
height: data.contains(index)? 210 : 56,
height: data.contains(index) ? 210 : 56,
child: Stack(
clipBehavior: Clip.none,
alignment: Alignment.centerRight,
children: [
AnimatedContainer(
width: Get.width - 30,
duration: Duration(milliseconds: 400),
duration: Duration(milliseconds: 300),
height: data.contains(index) ? 210 : 56,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 0.5, color: AppColor.darkGreyNormal),
border: Border.all(
width: 0.5,
color: AppColor.darkGreyNormal,
),
),
child: AnimatedCrossFade(
alignment: Alignment.center,
firstChild: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
'1403/5/5',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
style: AppFonts.yekan14.copyWith(
color: AppColor.bgDark,
),
),
Text(
'افلاک',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
style: AppFonts.yekan14.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'kg 200 مرغ گرم ',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
style: AppFonts.yekan14.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'لرستان-خرم آباد',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
style: AppFonts.yekan14.copyWith(
color: AppColor.bgDark,
),
),
Icon(CupertinoIcons.chevron_down,size: 12,)
Icon(CupertinoIcons.chevron_down, size: 12),
],
),
secondChild: Container(
padding: EdgeInsets.fromLTRB(8, 12, 14, 12),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
child: Column(
spacing: 8,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Assets.vec.editSvg.svg(
width: 20,
height: 20,
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
colorFilter: ColorFilter.mode(
AppColor.blueNormal,
BlendMode.srcIn,
),
),
Text(
'لرستان - خرم آباد',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
style: AppFonts.yekan16.copyWith(
color: AppColor.greenDark,
),
),
Assets.vec.trashSvg.svg(
width: 20,
height: 20,
colorFilter: ColorFilter.mode(AppColor.error, BlendMode.srcIn),
colorFilter: ColorFilter.mode(
AppColor.error,
BlendMode.srcIn,
),
),
],
),
Container(
height: 32,
padding: EdgeInsets.symmetric(horizontal: 4),
padding: EdgeInsets.symmetric(
horizontal: 4,
),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1, color: AppColor.blueLightHover),
side: BorderSide(
width: 1,
color: AppColor.blueLightHover,
),
borderRadius: BorderRadius.circular(8),
),
),
child: buildRow('تاریخ', '07:15:00 - 1402/07/01'),
child: buildRow(
'تاریخ',
'07:15:00 - 1402/07/01',
),
),
buildRow('مشخصات فروشنده', 'افلاک - 09203659874'),
buildRow(
'مشخصات فروشنده',
'افلاک - 09203659874',
),
buildRow('وزن خریداری شده', '200 کیلوگرم'),
buildRow('لاشه خریداری شده', '200 عدد'),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Icon(CupertinoIcons.chevron_up,size: 12,)
Icon(CupertinoIcons.chevron_up, size: 12),
],
)
),
],
),
),
crossFadeState: data.contains(index)?CrossFadeState.showSecond:CrossFadeState.showFirst,
duration: Duration(milliseconds: 200),
crossFadeState: data.contains(index)
? CrossFadeState.showSecond
: CrossFadeState.showFirst,
duration: Duration(milliseconds: 300),
),
),
Positioned(
@@ -175,25 +238,58 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
decoration: BoxDecoration(
color: AppColor.greenLightHover,
borderRadius: BorderRadius.circular(4),
border: Border.all(width: 0.50, color: AppColor.greenDarkActive),
border: Border.all(
width: 0.50,
color: AppColor.greenDarkActive,
),
),
alignment: Alignment.center,
child: Text((index + 1).toString(), style: AppFonts.yekan12.copyWith(color: Colors.black)),
child: Text(
(index + 1).toString(),
style: AppFonts.yekan12.copyWith(
color: Colors.black,
),
),
),
),
],
),
),
);
}
Row routePageWidget() {
return Row(
children: [
SizedBox(width: 8),
RichText(
text: TextSpan(
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
children: [
WidgetSpan(
child: Row(
children: [
Assets.vec.cubeSearchSvg.svg(
width: 24,
height: 24,
colorFilter: const ColorFilter.mode(
AppColor.blueNormal,
BlendMode.srcIn,
),
),
SizedBox(width: 6,)
],
),
),
TextSpan(text: 'خارج استان'),
TextSpan(text: '/'),
TextSpan(text: 'خرید'),
],
),
),
controller.isExpandedList,
);
},
separatorBuilder: (context, index) => SizedBox(height: 8),
itemCount: 5,
),
floatingActionButton: RFab.add(onPressed: () {}),
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
);
],
);
}
Widget buildRow(String title, String value) {
@@ -207,7 +303,9 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
child: Text(
title,
textAlign: TextAlign.right,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
),
Flexible(
@@ -215,13 +313,13 @@ class SalesOutOfProvincePage extends GetView<SalesOutOfProvinceLogic> {
child: Text(
value,
textAlign: TextAlign.left,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
style: AppFonts.yekan14.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
),
],
),
);
}
}

View File

@@ -45,3 +45,4 @@ export 'utils/safe_call_utils.dart';
export 'utils/date_time_utils.dart';
export 'utils/num_utils.dart';
export 'utils/map_utils.dart';
export 'utils/route_utils.dart';

View File

@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
class RAppBar extends StatelessWidget implements PreferredSizeWidget {
final String title;
final String? title;
final String? iconTitle;
final Color backgroundColor;
final Color iconColor;
@@ -18,7 +18,7 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
const RAppBar({
super.key,
required this.title,
this.title,
this.iconTitle,
this.backgroundColor = AppColor.blueNormal,
this.iconColor = Colors.white,
@@ -43,15 +43,15 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
centerTitle: centerTitle,
titleTextStyle: titleTextStyle ?? AppFonts.yekan16.copyWith(color: Colors.white),
title: Row(
title:title != null ? Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(title),
Text(title!),
if (iconTitle != null) ...{const SizedBox(width: 8)},
if (iconTitle != null) ...{SvgGenImage.vec(iconTitle!).svg(width: 24, height: 24)},
],
),
): null,
leadingWidth: leadingWidth?.toDouble(),
leading: leading != null ? Padding(padding: const EdgeInsets.only(right: 6), child: leading) : null,
titleSpacing: 8,

View File

@@ -0,0 +1,24 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
GetPageRoute<dynamic> buildRouteFromGetPage(GetPage page) {
return GetPageRoute(
page: page.page,
settings: RouteSettings(name: page.name),
transition: page.transition,
curve: page.curve,
binding: page.binding,
bindings: page.bindings,
routeName: page.name,
title: page.title,
gestureWidth: page.gestureWidth,
alignment: page.alignment,
maintainState: page.maintainState,
customTransition: page.customTransition,
transitionDuration: page.transitionDuration ?? const Duration(milliseconds: 300),
fullscreenDialog: page.fullscreenDialog,
opaque: page.opaque,
popGesture: page.popGesture,
showCupertinoParallax: page.showCupertinoParallax,
);
}