feat : information_tag_widget and use it in poultry since
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_chicken/data/models/response/poultry_science/home_poultry_science/home_poultry_science_model.dart';
|
||||
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/logic.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
@@ -7,6 +8,77 @@ class PoultryScienceHomeLogic extends GetxController {
|
||||
Rxn<HomePoultryScienceModel> homeInformation = Rxn();
|
||||
RxBool isExpanded = false.obs;
|
||||
|
||||
RxMap<String, List<InformationTagData>> tagInfo = RxMap({
|
||||
'first': [
|
||||
InformationTagData(
|
||||
labelTitle: 'کل فارم ها',
|
||||
isLoading: true,
|
||||
labelVecIcon: Assets.vec.cubeSearchSvg.path,
|
||||
iconColor: AppColor.blueNormal,
|
||||
valueBgColor: Colors.white,
|
||||
labelGradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [AppColor.blueLight, Colors.white],
|
||||
),
|
||||
),
|
||||
InformationTagData(
|
||||
labelTitle: 'تعداد جوجه ریزی',
|
||||
isLoading: true,
|
||||
labelVecIcon: Assets.vec.cubeCardSvg.path,
|
||||
iconColor: AppColor.blueNormal,
|
||||
valueBgColor: Colors.white,
|
||||
labelGradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [AppColor.greenLightHover, Colors.white],
|
||||
),
|
||||
),
|
||||
],
|
||||
'second': [
|
||||
InformationTagData(
|
||||
labelTitle: 'حجم جوجه ریزی',
|
||||
unit: 'قطعه',
|
||||
isLoading: true,
|
||||
labelVecIcon: Assets.vec.hashtagSvg.path,
|
||||
iconColor: const Color(0xFF426060),
|
||||
labelBgColor: const Color(0xFFA5D1D2),
|
||||
valueBgColor: const Color(0xFFC7DFE0),
|
||||
),
|
||||
InformationTagData(
|
||||
labelTitle: 'مانده در سالن',
|
||||
unit: 'قطعه',
|
||||
isLoading: true,
|
||||
labelVecIcon: Assets.vec.homeHashtagSvg.path,
|
||||
iconColor: Color(0xFF5C4D64),
|
||||
labelBgColor: Color(0xFFC8B8D1),
|
||||
valueBgColor: Color(0xFFDAD4DD),
|
||||
|
||||
),
|
||||
],
|
||||
|
||||
'third': [
|
||||
InformationTagData(
|
||||
labelTitle: 'تلفات',
|
||||
unit: 'قطعه',
|
||||
isLoading: true,
|
||||
labelVecIcon: Assets.vec.boxRemoveSvg.path,
|
||||
iconColor: const Color(0xFF6C5D60),
|
||||
labelBgColor: const Color(0xFFDDC0C7),
|
||||
valueBgColor: const Color(0xFFEDDCE0),
|
||||
),
|
||||
InformationTagData(
|
||||
labelTitle: 'حجم کشتار شده',
|
||||
unit: 'قطعه',
|
||||
isLoading: true,
|
||||
labelVecIcon: Assets.vec.closeSquareFilledSvg.path,
|
||||
iconColor: Color(0xFF2D5FFF),
|
||||
labelBgColor: const Color(0xFFAFCBFF),
|
||||
valueBgColor: const Color(0xFFCEDFFF),
|
||||
),
|
||||
],
|
||||
});
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
@@ -22,6 +94,57 @@ class PoultryScienceHomeLogic extends GetxController {
|
||||
onSuccess: (result) {
|
||||
if (result != null) {
|
||||
homeInformation.value = result;
|
||||
tagInfo['first'] = tagInfo['first']!.map((tag) {
|
||||
if (tag.labelTitle == 'کل فارم ها') {
|
||||
return tag.copyWith(
|
||||
value: result.farmCount?.separatedByComma ?? '0',
|
||||
isLoading: false,
|
||||
);
|
||||
}
|
||||
if (tag.labelTitle == 'تعداد جوجه ریزی') {
|
||||
return tag.copyWith(
|
||||
value: result.hatchingCount?.separatedByComma ?? '0',
|
||||
isLoading: false,
|
||||
);
|
||||
}
|
||||
return tag;
|
||||
}).toList();
|
||||
|
||||
// second
|
||||
tagInfo['second'] = tagInfo['second']!.map((tag) {
|
||||
switch (tag.labelTitle) {
|
||||
case 'حجم جوجه ریزی':
|
||||
return tag.copyWith(
|
||||
value: result.hatchingQuantity?.separatedByComma ?? '0',
|
||||
isLoading: false,
|
||||
);
|
||||
case 'مانده در سالن':
|
||||
return tag.copyWith(
|
||||
value: result.hatchingLeftOver?.separatedByComma ?? '0',
|
||||
isLoading: false,
|
||||
);
|
||||
default:
|
||||
return tag;
|
||||
}
|
||||
}).toList();
|
||||
|
||||
// third
|
||||
tagInfo['third'] = tagInfo['third']!.map((tag) {
|
||||
switch (tag.labelTitle) {
|
||||
case 'تلفات':
|
||||
return tag.copyWith(
|
||||
value: result.hatchingLosses?.separatedByComma ?? '0',
|
||||
isLoading: false,
|
||||
);
|
||||
case 'حجم کشتار شده':
|
||||
return tag.copyWith(
|
||||
value: result.hatchingKilledQuantity?.separatedByComma ?? '0',
|
||||
isLoading: false,
|
||||
);
|
||||
default:
|
||||
return tag;
|
||||
}
|
||||
}).toList();
|
||||
}
|
||||
},
|
||||
onError: (error, stackTrace) {},
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
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/routes/routes.dart';
|
||||
import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
@@ -35,118 +33,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
||||
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,
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
_todayShipmentWidget(),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'اطلاعات جوجه ریزی',
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan16,
|
||||
),
|
||||
],
|
||||
),
|
||||
_inventoryWidget(),
|
||||
killsShipment(),
|
||||
ageWidget(),
|
||||
],
|
||||
),
|
||||
)
|
||||
: 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),
|
||||
],
|
||||
),
|
||||
_todayShipmentWidget(),
|
||||
_inventoryWidget(),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: data.value ? mainItemWidget() : mainItemWidgetExpanded(),
|
||||
);
|
||||
}, controller.isExpanded),
|
||||
),
|
||||
@@ -160,6 +47,98 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
||||
);
|
||||
}
|
||||
|
||||
Padding mainItemWidget() {
|
||||
return 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),
|
||||
],
|
||||
),
|
||||
firstTagInformation(),
|
||||
secondTagInformation(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Padding mainItemWidgetExpanded() {
|
||||
return 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(),
|
||||
AnimatedRotation(
|
||||
turns: 180,
|
||||
duration: Duration(milliseconds: 3000),
|
||||
child: Icon(CupertinoIcons.chevron_up, size: 18),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
firstTagInformation(),
|
||||
Row(
|
||||
children: [
|
||||
Text('اطلاعات جوجه ریزی', textAlign: TextAlign.right, style: AppFonts.yekan16),
|
||||
],
|
||||
),
|
||||
secondTagInformation(),
|
||||
thirdTagInformation(),
|
||||
ageWidget(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget ageWidget() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 13),
|
||||
@@ -172,8 +151,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
||||
title: 'کمترین سن جوجه ریزیط',
|
||||
isLoading: data.value == null,
|
||||
|
||||
description:
|
||||
'${data.value?.hatchingMinAge.separatedByComma} روز' ?? '0',
|
||||
description: '${data.value?.hatchingMinAge.separatedByComma} روز' ?? '0',
|
||||
iconPath: Assets.vec.homeTrendUpSvg.path,
|
||||
iconColor: const Color.fromRGBO(85, 97, 93, 1),
|
||||
bgDescriptionColor: const Color(0xFFE6FAF5),
|
||||
@@ -181,8 +159,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
||||
),
|
||||
_informationIconCard(
|
||||
title: 'بیشترین سن جوجه ریزی',
|
||||
description:
|
||||
'${data.value?.hatchingMaxAge.separatedByComma} روز' ?? '0',
|
||||
description: '${data.value?.hatchingMaxAge.separatedByComma} روز' ?? '0',
|
||||
iconPath: Assets.vec.homeTrendUpSvg.path,
|
||||
iconColor: const Color(0xFF6F6164),
|
||||
bgDescriptionColor: const Color(0xFFEDDCE0),
|
||||
@@ -194,222 +171,52 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget killsShipment() {
|
||||
Widget firstTagInformation() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 13),
|
||||
child: ObxValue((data) {
|
||||
List<InformationTagData>? items = data['first']!;
|
||||
return Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Expanded(
|
||||
child: _informationLabelCard(
|
||||
title: 'تلفات',
|
||||
isLoading: data.value == null,
|
||||
unit: 'قطعه',
|
||||
description:
|
||||
data.value?.hatchingLosses?.separatedByComma ?? '0',
|
||||
iconPath: Assets.vec.boxRemoveSvg.path,
|
||||
iconColor: const Color(0xFF6C5D60),
|
||||
bgDescriptionColor: const Color(0xFFEDDCE0),
|
||||
bgLabelColor: const Color(0xFFDDC0C7),
|
||||
children: List.generate(
|
||||
items.length,
|
||||
(index) => Expanded(child: InformationTag(data: items[index])),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _informationLabelCard(
|
||||
title: 'حجم کشتار شده',
|
||||
unit: 'قطعه',
|
||||
isLoading: data.value == null,
|
||||
description:
|
||||
data.value?.hatchingKilledQuantity.separatedByComma ?? '0',
|
||||
iconPath: Assets.vec.closeSquareFilledSvg.path,
|
||||
iconColor: Color(0xFF2D5FFF),
|
||||
bgLabelColor: const Color(0xFFAFCBFF),
|
||||
bgDescriptionColor: const Color(0xFFCEDFFF),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}, controller.homeInformation),
|
||||
}, controller.tagInfo),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _inventoryWidget() {
|
||||
return ObxValue((data) {
|
||||
Widget secondTagInformation() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 10, 0, 13),
|
||||
child: Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Expanded(
|
||||
child: _informationLabelCard(
|
||||
title: 'حجم جوجه ریزی',
|
||||
isLoading: data.value == null,
|
||||
unit: 'قطعه',
|
||||
description:
|
||||
data.value?.hatchingQuantity.separatedByComma ?? '0',
|
||||
iconPath: Assets.vec.hashtagSvg.path,
|
||||
iconColor: const Color(0xFF426060),
|
||||
bgDescriptionColor: const Color(0xFFC7DFE0),
|
||||
bgLabelColor: const Color(0xFFA5D1D2),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _informationLabelCard(
|
||||
title: 'مانده در سالن',
|
||||
unit: 'قطعه',
|
||||
isLoading: data.value == null,
|
||||
description:
|
||||
data.value?.hatchingLeftOver.separatedByComma ?? '0',
|
||||
iconPath: Assets.vec.homeHashtagSvg.path,
|
||||
iconColor: Color(0xFF5C4D64),
|
||||
bgLabelColor: Color(0xFFC8B8D1),
|
||||
bgDescriptionColor: Color(0xFFDAD4DD),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}, controller.homeInformation);
|
||||
}
|
||||
|
||||
Widget _todayShipmentWidget() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 10, 0, 13),
|
||||
child: Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ObxValue(
|
||||
(data) => _informationLabelCard(
|
||||
title: 'کل فارم ها',
|
||||
isLoading: data.value == null,
|
||||
description: data.value?.farmCount?.separatedByComma ?? '0',
|
||||
iconPath: Assets.vec.cubeSearchSvg.path,
|
||||
iconColor: AppColor.blueNormal,
|
||||
bgDescriptionColor: Colors.white,
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [AppColor.blueLight, Colors.white],
|
||||
),
|
||||
),
|
||||
controller.homeInformation,
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 13),
|
||||
child: ObxValue((data) {
|
||||
return _informationLabelCard(
|
||||
title: 'تعداد جوجه ریزی',
|
||||
isLoading: data.value == null,
|
||||
description: data.value?.hatchingCount.separatedByComma ?? '0',
|
||||
iconPath: Assets.vec.cubeCardSvg.path,
|
||||
bgDescriptionColor: Colors.white,
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [AppColor.greenLightHover, Colors.white],
|
||||
List<InformationTagData>? items = data['second']!;
|
||||
return Row(
|
||||
spacing: 8,
|
||||
children: List.generate(
|
||||
items.length,
|
||||
(index) => Expanded(child: InformationTag(data: items[index])),
|
||||
),
|
||||
);
|
||||
}, controller.homeInformation),
|
||||
),
|
||||
],
|
||||
),
|
||||
}, controller.tagInfo),
|
||||
);
|
||||
}
|
||||
|
||||
Container _informationLabelCard({
|
||||
required String title,
|
||||
required String description,
|
||||
required String iconPath,
|
||||
required Color bgDescriptionColor,
|
||||
String? unit,
|
||||
bool isLoading = false,
|
||||
Color? iconColor,
|
||||
Color? titleColor,
|
||||
Color? bgLabelColor,
|
||||
LinearGradient? gradient,
|
||||
}) {
|
||||
return Container(
|
||||
height: 82,
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(8)),
|
||||
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: 4,
|
||||
children: [
|
||||
SvgGenImage.vec(iconPath).svg(
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: iconColor != null
|
||||
? ColorFilter.mode(iconColor, BlendMode.srcIn)
|
||||
: null,
|
||||
),
|
||||
Text(
|
||||
title,
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan10.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.yekan12.copyWith(
|
||||
color: AppColor.mediumGreyDarkActive,
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: unit != null,
|
||||
child: Text(
|
||||
unit ?? '',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.mediumGreyDarkActive,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
Widget thirdTagInformation() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 13),
|
||||
child: ObxValue((data) {
|
||||
List<InformationTagData>? items = data['third']!;
|
||||
return Row(
|
||||
spacing: 8,
|
||||
children: List.generate(
|
||||
items.length,
|
||||
(index) => Expanded(child: InformationTag(data: items[index])),
|
||||
),
|
||||
);
|
||||
}, controller.tagInfo),
|
||||
);
|
||||
}
|
||||
|
||||
Container _informationIconCard({
|
||||
@@ -448,9 +255,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
||||
Text(
|
||||
title,
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.mediumGreyDarkActive,
|
||||
),
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||
),
|
||||
|
||||
isLoading
|
||||
@@ -458,9 +263,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
||||
: Text(
|
||||
description,
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan16.copyWith(
|
||||
color: AppColor.mediumGreyDarkActive,
|
||||
),
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||
),
|
||||
|
||||
Visibility(
|
||||
@@ -468,9 +271,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
||||
child: Text(
|
||||
unit ?? '',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.mediumGreyDarkActive,
|
||||
),
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -503,49 +304,6 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
||||
);
|
||||
}
|
||||
|
||||
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),
|
||||
@@ -557,9 +315,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
||||
child: Text(
|
||||
title,
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
@@ -567,9 +323,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
||||
child: Text(
|
||||
value,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -577,79 +331,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
||||
);
|
||||
}
|
||||
|
||||
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 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),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
//region Widely Used Widget
|
||||
Widget widelyWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
@@ -657,13 +339,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
||||
padding: EdgeInsetsGeometry.all(6),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'پر کاربرد ها',
|
||||
textAlign: TextAlign.right,
|
||||
style: AppFonts.yekan16,
|
||||
),
|
||||
],
|
||||
children: [Text('پر کاربرد ها', textAlign: TextAlign.right, style: AppFonts.yekan16)],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -756,26 +432,19 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: ShapeDecoration(
|
||||
color: cardColor ?? Color(0xFFBECDFF),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: ShapeDecoration(
|
||||
color: labelColor ?? AppColor.blueNormal,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
child: SvgGenImage.vec(iconPath).svg(
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: ColorFilter.mode(
|
||||
Colors.white,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
@@ -788,9 +457,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: ShapeDecoration(
|
||||
color: Colors.white60,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -810,16 +477,9 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
||||
child: Container(
|
||||
width: 16,
|
||||
height: 16,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.white),
|
||||
alignment: Alignment.center,
|
||||
child: Icon(
|
||||
CupertinoIcons.minus,
|
||||
color: AppColor.error,
|
||||
size: 15,
|
||||
),
|
||||
child: Icon(CupertinoIcons.minus, color: AppColor.error, size: 15),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -828,14 +488,11 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
title,
|
||||
style: AppFonts.yekan10.copyWith(
|
||||
color: textColor ?? AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
Text(title, style: AppFonts.yekan10.copyWith(color: textColor ?? AppColor.blueNormal)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
//endregion
|
||||
}
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class InformationTagData {
|
||||
//label
|
||||
final String? labelVecIcon;
|
||||
final String? labelSvgIcon;
|
||||
final String? labelTitle;
|
||||
final Color? iconColor;
|
||||
final Color? labelBgColor;
|
||||
final Color? labelTitleColor;
|
||||
final TextStyle? labelTitleStyle;
|
||||
final LinearGradient? labelGradient;
|
||||
final int? widthIcon;
|
||||
final int? heightIcon;
|
||||
|
||||
//value
|
||||
final String? value;
|
||||
final TextStyle? valueStyle;
|
||||
final Color? valueColor;
|
||||
final Color? valueBgColor;
|
||||
final LinearGradient? valueGradient;
|
||||
final bool isLoading;
|
||||
|
||||
//unit
|
||||
final String? unit;
|
||||
final TextStyle? unitStyle;
|
||||
final Color? unitColor;
|
||||
|
||||
//global
|
||||
final int? width;
|
||||
final int? height;
|
||||
|
||||
InformationTagData({
|
||||
this.labelVecIcon,
|
||||
this.labelSvgIcon,
|
||||
this.labelTitle,
|
||||
this.iconColor,
|
||||
this.labelBgColor,
|
||||
this.labelTitleColor,
|
||||
this.labelTitleStyle,
|
||||
this.labelGradient,
|
||||
this.value,
|
||||
this.valueStyle,
|
||||
this.valueColor,
|
||||
this.valueBgColor,
|
||||
this.valueGradient,
|
||||
this.isLoading = false,
|
||||
this.unit,
|
||||
this.unitStyle,
|
||||
this.unitColor,
|
||||
this.width,
|
||||
this.height,
|
||||
this.heightIcon,
|
||||
this.widthIcon,
|
||||
}) : assert(
|
||||
(labelVecIcon != null) ^ (labelSvgIcon != null),
|
||||
'Either labelVecIcon or labelSvgIcon must be provided, but not both.',
|
||||
),
|
||||
assert(isLoading || value != null, 'When isLoading is false, value must not be null.'),
|
||||
assert(
|
||||
(labelBgColor != null) ^ (labelGradient != null),
|
||||
'Either labelBgColor or labelGradient must be provided, but not both.',
|
||||
),
|
||||
assert(
|
||||
(valueBgColor != null) ^ (valueGradient != null),
|
||||
'Either valueBgColor or valueGradient must be provided, but not both.',
|
||||
);
|
||||
|
||||
/// copyWith method
|
||||
InformationTagData copyWith({
|
||||
String? labelVecIcon,
|
||||
String? labelSvgIcon,
|
||||
String? labelTitle,
|
||||
Color? iconColor,
|
||||
Color? labelBgColor,
|
||||
Color? labelTitleColor,
|
||||
TextStyle? labelTitleStyle,
|
||||
LinearGradient? labelGradient,
|
||||
int? widthIcon,
|
||||
int? heightIcon,
|
||||
String? value,
|
||||
TextStyle? valueStyle,
|
||||
Color? valueColor,
|
||||
Color? valueBgColor,
|
||||
LinearGradient? valueGradient,
|
||||
bool? isLoading,
|
||||
String? unit,
|
||||
TextStyle? unitStyle,
|
||||
Color? unitColor,
|
||||
int? width,
|
||||
int? height,
|
||||
}) {
|
||||
return InformationTagData(
|
||||
labelVecIcon: labelVecIcon ?? this.labelVecIcon,
|
||||
labelSvgIcon: labelSvgIcon ?? this.labelSvgIcon,
|
||||
labelTitle: labelTitle ?? this.labelTitle,
|
||||
iconColor: iconColor ?? this.iconColor,
|
||||
labelBgColor: labelBgColor ?? this.labelBgColor,
|
||||
labelTitleColor: labelTitleColor ?? this.labelTitleColor,
|
||||
labelTitleStyle: labelTitleStyle ?? this.labelTitleStyle,
|
||||
labelGradient: labelGradient ?? this.labelGradient,
|
||||
widthIcon: widthIcon ?? this.widthIcon,
|
||||
heightIcon: heightIcon ?? this.heightIcon,
|
||||
value: value ?? this.value,
|
||||
valueStyle: valueStyle ?? this.valueStyle,
|
||||
valueColor: valueColor ?? this.valueColor,
|
||||
valueBgColor: valueBgColor ?? this.valueBgColor,
|
||||
valueGradient: valueGradient ?? this.valueGradient,
|
||||
isLoading: isLoading ?? this.isLoading,
|
||||
unit: unit ?? this.unit,
|
||||
unitStyle: unitStyle ?? this.unitStyle,
|
||||
unitColor: unitColor ?? this.unitColor,
|
||||
width: width ?? this.width,
|
||||
height: height ?? this.height,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class InformationTag extends StatelessWidget {
|
||||
const InformationTag({super.key, required this.data});
|
||||
|
||||
final InformationTagData data;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: (data.height ?? 82).h,
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(8)),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: Row(
|
||||
children: [
|
||||
// Left side with icon and title
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 82,
|
||||
decoration: BoxDecoration(
|
||||
color: data.labelBgColor,
|
||||
borderRadius: BorderRadius.only(
|
||||
topRight: Radius.circular(8),
|
||||
bottomRight: Radius.circular(8),
|
||||
),
|
||||
gradient: data.labelGradient,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 4,
|
||||
children: [
|
||||
data.labelVecIcon != null
|
||||
? SvgGenImage.vec(data.labelVecIcon!).svg(
|
||||
width: (data.widthIcon ?? 24).w,
|
||||
height: (data.heightIcon ?? 24).h,
|
||||
colorFilter: ColorFilter.mode(
|
||||
data.iconColor ?? AppColor.mediumGreyDarkActive,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
)
|
||||
: SvgGenImage(data.labelSvgIcon!).svg(
|
||||
width: (data.widthIcon ?? 24).w,
|
||||
height: (data.heightIcon ?? 24).h,
|
||||
colorFilter: ColorFilter.mode(
|
||||
data.iconColor ?? AppColor.mediumGreyDarkActive,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: data.labelTitle != null,
|
||||
child: Text(
|
||||
data.labelTitle!,
|
||||
textAlign: TextAlign.right,
|
||||
style:
|
||||
data.labelTitleStyle ??
|
||||
AppFonts.yekan10.copyWith(
|
||||
color: data.labelTitleColor ?? AppColor.mediumGreyDarkActive,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// Right side with description and unit
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: data.valueBgColor,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(8),
|
||||
bottomLeft: Radius.circular(8),
|
||||
),
|
||||
gradient: data.valueGradient,
|
||||
),
|
||||
child: data.isLoading
|
||||
? Center(child: CupertinoActivityIndicator())
|
||||
: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 4,
|
||||
children: [
|
||||
Visibility(
|
||||
visible: data.value != null,
|
||||
child: Text(
|
||||
data.value!,
|
||||
textAlign: TextAlign.center,
|
||||
style:
|
||||
data.valueStyle ??
|
||||
AppFonts.yekan12.copyWith(
|
||||
color: data.valueColor ?? AppColor.mediumGreyDarkActive,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Visibility(
|
||||
visible: data.unit != null,
|
||||
child: Text(
|
||||
data.unit ?? '',
|
||||
textAlign: TextAlign.center,
|
||||
style:
|
||||
data.unitStyle ??
|
||||
AppFonts.yekan12.copyWith(
|
||||
color: data.unitColor ?? AppColor.mediumGreyDarkActive,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ export 'bottom_sheet/date_picker_bottom_sheet.dart';
|
||||
export 'buttons/buttons.dart';
|
||||
export 'card/card_icon_widget.dart';
|
||||
export 'chips/r_chips.dart';
|
||||
//custom
|
||||
export 'custom/information_tag_widget.dart';
|
||||
export 'dialog/dialog.dart';
|
||||
export 'draggable_bottom_sheet/bottom_sheet_manger.dart';
|
||||
export 'draggable_bottom_sheet/draggable_bottom_sheet.dart';
|
||||
@@ -28,8 +30,8 @@ export 'marquee/r_marquee.dart';
|
||||
export 'overlay_dropdown_widget/view.dart';
|
||||
export 'pagination/pagination_from_until.dart';
|
||||
export 'pagination/show_more.dart';
|
||||
export 'slider/slider.dart';
|
||||
export 'tabs/new_tab.dart';
|
||||
export 'tabs/r_segment.dart';
|
||||
export 'tabs/tab.dart';
|
||||
export 'vec_widget.dart';
|
||||
export 'slider/slider.dart';
|
||||
Reference in New Issue
Block a user