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/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_chicken/presentation/pages/poultry_science/root/logic.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
@@ -7,6 +8,77 @@ class PoultryScienceHomeLogic extends GetxController {
|
|||||||
Rxn<HomePoultryScienceModel> homeInformation = Rxn();
|
Rxn<HomePoultryScienceModel> homeInformation = Rxn();
|
||||||
RxBool isExpanded = false.obs;
|
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
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
super.onReady();
|
super.onReady();
|
||||||
@@ -22,6 +94,57 @@ class PoultryScienceHomeLogic extends GetxController {
|
|||||||
onSuccess: (result) {
|
onSuccess: (result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
homeInformation.value = result;
|
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) {},
|
onError: (error, stackTrace) {},
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import 'package:flutter/cupertino.dart' hide LinearGradient;
|
import 'package:flutter/cupertino.dart' hide LinearGradient;
|
||||||
import 'package:flutter/material.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_chicken/presentation/routes/routes.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
|
import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
@@ -35,118 +33,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
|||||||
child: ObxValue((data) {
|
child: ObxValue((data) {
|
||||||
return AnimatedSize(
|
return AnimatedSize(
|
||||||
duration: Duration(milliseconds: 300),
|
duration: Duration(milliseconds: 300),
|
||||||
child: data.value
|
child: data.value ? mainItemWidget() : mainItemWidgetExpanded(),
|
||||||
? 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(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}, controller.isExpanded),
|
}, 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() {
|
Widget ageWidget() {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 13),
|
padding: const EdgeInsets.fromLTRB(0, 8, 0, 13),
|
||||||
@@ -172,8 +151,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
|||||||
title: 'کمترین سن جوجه ریزیط',
|
title: 'کمترین سن جوجه ریزیط',
|
||||||
isLoading: data.value == null,
|
isLoading: data.value == null,
|
||||||
|
|
||||||
description:
|
description: '${data.value?.hatchingMinAge.separatedByComma} روز' ?? '0',
|
||||||
'${data.value?.hatchingMinAge.separatedByComma} روز' ?? '0',
|
|
||||||
iconPath: Assets.vec.homeTrendUpSvg.path,
|
iconPath: Assets.vec.homeTrendUpSvg.path,
|
||||||
iconColor: const Color.fromRGBO(85, 97, 93, 1),
|
iconColor: const Color.fromRGBO(85, 97, 93, 1),
|
||||||
bgDescriptionColor: const Color(0xFFE6FAF5),
|
bgDescriptionColor: const Color(0xFFE6FAF5),
|
||||||
@@ -181,8 +159,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
|||||||
),
|
),
|
||||||
_informationIconCard(
|
_informationIconCard(
|
||||||
title: 'بیشترین سن جوجه ریزی',
|
title: 'بیشترین سن جوجه ریزی',
|
||||||
description:
|
description: '${data.value?.hatchingMaxAge.separatedByComma} روز' ?? '0',
|
||||||
'${data.value?.hatchingMaxAge.separatedByComma} روز' ?? '0',
|
|
||||||
iconPath: Assets.vec.homeTrendUpSvg.path,
|
iconPath: Assets.vec.homeTrendUpSvg.path,
|
||||||
iconColor: const Color(0xFF6F6164),
|
iconColor: const Color(0xFF6F6164),
|
||||||
bgDescriptionColor: const Color(0xFFEDDCE0),
|
bgDescriptionColor: const Color(0xFFEDDCE0),
|
||||||
@@ -194,221 +171,51 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget killsShipment() {
|
Widget firstTagInformation() {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(0, 8, 0, 13),
|
padding: const EdgeInsets.fromLTRB(0, 8, 0, 13),
|
||||||
child: ObxValue((data) {
|
child: ObxValue((data) {
|
||||||
|
List<InformationTagData>? items = data['first']!;
|
||||||
return Row(
|
return Row(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: [
|
children: List.generate(
|
||||||
Expanded(
|
items.length,
|
||||||
child: _informationLabelCard(
|
(index) => Expanded(child: InformationTag(data: items[index])),
|
||||||
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),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
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() {
|
Widget secondTagInformation() {
|
||||||
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,
|
|
||||||
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(
|
return Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(0, 10, 0, 13),
|
padding: const EdgeInsets.fromLTRB(0, 8, 0, 13),
|
||||||
child: Row(
|
child: ObxValue((data) {
|
||||||
spacing: 8,
|
List<InformationTagData>? items = data['second']!;
|
||||||
children: [
|
return Row(
|
||||||
Expanded(
|
spacing: 8,
|
||||||
child: ObxValue(
|
children: List.generate(
|
||||||
(data) => _informationLabelCard(
|
items.length,
|
||||||
title: 'کل فارم ها',
|
(index) => Expanded(child: InformationTag(data: items[index])),
|
||||||
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(
|
}, controller.tagInfo),
|
||||||
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],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.homeInformation),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Container _informationLabelCard({
|
Widget thirdTagInformation() {
|
||||||
required String title,
|
return Padding(
|
||||||
required String description,
|
padding: const EdgeInsets.fromLTRB(0, 8, 0, 13),
|
||||||
required String iconPath,
|
child: ObxValue((data) {
|
||||||
required Color bgDescriptionColor,
|
List<InformationTagData>? items = data['third']!;
|
||||||
String? unit,
|
return Row(
|
||||||
bool isLoading = false,
|
spacing: 8,
|
||||||
Color? iconColor,
|
children: List.generate(
|
||||||
Color? titleColor,
|
items.length,
|
||||||
Color? bgLabelColor,
|
(index) => Expanded(child: InformationTag(data: items[index])),
|
||||||
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(
|
}, controller.tagInfo),
|
||||||
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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,9 +255,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
|||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
isLoading
|
isLoading
|
||||||
@@ -458,9 +263,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
|||||||
: Text(
|
: Text(
|
||||||
description,
|
description,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan16.copyWith(
|
style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
color: AppColor.mediumGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
Visibility(
|
Visibility(
|
||||||
@@ -468,9 +271,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
unit ?? '',
|
unit ?? '',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan12.copyWith(
|
style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive),
|
||||||
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) {
|
Widget buildRow(String title, String value) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||||
@@ -557,9 +315,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
title,
|
title,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||||
color: AppColor.darkGreyDarkHover,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Flexible(
|
Flexible(
|
||||||
@@ -567,9 +323,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
value,
|
value,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppFonts.yekan14.copyWith(
|
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||||
color: AppColor.darkGreyDarkHover,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -577,79 +331,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget broadcastInformationWidget(KillHouseDistributionInfo? model) {
|
//region Widely Used Widget
|
||||||
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),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget widelyWidget() {
|
Widget widelyWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
@@ -657,13 +339,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
|||||||
padding: EdgeInsetsGeometry.all(6),
|
padding: EdgeInsetsGeometry.all(6),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [Text('پر کاربرد ها', textAlign: TextAlign.right, style: AppFonts.yekan16)],
|
||||||
Text(
|
|
||||||
'پر کاربرد ها',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
style: AppFonts.yekan16,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -756,26 +432,19 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
|||||||
padding: EdgeInsets.all(4),
|
padding: EdgeInsets.all(4),
|
||||||
decoration: ShapeDecoration(
|
decoration: ShapeDecoration(
|
||||||
color: cardColor ?? Color(0xFFBECDFF),
|
color: cardColor ?? Color(0xFFBECDFF),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 40,
|
width: 40,
|
||||||
height: 40,
|
height: 40,
|
||||||
decoration: ShapeDecoration(
|
decoration: ShapeDecoration(
|
||||||
color: labelColor ?? AppColor.blueNormal,
|
color: labelColor ?? AppColor.blueNormal,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: SvgGenImage.vec(iconPath).svg(
|
child: SvgGenImage.vec(iconPath).svg(
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
colorFilter: ColorFilter.mode(
|
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||||
Colors.white,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -788,9 +457,7 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
|||||||
padding: EdgeInsets.all(4),
|
padding: EdgeInsets.all(4),
|
||||||
decoration: ShapeDecoration(
|
decoration: ShapeDecoration(
|
||||||
color: Colors.white60,
|
color: Colors.white60,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -810,16 +477,9 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
width: 16,
|
width: 16,
|
||||||
height: 16,
|
height: 16,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.white),
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Icon(
|
child: Icon(CupertinoIcons.minus, color: AppColor.error, size: 15),
|
||||||
CupertinoIcons.minus,
|
|
||||||
color: AppColor.error,
|
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -828,14 +488,11 @@ class PoultryScienceHomePage extends GetView<PoultryScienceHomeLogic> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Text(
|
Text(title, style: AppFonts.yekan10.copyWith(color: textColor ?? AppColor.blueNormal)),
|
||||||
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 'buttons/buttons.dart';
|
||||||
export 'card/card_icon_widget.dart';
|
export 'card/card_icon_widget.dart';
|
||||||
export 'chips/r_chips.dart';
|
export 'chips/r_chips.dart';
|
||||||
|
//custom
|
||||||
|
export 'custom/information_tag_widget.dart';
|
||||||
export 'dialog/dialog.dart';
|
export 'dialog/dialog.dart';
|
||||||
export 'draggable_bottom_sheet/bottom_sheet_manger.dart';
|
export 'draggable_bottom_sheet/bottom_sheet_manger.dart';
|
||||||
export 'draggable_bottom_sheet/draggable_bottom_sheet.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 'overlay_dropdown_widget/view.dart';
|
||||||
export 'pagination/pagination_from_until.dart';
|
export 'pagination/pagination_from_until.dart';
|
||||||
export 'pagination/show_more.dart';
|
export 'pagination/show_more.dart';
|
||||||
|
export 'slider/slider.dart';
|
||||||
export 'tabs/new_tab.dart';
|
export 'tabs/new_tab.dart';
|
||||||
export 'tabs/r_segment.dart';
|
export 'tabs/r_segment.dart';
|
||||||
export 'tabs/tab.dart';
|
export 'tabs/tab.dart';
|
||||||
export 'vec_widget.dart';
|
export 'vec_widget.dart';
|
||||||
export 'slider/slider.dart';
|
|
||||||
Reference in New Issue
Block a user