1008 lines
35 KiB
Dart
1008 lines
35 KiB
Dart
import 'package:flutter/cupertino.dart' hide LinearGradient;
|
|
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/widget/base_page/view.dart';
|
|
import 'package:rasadyar_chicken/presentation/widget/steward/widely_used/view.dart';
|
|
import 'package:rasadyar_core/core.dart';
|
|
import 'package:rasadyar_core/presentation/widget/error_widget.dart';
|
|
|
|
import 'logic.dart';
|
|
|
|
class HomePage extends GetView<HomeLogic> {
|
|
const HomePage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ChickenBasePage(
|
|
scrollable: true,
|
|
isBase: true,
|
|
onRefresh: controller.refreshData,
|
|
child: SingleChildScrollView(
|
|
padding: EdgeInsets.only(bottom: 100.h),
|
|
child: Column(
|
|
children: [
|
|
SizedBox(height: 18.h),
|
|
mainInformation(),
|
|
SizedBox(height: 8.h),
|
|
WidelyUsedWidget(),
|
|
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget buildColumn(Widget widget, String title) {
|
|
|
|
return Container(
|
|
height: 70.h,
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
spacing: 8, children: [widget, Text(title)]));
|
|
}
|
|
|
|
InkWell mainInformation() {
|
|
return 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
|
|
? Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Row(
|
|
spacing: 8,
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [
|
|
AnimatedRotation(
|
|
turns: 180,
|
|
duration: Duration(milliseconds: 3000),
|
|
child: Icon(CupertinoIcons.chevron_up, size: 18),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: 8),
|
|
_todayShipmentWidget(),
|
|
_todayShipmentWidget2(),
|
|
_inventoryWidget(),
|
|
_inventoryListWidget(),
|
|
SizedBox(height: 8),
|
|
broadCastList(),
|
|
SizedBox(height: 8),
|
|
commitmentsList(),
|
|
],
|
|
),
|
|
)
|
|
: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Row(
|
|
spacing: 8,
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [Icon(CupertinoIcons.chevron_down, size: 18)],
|
|
),
|
|
_todayShipmentWidget(),
|
|
_todayShipmentWidget2(),
|
|
_inventoryWidget(),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}, controller.isExpanded),
|
|
),
|
|
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: 24.w,
|
|
height: 24.h,
|
|
colorFilter: ColorFilter.mode(AppColor.blueDark, BlendMode.srcIn),
|
|
),
|
|
Text(
|
|
'اطلاعات مرغ گرم',
|
|
textAlign: TextAlign.right,
|
|
style: AppFonts.yekan16Bold.copyWith(color: AppColor.iconColor),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
//todo
|
|
Widget broadCastList() {
|
|
return ObxValue((data) {
|
|
return Column(
|
|
children: [
|
|
Row(
|
|
children: [
|
|
SizedBox(width: 5.w),
|
|
Text('اطلاعات پخش', textAlign: TextAlign.right, style: AppFonts.yekan16),
|
|
],
|
|
),
|
|
SizedBox(height: 8.h),
|
|
Row(
|
|
spacing: 8,
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
Expanded(
|
|
child: broadcastItem(
|
|
title: 'وزن دولتی',
|
|
titleBgColor: const Color(0xFFB8E7DC),
|
|
valueBgColor: const Color(0xFFE6FAF5),
|
|
value: data.value?.totalGovernmentalInputWeight.separatedByComma,
|
|
),
|
|
),
|
|
Expanded(
|
|
child: broadcastItem(
|
|
title: 'وزن آزاد',
|
|
value: data.value?.totalFreeInputWeight.separatedByComma,
|
|
titleBgColor: const Color(0xFFDDE2F0),
|
|
valueBgColor: const Color(0xFFEAEFFF),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: broadcastItem(
|
|
title: 'فروش دولتی',
|
|
value: data.value?.totalGovernmentalOutputWeight.separatedByComma,
|
|
titleBgColor: const Color(0xFFEBC4CE),
|
|
valueBgColor: const Color(0xFFEDDCE0),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: broadcastItem(
|
|
title: 'فروش آزاد',
|
|
value: data.value?.totalFreeOutputWeight.separatedByComma,
|
|
titleBgColor: const Color(0xFFC2D3F2),
|
|
valueBgColor: const Color(0xFFECF2FF),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
|
|
SizedBox(height: 8.h),
|
|
Row(
|
|
spacing: 8,
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
Expanded(
|
|
child: broadcastItem(
|
|
title: 'مانده دولتی',
|
|
value: data.value?.totalGovernmentalRemainWeight.separatedByComma,
|
|
titleBgColor: const Color(0xFFB8E7DC),
|
|
valueBgColor: const Color(0xFFE6FAF5),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: broadcastItem(
|
|
title: 'مانده آزاد',
|
|
value: data.value?.totalFreeRemainWeight.separatedByComma,
|
|
titleBgColor: const Color(0xFFDDE2F0),
|
|
valueBgColor: const Color(0xFFEAEFFF),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: broadcastItem(
|
|
title: 'فروش خارج استان',
|
|
value: data.value?.totalStewardFreeSaleBarCarcassesWeight.separatedByComma,
|
|
titleBgColor: const Color(0xFFEBC4CE),
|
|
valueBgColor: const Color(0xFFEDDCE0),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
);
|
|
}, controller.rootLogic.stewardSalesInfoDashboard);
|
|
}
|
|
|
|
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.separatedByCommaFa ?? '0',
|
|
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: 'توزیع خارج استان',
|
|
isLoading: data.value == null,
|
|
description: data.value?.stewardAllocationsWeight.separatedByCommaFa ?? '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))
|
|
.separatedByCommaFa
|
|
: '0',
|
|
iconPath: Assets.vec.cubeSvg.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.separatedByCommaFa ?? '0',
|
|
iconPath: Assets.vec.cubeSearchSvg.path,
|
|
iconColor: Color(0xFF2D5FFF),
|
|
bgLabelColor: const Color(0xFFAFCBFF),
|
|
bgDescriptionColor: const Color(0xFFCEDFFF),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}, controller.rootLogic.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.separatedByCommaFa ?? '0',
|
|
iconPath: Assets.vec.cubeSearchSvg.path,
|
|
bgDescriptionColor: const Color(0xFFEAEFFF),
|
|
bgLabelColor: const Color(0xFFBDD4FF),
|
|
iconColor: AppColor.textColor,
|
|
),
|
|
),
|
|
Expanded(
|
|
child: _informationLabelCard(
|
|
title: 'توزیع شده',
|
|
isLoading: data.value == null,
|
|
description: data.value?.realAllocatedWeight.separatedByCommaFa ?? '0',
|
|
iconPath: Assets.vec.cubeRotateSvg.path,
|
|
iconColor: Color(0xFF5C4D64),
|
|
bgLabelColor: Color(0xFFC8B8D1),
|
|
bgDescriptionColor: Color(0xFFDAD4DD),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}, controller.rootLogic.inventoryModel);
|
|
}
|
|
|
|
Widget _todayShipmentWidget() {
|
|
return Padding(
|
|
padding: const EdgeInsets.fromLTRB(0, 10, 0, 13),
|
|
child: Row(
|
|
spacing: 8,
|
|
children: [
|
|
Expanded(
|
|
child: ObxValue(
|
|
(data) => _informationLabelCard(
|
|
title: 'بارهای امروز',
|
|
titleColor: AppColor.textColor,
|
|
borderColor: Color(0xFFFFAE00),
|
|
isLoading: data.value == null,
|
|
description: data.value?.separatedByCommaFa ?? '0',
|
|
icon: Container(
|
|
width: 24.w,
|
|
height: 24.h,
|
|
padding: EdgeInsets.all(2),
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFFFFAE00),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Assets.vec.cubeScanSvg.svg(
|
|
width: 12.w,
|
|
height: 12.h,
|
|
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
|
),
|
|
),
|
|
bgDescriptionColor: Colors.white,
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [const Color(0xFFFFD883), const Color(0xFFFFFBF1)],
|
|
),
|
|
),
|
|
controller.totalWeightTodayBars,
|
|
),
|
|
),
|
|
|
|
Expanded(
|
|
child: ObxValue((data) {
|
|
return _informationLabelCard(
|
|
title: 'درانتظار',
|
|
borderColor: const Color(0xFF9758FF),
|
|
isLoading: data.value == null,
|
|
description: data.value?.totalNotEnteredBars.separatedByCommaFa ?? '0',
|
|
unit:
|
|
'(${data.value?.totalNotEnteredKillHouseRequestsWeight.separatedByCommaFa})\nکیلوگرم',
|
|
icon: Container(
|
|
width: 24.w,
|
|
height: 24.h,
|
|
padding: EdgeInsets.all(2),
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFF9758FF),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Assets.vec.cubeCardFreeSvg.svg(
|
|
width: 12.w,
|
|
height: 12.h,
|
|
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
|
),
|
|
),
|
|
bgDescriptionColor: Colors.white,
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [const Color(0xFFD8C1FF), const Color(0xFFFBF9FF)],
|
|
),
|
|
);
|
|
}, controller.barInformation),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _todayShipmentWidget2() {
|
|
return ObxValue((data) {
|
|
return Padding(
|
|
padding: const EdgeInsets.fromLTRB(0, 10, 0, 13),
|
|
child: Row(
|
|
spacing: 8,
|
|
children: [
|
|
Expanded(
|
|
child: _informationLabelCard(
|
|
title: 'مانده دولتی',
|
|
titleColor: AppColor.blueNormal,
|
|
isLoading: data.value == null,
|
|
description: data.value?.totalGovernmentalRemainWeight?.separatedByCommaFa ?? '0',
|
|
iconPath: Assets.vec.cubeCardGovermentSvg.path,
|
|
iconColor: AppColor.textColor,
|
|
bgDescriptionColor: const Color(0xFFF5ECEE),
|
|
bgLabelColor: const Color(0xFFDEC1C7),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: _informationLabelCard(
|
|
title: 'مانده آزاد',
|
|
isLoading: data.value == null,
|
|
description: data.value?.totalFreeRemainWeight.separatedByCommaFa ?? '0',
|
|
unit: 'کیلوگرم',
|
|
iconPath: Assets.vec.cubeCardFreeSvg.path,
|
|
iconColor: AppColor.textColor,
|
|
bgDescriptionColor: const Color(0xFFD0ECED),
|
|
bgLabelColor: const Color(0xFFA5D1D2),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}, controller.rootLogic.stewardSalesInfoDashboard);
|
|
}
|
|
|
|
Widget _inventoryListWidget() {
|
|
return ObxValue((data) {
|
|
var model = data[0];
|
|
return Container(
|
|
padding: EdgeInsets.fromLTRB(16.w, 0, 11.w, 0),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(8),
|
|
color: const Color(0xB2EDF1FF),
|
|
),
|
|
alignment: Alignment.center,
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
inventoryListItem(
|
|
title: 'خریدهای دولتی داخل استان',
|
|
value: model.receiveGovernmentalCarcassesWeight.separatedByComma,
|
|
),
|
|
Divider(),
|
|
inventoryListItem(
|
|
title: 'خریدهای آزاد داخل استان',
|
|
value: model.receiveFreeCarcassesWeight?.separatedByComma,
|
|
),
|
|
Divider(),
|
|
inventoryListItem(
|
|
title: 'وزن خریدهای خارج استان',
|
|
value: model.freeBuyingCarcassesWeight?.separatedByComma,
|
|
),
|
|
Divider(),
|
|
inventoryListItem(
|
|
title: 'کل ورودی به انبار',
|
|
value: model.totalCarcassesWeight?.separatedByComma,
|
|
),
|
|
Divider(),
|
|
|
|
inventoryListItem(title: 'کل فروش', value: model.realAllocatedWeight?.separatedByComma),
|
|
Divider(),
|
|
inventoryListItem(
|
|
title: 'مانده انبار',
|
|
value: model.totalRemainWeight?.separatedByComma,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}, controller.rootLogic.rolesProductsModel);
|
|
}
|
|
|
|
Widget inventoryListItem({required String title, required String? value}) {
|
|
return Container(
|
|
height: 45.h,
|
|
child: Row(
|
|
children: [
|
|
Text(
|
|
title,
|
|
style: AppFonts.yekan14.copyWith(color: const Color(0xFF353535), height: 1.2),
|
|
),
|
|
Spacer(),
|
|
value == null
|
|
? Center(child: CupertinoActivityIndicator())
|
|
: Text(value, style: AppFonts.yekan14.copyWith(color: const Color(0xFF353535))),
|
|
SizedBox(width: 20.w),
|
|
Text('کیلوگرم', style: AppFonts.yekan10.copyWith(color: const Color(0xFF353535))),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Container _informationLabelCard({
|
|
required String title,
|
|
required String description,
|
|
required Color bgDescriptionColor,
|
|
String? iconPath,
|
|
Widget? icon,
|
|
Color? borderColor,
|
|
String unit = 'کیلوگرم',
|
|
bool isLoading = false,
|
|
Color? iconColor,
|
|
Color? titleColor,
|
|
Color? bgLabelColor,
|
|
LinearGradient? gradient,
|
|
}) {
|
|
return Container(
|
|
height: 65.h,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(8),
|
|
border: borderColor != null ? Border.all(width: 1, color: borderColor) : null,
|
|
),
|
|
clipBehavior: Clip.hardEdge,
|
|
child: Row(
|
|
children: [
|
|
// Left side with icon and title
|
|
Expanded(
|
|
child: Container(
|
|
height: 82,
|
|
decoration: BoxDecoration(
|
|
color: gradient == null ? bgLabelColor : null,
|
|
borderRadius: BorderRadius.only(
|
|
topRight: Radius.circular(8),
|
|
bottomRight: Radius.circular(8),
|
|
),
|
|
gradient: gradient,
|
|
),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
spacing: 5,
|
|
children: [
|
|
icon ??
|
|
SvgGenImage.vec(iconPath!).svg(
|
|
width: 24.w,
|
|
height: 24.h,
|
|
colorFilter: iconColor != null
|
|
? ColorFilter.mode(iconColor, BlendMode.srcIn)
|
|
: null,
|
|
),
|
|
Text(
|
|
title,
|
|
textAlign: TextAlign.right,
|
|
style: AppFonts.yekan14.copyWith(
|
|
color: titleColor ?? AppColor.mediumGreyDarkActive,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
// Right side with description and unit
|
|
Expanded(
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
color: bgDescriptionColor,
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(8),
|
|
bottomLeft: Radius.circular(8),
|
|
),
|
|
),
|
|
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),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Container _informationIconCard({
|
|
required String title,
|
|
required String description,
|
|
String unit = 'کیلوگرم',
|
|
bool isLoading = false,
|
|
required String iconPath,
|
|
required Color iconColor,
|
|
required Color bgDescriptionColor,
|
|
required Color bgLabelColor,
|
|
}) {
|
|
return Container(
|
|
height: 110,
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(8)),
|
|
clipBehavior: Clip.hardEdge,
|
|
child: Stack(
|
|
alignment: Alignment.topCenter,
|
|
children: [
|
|
Positioned(
|
|
bottom: 0,
|
|
right: 0,
|
|
left: 0,
|
|
child: Container(
|
|
height: 91,
|
|
decoration: BoxDecoration(
|
|
color: bgDescriptionColor,
|
|
borderRadius: BorderRadius.circular(8),
|
|
border: Border.all(width: 0.25, color: const Color(0xFFB4B4B4)),
|
|
),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
spacing: 4,
|
|
children: [
|
|
Text(
|
|
title,
|
|
textAlign: TextAlign.right,
|
|
style: AppFonts.yekan14.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,
|
|
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Positioned(
|
|
top: 0,
|
|
child: Container(
|
|
width: 32,
|
|
height: 32,
|
|
decoration: ShapeDecoration(
|
|
color: bgLabelColor,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(30),
|
|
side: BorderSide(width: 0.25, color: const Color(0xFFD5D5D5)),
|
|
),
|
|
),
|
|
child: Center(
|
|
child: SvgGenImage.vec(iconPath).svg(
|
|
width: 24,
|
|
height: 24,
|
|
colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget inventoryItem({
|
|
required bool isExpanded,
|
|
required int index,
|
|
required InventoryModel model,
|
|
}) {
|
|
return Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
spacing: 8,
|
|
children: [
|
|
buildRow('نام محصول', model.name ?? ''),
|
|
Visibility(
|
|
visible: isExpanded,
|
|
child: Column(
|
|
spacing: 8,
|
|
children: [
|
|
buildRow('وزن خریدهای دولتی داخل استان (کیلوگرم)', '0326598653'),
|
|
buildRow(
|
|
'وزن خریدهای آزاد داخل استان (کیلوگرم)',
|
|
model.receiveFreeCarcassesWeight.toString(),
|
|
),
|
|
buildRow(
|
|
'وزن خریدهای خارج استان (کیلوگرم)',
|
|
model.freeBuyingCarcassesWeight.toString(),
|
|
),
|
|
buildRow(
|
|
'کل ورودی به انبار (کیلوگرم)',
|
|
model.totalFreeBarsCarcassesWeight.toString(),
|
|
),
|
|
buildRow('کل فروش (کیلوگرم)', model.realAllocatedWeight.toString()),
|
|
buildRow('مانده انبار (کیلوگرم)', model.totalRemainWeight.toString()),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget buildRow(String title, String value) {
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Flexible(
|
|
flex: 2,
|
|
child: Text(
|
|
title,
|
|
textAlign: TextAlign.right,
|
|
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
|
),
|
|
),
|
|
Flexible(
|
|
flex: 1,
|
|
child: Text(
|
|
value,
|
|
textAlign: TextAlign.center,
|
|
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget broadcastInformationWidget(KillHouseDistributionInfo? model) {
|
|
return Container(
|
|
height: 140,
|
|
margin: const EdgeInsets.all(8),
|
|
padding: const EdgeInsets.all(12),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(8),
|
|
border: Border.all(color: AppColor.blueNormal, width: 1),
|
|
),
|
|
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(),
|
|
),
|
|
],
|
|
)
|
|
: const Center(child: CircularProgressIndicator()),
|
|
);
|
|
}
|
|
|
|
Widget broadcastItem({
|
|
int? width,
|
|
int? height,
|
|
String? title,
|
|
String? value,
|
|
String? unit,
|
|
Color? titleBgColor,
|
|
Color? valueBgColor,
|
|
Color? unitBgColor,
|
|
TextStyle? titleStyle,
|
|
TextStyle? valueStyle,
|
|
TextStyle? unitStyle,
|
|
}) {
|
|
return Container(
|
|
height: height?.h ?? 73.h,
|
|
clipBehavior: Clip.hardEdge,
|
|
decoration: BoxDecoration(color: valueBgColor, borderRadius: BorderRadius.circular(8)),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
Container(
|
|
padding: EdgeInsets.symmetric(vertical: 4.h),
|
|
decoration: BoxDecoration(color: titleBgColor),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text(
|
|
title ?? 'بدون تیتر',
|
|
textAlign: TextAlign.center,
|
|
style: titleStyle ?? AppFonts.yekan12.copyWith(color: const Color(0xFF3E3E3E)),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(height: 4),
|
|
|
|
(value != null)
|
|
? Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 11.0),
|
|
child: Text(
|
|
value,
|
|
textAlign: TextAlign.right,
|
|
style: valueStyle ?? AppFonts.yekan14.copyWith(color: AppColor.textColor),
|
|
),
|
|
)
|
|
: Center(child: CupertinoActivityIndicator()),
|
|
|
|
Text(
|
|
unit ?? 'کیلوگرم',
|
|
textAlign: TextAlign.center,
|
|
style: unitStyle ?? AppFonts.yekan10.copyWith(color: Color(0xFF717171)),
|
|
),
|
|
SizedBox(height: 4.h),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget cardWidget({
|
|
required String title,
|
|
required String iconPath,
|
|
required VoidCallback onTap,
|
|
}) {
|
|
return Container(
|
|
width: Get.width / 4,
|
|
height: 130,
|
|
child: GestureDetector(
|
|
onTap: onTap,
|
|
child: Card(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
side: BorderSide(width: 1, color: AppColor.blueNormal),
|
|
),
|
|
child: Padding(
|
|
padding: EdgeInsets.all(16),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
SvgGenImage(iconPath).svg(width: 50, height: 50),
|
|
SizedBox(height: 4),
|
|
Text(
|
|
title,
|
|
textAlign: TextAlign.center,
|
|
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget commitmentsList() {
|
|
return ObxValue((data) {
|
|
return Column(
|
|
spacing: 2.h,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
SizedBox(width: 5.w),
|
|
Text('تعهدات', textAlign: TextAlign.right, style: AppFonts.yekan16),
|
|
],
|
|
),
|
|
|
|
commitmentsItemList(
|
|
title: 'تعهد دولتی توزیع داخل استان',
|
|
value: data.value?.totalCommitmentSellingInProvinceGovernmentalWeight.separatedByComma,
|
|
labelColor: const Color(0xFFB9E8DC),
|
|
bgColor: const Color(0xFFF3F9F8),
|
|
),
|
|
commitmentsItemList(
|
|
title: 'توزیع دولتی داخل استان',
|
|
value: data.value?.totalSellingInProvinceGovernmentalWeight.separatedByComma,
|
|
labelColor: const Color(0xFFC3D4F3),
|
|
bgColor: const Color(0xFFECF3FF),
|
|
),
|
|
commitmentsItemList(
|
|
title: 'باقیمانده تعهد دولتی توزیع داخل استان',
|
|
value: data
|
|
.value
|
|
?.totalCommitmentSellingInProvinceGovernmentalRemainWeight
|
|
.separatedByComma,
|
|
labelColor: const Color(0xFFEBC5CE),
|
|
bgColor: const Color(0xFFFFF1F4),
|
|
),
|
|
commitmentsItemList(
|
|
title: 'تعهد آزاد توزیع داخل استان',
|
|
value: data.value?.totalCommitmentSellingInProvinceFreeWeight.separatedByComma,
|
|
labelColor: const Color(0xFFC7DADA),
|
|
bgColor: const Color(0xFFE5F7F7),
|
|
),
|
|
commitmentsItemList(
|
|
title: 'توزیع آزاد داخل استان',
|
|
value: data.value?.totalSellingInProvinceFreeWeight.separatedByComma,
|
|
labelColor: const Color(0xFFE0D6ED),
|
|
bgColor: const Color(0xFFF5EDFF),
|
|
),
|
|
commitmentsItemList(
|
|
title: 'باقیمانده تعهد آزاد توزیع داخل استان',
|
|
value: data.value?.totalCommitmentSellingInProvinceFreeRemainWeight.separatedByComma,
|
|
labelColor: const Color(0xFFEBC5CE),
|
|
bgColor: const Color(0xFFFFF1F4),
|
|
),
|
|
],
|
|
);
|
|
}, controller.rootLogic.stewardSalesInfoDashboard);
|
|
}
|
|
|
|
Container commitmentsItemList({
|
|
required String title,
|
|
required String? value,
|
|
required Color labelColor,
|
|
required Color bgColor,
|
|
}) {
|
|
return Container(
|
|
width: Get.width,
|
|
child: Row(
|
|
children: [
|
|
Container(height: 48.h, width: 4.w, color: labelColor),
|
|
Expanded(
|
|
child: Container(
|
|
height: 48.h,
|
|
padding: EdgeInsets.symmetric(horizontal: 14.w),
|
|
decoration: BoxDecoration(
|
|
color: bgColor,
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(8),
|
|
bottomLeft: Radius.circular(8),
|
|
),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Text(
|
|
title,
|
|
textAlign: TextAlign.right,
|
|
style: AppFonts.yekan12.copyWith(color: AppColor.textColor),
|
|
),
|
|
Spacer(),
|
|
|
|
value == null
|
|
? Center(child: CupertinoActivityIndicator())
|
|
: Text(
|
|
value,
|
|
textAlign: TextAlign.right,
|
|
style: AppFonts.yekan16.copyWith(color: AppColor.textColor),
|
|
),
|
|
SizedBox(width: 8.w),
|
|
|
|
Text(
|
|
'کیلوگرم',
|
|
textAlign: TextAlign.right,
|
|
style: AppFonts.yekan10.copyWith(color: AppColor.textColor),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|