feat : Page Route Widget

This commit is contained in:
2025-06-30 09:33:14 +03:30
parent 443b9f489c
commit 7cec6bd084
2 changed files with 184 additions and 175 deletions

View File

@@ -15,117 +15,119 @@ class HomePage extends GetView<HomeLogic> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColor.bgLight, backgroundColor: AppColor.bgLight,
appBar: chickenAppBar( appBar: chickenAppBar(hasBack: false, hasFilter: false, hasSearch: false),
hasBack: false,
hasFilter: false,
hasSearch: false
),
body: Column( body: Column(
spacing: 8, spacing: 8,
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
controller.isExpanded.value = !controller.isExpanded.value; controller.isExpanded.value = !controller.isExpanded.value;
}, },
child: Card( child: Card(
margin: EdgeInsetsGeometry.all(6), margin: EdgeInsetsGeometry.all(6),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
side: BorderSide(width: 0.50, color: const Color(0xFFA9A9A9)), side: BorderSide(width: 0.50, color: const Color(0xFFA9A9A9)),
), ),
child: ObxValue((data) { child: ObxValue((data) {
return AnimatedSize(duration: Duration(milliseconds: 300), return AnimatedSize(
child: data.value ? Padding( duration: Duration(milliseconds: 300),
padding: const EdgeInsets.all(8.0), child: data.value
child: Column( ? Padding(
mainAxisSize: MainAxisSize.min, padding: const EdgeInsets.all(8.0),
children: [ child: Column(
Row( mainAxisSize: MainAxisSize.min,
spacing: 8,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Container( Row(
width: 40, spacing: 8,
height: 40, crossAxisAlignment: CrossAxisAlignment.center,
decoration: ShapeDecoration( children: [
image: DecorationImage( Container(
image: AssetImage(Assets.images.chicken.path), fit: BoxFit.cover), width: 40,
shape: RoundedRectangleBorder( height: 40,
side: BorderSide(width: 0.25, color: const Color(0xFFB0B0B0)), decoration: ShapeDecoration(
borderRadius: BorderRadius.circular(4), image: DecorationImage(
image: AssetImage(Assets.images.chicken.path),
fit: BoxFit.cover,
),
shape: RoundedRectangleBorder(
side: BorderSide(width: 0.25, color: const Color(0xFFB0B0B0)),
borderRadius: BorderRadius.circular(4),
),
),
), ),
), Text(
'مرغ گرم',
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkActive),
),
Spacer(),
AnimatedRotation(
turns: 180,
duration: Duration(milliseconds: 3000),
child: Icon(CupertinoIcons.chevron_up, size: 18),
),
],
), ),
Text( SizedBox(height: 8),
'مرغ گرم', _todayShipmentWidget(),
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkActive), _inventoryWidget(),
Row(
children: [Text('اطلاعات بارها', textAlign: TextAlign.right, style: AppFonts.yekan16)],
), ),
Spacer(),
AnimatedRotation( _informationShipment(),
turns: 180,
duration: Duration(milliseconds: 3000), Row(
child: Icon(CupertinoIcons.chevron_up, size: 18), children: [Text('اطلاعات توزیع', textAlign: TextAlign.right, style: AppFonts.yekan16)],
),
distributionInformationWidget(),
],
),
)
: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
spacing: 8,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 40,
height: 40,
decoration: ShapeDecoration(
image: DecorationImage(
image: AssetImage(Assets.images.chicken.path),
fit: BoxFit.cover,
),
shape: RoundedRectangleBorder(
side: BorderSide(width: 0.25, color: const Color(0xFFB0B0B0)),
borderRadius: BorderRadius.circular(4),
),
),
),
Text(
'مرغ گرم',
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkActive),
),
Spacer(),
Icon(CupertinoIcons.chevron_down, size: 18),
],
), ),
], ],
), ),
SizedBox(height: 8), ),
_todayShipmentWidget(), );
}, controller.isExpanded),
_inventoryWidget(), ),
),
Row(
children: [Text('اطلاعات بارها', textAlign: TextAlign.right, style: AppFonts.yekan16)],
),
_informationShipment(),
Row(
children: [Text('اطلاعات توزیع', textAlign: TextAlign.right, style: AppFonts.yekan16)],
),
distributionInformationWidget(),
],
),
) : Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
spacing: 8,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 40,
height: 40,
decoration: ShapeDecoration(
image: DecorationImage(
image: AssetImage(Assets.images.chicken.path), fit: BoxFit.cover),
shape: RoundedRectangleBorder(
side: BorderSide(width: 0.25, color: const Color(0xFFB0B0B0)),
borderRadius: BorderRadius.circular(4),
),
),
),
Text(
'مرغ گرم',
textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkActive),
),
Spacer(),
Icon(CupertinoIcons.chevron_down, size: 18),
],
),
],
),
),
);
}, controller.isExpanded),
)),
Padding( Padding(
padding: EdgeInsetsGeometry.all(6), padding: EdgeInsetsGeometry.all(6),
@@ -237,8 +239,8 @@ class HomePage extends GetView<HomeLogic> {
isLoading: data.value == null, isLoading: data.value == null,
description: data.value != null description: data.value != null
? ((data.value?.provinceGovernmentalCarcassesWeight ?? 0) + ? ((data.value?.provinceGovernmentalCarcassesWeight ?? 0) +
(data.value?.provinceFreeCarcassesWeight ?? 0)) (data.value?.provinceFreeCarcassesWeight ?? 0))
.separatedByComma .separatedByComma
: '0', : '0',
iconPath: Assets.vec.a3dCubeSquareSvg.path, iconPath: Assets.vec.a3dCubeSquareSvg.path,
iconColor: const Color(0xFF6C5D60), iconColor: const Color(0xFF6C5D60),
@@ -334,21 +336,21 @@ class HomePage extends GetView<HomeLogic> {
child: data.value == null child: data.value == null
? CupertinoActivityIndicator() ? CupertinoActivityIndicator()
: Column( : Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
spacing: 4, spacing: 4,
children: [ children: [
Text( Text(
data.value.separatedByComma, data.value.separatedByComma,
textAlign: TextAlign.right, textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: AppColor.textColor), style: AppFonts.yekan16.copyWith(color: AppColor.textColor),
), ),
Text( Text(
'کیلوگرم', 'کیلوگرم',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.textColor), style: AppFonts.yekan12.copyWith(color: AppColor.textColor),
), ),
], ],
), ),
), ),
], ],
), ),
@@ -406,21 +408,21 @@ class HomePage extends GetView<HomeLogic> {
child: isLoading child: isLoading
? Center(child: CupertinoActivityIndicator()) ? Center(child: CupertinoActivityIndicator())
: Column( : Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
spacing: 4, spacing: 4,
children: [ children: [
Text( Text(
description, description,
textAlign: TextAlign.right, textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive), style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
), ),
Text( Text(
unit, unit,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive), style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
), ),
], ],
), ),
), ),
), ),
], ],
@@ -469,10 +471,10 @@ class HomePage extends GetView<HomeLogic> {
isLoading isLoading
? Center(child: CupertinoActivityIndicator()) ? Center(child: CupertinoActivityIndicator())
: Text( : Text(
description, description,
textAlign: TextAlign.right, textAlign: TextAlign.right,
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive), style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
), ),
Text( Text(
unit, unit,
textAlign: TextAlign.center, textAlign: TextAlign.center,
@@ -508,38 +510,39 @@ class HomePage extends GetView<HomeLogic> {
Widget widelyUsed({required String title, required String iconPath, required VoidCallback onTap}) { Widget widelyUsed({required String title, required String iconPath, required VoidCallback onTap}) {
return GestureDetector( return GestureDetector(
onTap: onTap, onTap: onTap,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
spacing: 4, spacing: 4,
children: [ children: [
Container( Container(
width: 48, width: 48,
height: 48, height: 48,
padding: EdgeInsets.all(4), padding: EdgeInsets.all(4),
decoration: ShapeDecoration(
color: const Color(0xFFBECDFF),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
child: Container(
width: 40,
height: 40,
decoration: ShapeDecoration( decoration: ShapeDecoration(
color: const Color(0xFFBECDFF), color: AppColor.blueNormal,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
), ),
child: Container( child: SvgGenImage.vec(iconPath).svg(
width: 40, width: 24,
height: 40, height: 24,
decoration: ShapeDecoration( colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
color: AppColor.blueNormal, fit: BoxFit.cover,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
child: SvgGenImage.vec(iconPath).svg(
width: 24,
height: 24,
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
fit: BoxFit.cover,
),
), ),
), ),
Text(title, style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)), ),
], Text(title, style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)),
)); ],
),
);
} }
Widget addWidelyUsed({required VoidCallback onTap}) { Widget addWidelyUsed({required VoidCallback onTap}) {
@@ -631,19 +634,19 @@ class HomePage extends GetView<HomeLogic> {
), ),
child: model != null child: model != null
? Column( ? Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
spacing: 10, spacing: 10,
children: [ children: [
Text( Text(
'اطلاعات ارسالی', 'اطلاعات ارسالی',
textAlign: TextAlign.right, textAlign: TextAlign.right,
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal), style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
buildRow('فروش و توزیع داخل استان (کیلوگرم)', model.stewardAllocationsWeight!.toInt().toString()), buildRow('فروش و توزیع داخل استان (کیلوگرم)', model.stewardAllocationsWeight!.toInt().toString()),
buildRow('فروش و توزیع خارج استان (کیلوگرم)', model.freeSalesWeight!.toInt().toString()), buildRow('فروش و توزیع خارج استان (کیلوگرم)', model.freeSalesWeight!.toInt().toString()),
], ],
) )
: const Center(child: CircularProgressIndicator()), : const Center(child: CircularProgressIndicator()),
); );
} }

View File

@@ -0,0 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:rasadyar_core/core.dart';
Text buildPageRoute(List<String> route) {
return Text(route.isEmpty ? 'خانه' : route.join("/"), style: AppFonts.yekan14.copyWith(color: AppColor.bgDark));
}