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