feat : tagging page and add livestock tagging

This commit is contained in:
2025-05-26 12:13:07 +03:30
parent b1f08ce0dc
commit 2dbe8a2489
2 changed files with 290 additions and 161 deletions

View File

@@ -1,6 +1,8 @@
import 'package:get/get.dart'; import 'package:rasadyar_core/core.dart';
class TaggingLogic extends GetxController { class TaggingLogic extends GetxController {
RxInt selectedSegment = 0.obs;
@override @override
void onReady() { void onReady() {
// TODO: implement onReady // TODO: implement onReady

View File

@@ -37,15 +37,18 @@ class TaggingPage extends GetView<TaggingLogic> {
), ),
SizedBox(width: 4), SizedBox(width: 4),
IconButton( IconButton(
onPressed: () {}, onPressed:() {
Get.bottomSheet(
_buildBottomSheet(),
isScrollControlled: true,
);
},
style: IconButton.styleFrom( style: IconButton.styleFrom(
backgroundColor: AppColor.blueNormal, backgroundColor: AppColor.blueNormal,
fixedSize: Size(40, 40), fixedSize: Size(40, 40),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
borderRadius: BorderRadius.circular(8),
),
), ),
icon: Assets.vec.editSvg.svg(), icon: Assets.vec.addSvg.svg(),
), ),
], ],
), ),
@@ -54,169 +57,74 @@ class TaggingPage extends GetView<TaggingLogic> {
child: Card( child: Card(
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
color: Colors.white, color: Colors.white,
child: Stack( child: GridView.builder(
fit: StackFit.expand, padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
children: [ itemCount: 20,
GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
padding: EdgeInsets.symmetric( crossAxisCount: 2,
horizontal: 20, crossAxisSpacing: 12,
vertical: 10, mainAxisSpacing: 8,
),
itemBuilder: (context, index) {
return Container(
decoration: ShapeDecoration(
color: AppColor.lightGreyLightHover,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1, color: AppColor.blackLightHover),
borderRadius: BorderRadius.circular(8),
),
), ),
itemCount: 20, child: Padding(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( padding: const EdgeInsets.all(8.0),
crossAxisCount: 2, child: Column(
crossAxisSpacing: 12, mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisSpacing: 8, children: [
), Row(
itemBuilder: (context, index) { mainAxisAlignment: MainAxisAlignment.spaceBetween,
return Container(
decoration: ShapeDecoration(
color: AppColor.lightGreyLightHover,
shape: RoundedRectangleBorder(
side: BorderSide(
width: 1,
color: AppColor.blackLightHover,
),
borderRadius: BorderRadius.circular(8),
),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Row( Assets.vec.editSvg.svg(
mainAxisAlignment: width: 16,
MainAxisAlignment.spaceBetween, height: 16,
children: [ colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
Assets.vec.editSvg.svg(
width: 16,
height: 16,
colorFilter: ColorFilter.mode(
AppColor.blueNormal,
BlendMode.srcIn,
),
),
Assets.vec.trashSvg.svg(
width: 16,
height: 16,
colorFilter: ColorFilter.mode(
AppColor.error,
BlendMode.srcIn,
),
),
],
), ),
Text( Assets.vec.trashSvg.svg(
'گوسفند ماده', width: 16,
textAlign: TextAlign.center, height: 16,
style: AppFonts.yekan14.copyWith( colorFilter: ColorFilter.mode(AppColor.error, BlendMode.srcIn),
color: AppColor.blueNormal,
),
),
SizedBox(height: 10),
Text(
'سن : 18 ماه',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyNormal,
),
),
Text(
'نوع نژاد',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.bgDark,
),
),
Text(
'1212115112512',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'نوع پلاک',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(
color: AppColor.bgDark,
),
), ),
], ],
), ),
), Text(
); 'گوسفند ماده',
}, textAlign: TextAlign.center,
), style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
Positioned(
bottom: 10,
right: 3,
child: RFab.add(
onPressed: () {
Get.bottomSheet(
Container(
padding: EdgeInsets.all(20),
color: Colors.white,
height: 300,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
height: 40,
width: Get.width,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(
width: 1,
color: AppColor.darkGreyLight,
),
),
child: GestureDetector(
onTap: () {
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'گونه دام',
style: AppFonts.yekan14,
),
Icon(CupertinoIcons.chevron_up),
],
),
),
),
/* DropdownMenu(
width: Get.width,
dropdownMenuEntries: [
DropdownMenuEntry(
value: 'گوسفند',
label: 'گوسفند',
),
DropdownMenuEntry(
value: 'بز',
label: 'بز',
),
DropdownMenuEntry(
value: 'گوساله',
label: 'گوساله',
),
],
),*/
],
),
), ),
isScrollControlled: true, SizedBox(height: 10),
); Text(
}, 'سن : 18 ماه',
textAlign: TextAlign.center,
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyNormal),
),
Text(
'نوع نژاد',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
),
Text(
'1212115112512',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
Text(
'نوع پلاک',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.bgDark),
),
],
),
), ),
), );
], },
), ),
), ),
), ),
@@ -236,4 +144,223 @@ class TaggingPage extends GetView<TaggingLogic> {
), ),
); );
} }
Container _buildBottomSheet() {
return Container(
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(25),
topRight: Radius.circular(25),
),
),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
spacing: 8,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: 3,
width: 50,
decoration: BoxDecoration(
color: AppColor.darkGreyDark,
borderRadius: BorderRadius.circular(8),
),
),
],
),
SizedBox(height: 3),
OverlayDropdownWidget(
items: [
'گوسفند ماده',
'گوسفند نر',
'بز ماده',
'بز نر',
'گوساله ماده',
'گوساله نر',
],
onChanged: (value) {
print('Selected: $value');
},
itemBuilder: (item) => Text(item),
labelBuilder: (item) => Text(item ?? 'گونه دام'),
),
Container(
height: 40,
width: Get.width,
padding: const EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
border: Border.all(color: AppColor.darkGreyLight),
borderRadius: BorderRadius.circular(8),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'تاریخ تولد',
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyNormalActive),
),
Text(
'1404/5/5',
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyNormalActive),
),
],
),
),
ObxValue((data) {
return CupertinoSlidingSegmentedControl<int>(
children: {
0: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Text(
'نر',
style: AppFonts.yekan14.copyWith(
color:
data.value == 0
? AppColor.whiteGreyLight
: AppColor.darkGreyNormalActive,
),
),
),
1: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Text(
'ماده',
style: AppFonts.yekan14.copyWith(
color:
data.value == 1
? AppColor.whiteGreyLight
: AppColor.darkGreyNormalActive,
),
),
),
},
onValueChanged: (int? value) {
if (value != null) {
controller.selectedSegment.value = value;
}
},
proportionalWidth: true,
groupValue: data.value,
thumbColor: AppColor.blueNormal,
backgroundColor: CupertinoColors.systemGrey6,
);
}, controller.selectedSegment),
OverlayDropdownWidget(
items: ['نوع نژاد 1', 'نوع نژاد 2', 'نوع نژاد 3'],
onChanged: (value) {
print('Selected Breed: $value');
},
itemBuilder: (item) => Text(item),
labelBuilder: (item) => Text(item ?? 'نژاد'),
),
TextFiledFixedHint(
inputType: InputType.number,
hintText: 'پلاک مادر ',
onChanged: (String value) {
eLog('Mother Tag: $value');
},
),
TextFiledFixedHint(
inputType: InputType.number,
hintText: 'پلاک پدر ',
onChanged: (String value) {
eLog('father Tag: $value');
},
),
TextFiledFixedHint(
inputType: InputType.number,
hintText: 'پلاک دام',
onChanged: (String value) {
eLog('father Tag: $value');
},
),
OverlayDropdownWidget(
items: ['نوع پلاک 1', 'نوع پلاک 2', 'نوع پلاک 3'],
onChanged: (value) {
print('Selected Breed: $value');
},
itemBuilder: (item) => Text(item),
labelBuilder: (item) => Text(item ?? 'نوع پلاک'),
),
SizedBox(
width: Get.width,
height: 350,
child: Card(
color: Colors.white,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
Expanded(
child: Container(
width: Get.width,
decoration: BoxDecoration(
color: AppColor.lightGreyNormal,
borderRadius: BorderRadius.circular(8),
),
child: Center(
child: Assets.images.placeHolder.image(height: 150, width: 200),
),
),
),
SizedBox(height: 15),
Container(
width: Get.width,
height: 40,
clipBehavior: Clip.antiAlias,
decoration: ShapeDecoration(
color: AppColor.blueNormal,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'تصویر دام',
style: AppFonts.yekan14.copyWith(color: Colors.white),
),
Icon(CupertinoIcons.arrow_up_doc, color: Colors.white),
],
),
),
),
],
),
),
),
),
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: RElevated(
text: 'افزودن دام به گله',
textStyle: AppFonts.yekan18.copyWith(color: Colors.white),
width: Get.width,
backgroundColor: AppColor.greenNormal,
height: 40,
onPressed: () {
Get.back();
},
),
),
],
),
),
);
}
} }