feat : home page
This commit is contained in:
@@ -2,7 +2,6 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/inventory/inventory_model.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/kill_house_distribution_info/kill_house_distribution_info.dart';
|
||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
@@ -70,111 +69,19 @@ class HomePage extends GetView<HomeLogic> {
|
||||
SizedBox(height: 8),
|
||||
_todayShipmentWidget(),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 10, 0, 13),
|
||||
child: Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Expanded(
|
||||
child: _informationLabelCard(
|
||||
title: 'مانده انبار',
|
||||
description: '2،225،256',
|
||||
iconPath: Assets.vec.cubeSearchSvg.path,
|
||||
iconColor: const Color(0xFF426060),
|
||||
bgDescriptionColor: const Color(0xFFC7DFE0),
|
||||
bgLabelColor: const Color(0xFFA5D1D2),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _informationLabelCard(
|
||||
title: 'توزیع شده',
|
||||
description: '2،225،256',
|
||||
iconPath: Assets.vec.cubeRotateSvg.path,
|
||||
iconColor: Color(0xFF5C4D64),
|
||||
bgLabelColor: Color(0xFFC8B8D1),
|
||||
bgDescriptionColor: Color(0xFFDAD4DD),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
_inventoryWidget(),
|
||||
|
||||
Row(
|
||||
children: [Text('اطلاعات بارها', textAlign: TextAlign.right, style: AppFonts.yekan16)],
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 13),
|
||||
child: Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Expanded(
|
||||
child: _informationLabelCard(
|
||||
title: 'داخل استان',
|
||||
description: '2،225،256',
|
||||
iconPath: Assets.vec.a3dCubeSquareSvg.path,
|
||||
iconColor: const Color(0xFF6C5D60),
|
||||
bgDescriptionColor: const Color(0xFFEDDCE0),
|
||||
bgLabelColor: const Color(0xFFDDC0C7),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _informationLabelCard(
|
||||
title: 'خارج استان',
|
||||
description: '2،225،256',
|
||||
iconPath: Assets.vec.cubeSearchSvg.path,
|
||||
iconColor: Color(0xFF2D5FFF),
|
||||
bgLabelColor: const Color(0xFFAFCBFF),
|
||||
bgDescriptionColor: const Color(0xFFCEDFFF),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
_informationShipment(),
|
||||
|
||||
Row(
|
||||
children: [Text('اطلاعات توزیع', textAlign: TextAlign.right, style: AppFonts.yekan16)],
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 13),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 8,
|
||||
children: [
|
||||
Expanded(
|
||||
child: _informationIconCard(
|
||||
title: 'توزیع داخل استان',
|
||||
description: '2،225،256',
|
||||
iconPath: Assets.vec.truckSvg.path,
|
||||
iconColor: const Color.fromRGBO(85, 97, 93, 1),
|
||||
bgDescriptionColor: const Color(0xFFE6FAF5),
|
||||
bgLabelColor: const Color(0xFFB0EFDF),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _informationIconCard(
|
||||
title: 'توزیع خارج استان',
|
||||
description: '2،225،256',
|
||||
iconPath: Assets.vec.truckFastSvg.path,
|
||||
iconColor: Color(0xFF647379),
|
||||
bgDescriptionColor: const Color(0xFFEAEFFF),
|
||||
bgLabelColor: const Color(0xFFD4DEFF),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _informationIconCard(
|
||||
title: 'قطعه بندی',
|
||||
description: '2،225،256',
|
||||
iconPath: Assets.vec.convertCubeSvg.path,
|
||||
iconColor: const Color(0xFF6F6164),
|
||||
bgDescriptionColor: const Color(0xFFEDDCE0),
|
||||
bgLabelColor: const Color(0xFFE0BCC5),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
distributionInformationWidget(),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -226,64 +133,190 @@ class HomePage extends GetView<HomeLogic> {
|
||||
),
|
||||
);
|
||||
}
|
||||
Container _todayShipmentWidget() {
|
||||
return Container(
|
||||
height: 70,
|
||||
width: Get.width / 2,
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [const Color(0xFFEAEFFF), Colors.white],
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 4,
|
||||
children: [
|
||||
Assets.icons.cubeScan.svg(width: 30, height: 30),
|
||||
Text(
|
||||
'بارهای امروز',
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
],
|
||||
|
||||
Widget distributionInformationWidget() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 13),
|
||||
child: ObxValue((data) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 8,
|
||||
children: [
|
||||
Expanded(
|
||||
child: _informationIconCard(
|
||||
title: 'توزیع داخل استان',
|
||||
isLoading: data.value == null,
|
||||
description: data.value?.freeSalesWeight.toFormatted ?? '0',
|
||||
iconPath: Assets.vec.truckSvg.path,
|
||||
iconColor: const Color.fromRGBO(85, 97, 93, 1),
|
||||
bgDescriptionColor: const Color(0xFFE6FAF5),
|
||||
bgLabelColor: const Color(0xFFB0EFDF),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 4,
|
||||
children: [
|
||||
Text(
|
||||
'2،225،256',
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
Text(
|
||||
'کیلوگرم',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
],
|
||||
Expanded(
|
||||
child: _informationIconCard(
|
||||
title: 'توزیع خارج استان',
|
||||
isLoading: data.value == null,
|
||||
description: data.value?.stewardAllocationsWeight.toFormatted ?? '0',
|
||||
iconPath: Assets.vec.truckFastSvg.path,
|
||||
iconColor: Color(0xFF647379),
|
||||
bgDescriptionColor: const Color(0xFFEAEFFF),
|
||||
bgLabelColor: const Color(0xFFD4DEFF),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: _informationIconCard(
|
||||
title: 'قطعه بندی',
|
||||
description: '2،225،256',
|
||||
iconPath: Assets.vec.convertCubeSvg.path,
|
||||
iconColor: const Color(0xFF6F6164),
|
||||
bgDescriptionColor: const Color(0xFFEDDCE0),
|
||||
bgLabelColor: const Color(0xFFE0BCC5),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}, controller.killHouseDistributionInfo),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _informationShipment() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 13),
|
||||
child: ObxValue((data) {
|
||||
return Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Expanded(
|
||||
child: _informationLabelCard(
|
||||
title: 'داخل استان',
|
||||
isLoading: data.value == null,
|
||||
description: data.value != null
|
||||
? ((data.value?.provinceGovernmentalCarcassesWeight ?? 0) +
|
||||
(data.value?.provinceFreeCarcassesWeight ?? 0))
|
||||
.toFormatted
|
||||
: '0',
|
||||
iconPath: Assets.vec.a3dCubeSquareSvg.path,
|
||||
iconColor: const Color(0xFF6C5D60),
|
||||
bgDescriptionColor: const Color(0xFFEDDCE0),
|
||||
bgLabelColor: const Color(0xFFDDC0C7),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _informationLabelCard(
|
||||
title: 'خارج استان',
|
||||
isLoading: data.value == null,
|
||||
description: data.value?.freeBuyingCarcassesWeight.toFormatted ?? '0',
|
||||
iconPath: Assets.vec.cubeSearchSvg.path,
|
||||
iconColor: Color(0xFF2D5FFF),
|
||||
bgLabelColor: const Color(0xFFAFCBFF),
|
||||
bgDescriptionColor: const Color(0xFFCEDFFF),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}, controller.inventoryModel),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _inventoryWidget() {
|
||||
return ObxValue((data) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 10, 0, 13),
|
||||
child: Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Expanded(
|
||||
child: _informationLabelCard(
|
||||
title: 'مانده انبار',
|
||||
isLoading: data.value == null,
|
||||
description: data.value?.totalRemainWeight.toFormatted ?? '0',
|
||||
iconPath: Assets.vec.cubeSearchSvg.path,
|
||||
iconColor: const Color(0xFF426060),
|
||||
bgDescriptionColor: const Color(0xFFC7DFE0),
|
||||
bgLabelColor: const Color(0xFFA5D1D2),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _informationLabelCard(
|
||||
title: 'توزیع شده',
|
||||
isLoading: data.value == null,
|
||||
description: data.value?.realAllocatedWeight.toFormatted ?? '0',
|
||||
iconPath: Assets.vec.cubeRotateSvg.path,
|
||||
iconColor: Color(0xFF5C4D64),
|
||||
bgLabelColor: Color(0xFFC8B8D1),
|
||||
bgDescriptionColor: Color(0xFFDAD4DD),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}, controller.inventoryModel);
|
||||
}
|
||||
|
||||
Widget _todayShipmentWidget() {
|
||||
return ObxValue((data) {
|
||||
return Container(
|
||||
height: 70,
|
||||
width: Get.width / 2,
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [const Color(0xFFEAEFFF), Colors.white],
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 4,
|
||||
children: [
|
||||
Assets.icons.cubeScan.svg(width: 30, height: 30),
|
||||
Text(
|
||||
'بارهای امروز',
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: data.value == null
|
||||
? CupertinoActivityIndicator()
|
||||
: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 4,
|
||||
children: [
|
||||
Text(
|
||||
data.value.toFormatted,
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
Text(
|
||||
'کیلوگرم',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.textColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}, controller.totalWeightTodayBars);
|
||||
}
|
||||
|
||||
Container _informationLabelCard({
|
||||
required String title,
|
||||
required String description,
|
||||
String unit = 'کیلوگرم',
|
||||
bool isLoading = false,
|
||||
required String iconPath,
|
||||
required Color iconColor,
|
||||
required Color bgDescriptionColor,
|
||||
@@ -326,22 +359,24 @@ class HomePage extends GetView<HomeLogic> {
|
||||
color: bgDescriptionColor,
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(8), bottomLeft: Radius.circular(8)),
|
||||
),
|
||||
child: 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),
|
||||
),
|
||||
],
|
||||
),
|
||||
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),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -353,6 +388,7 @@ class HomePage extends GetView<HomeLogic> {
|
||||
required String title,
|
||||
required String description,
|
||||
String unit = 'کیلوگرم',
|
||||
bool isLoading = false,
|
||||
required String iconPath,
|
||||
required Color iconColor,
|
||||
required Color bgDescriptionColor,
|
||||
@@ -385,11 +421,14 @@ class HomePage extends GetView<HomeLogic> {
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||
),
|
||||
Text(
|
||||
description,
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||
),
|
||||
|
||||
isLoading
|
||||
? Center(child: CupertinoActivityIndicator())
|
||||
: Text(
|
||||
description,
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||
),
|
||||
Text(
|
||||
unit,
|
||||
textAlign: TextAlign.center,
|
||||
@@ -483,7 +522,7 @@ class HomePage extends GetView<HomeLogic> {
|
||||
);
|
||||
}
|
||||
|
||||
/* Column oldPage() {
|
||||
/* Column oldPage() {
|
||||
return Column(
|
||||
children: [
|
||||
inventoryWidget(),
|
||||
@@ -652,19 +691,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()),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user