feat : new tagging page

This commit is contained in:
2025-05-28 14:15:19 +03:30
parent b935f3f12a
commit b86a2d986e
12 changed files with 509 additions and 234 deletions

View File

@@ -2,6 +2,9 @@ import 'package:rasadyar_core/core.dart';
class TaggingLogic extends GetxController {
RxInt selectedSegment = 0.obs;
RxBool searchIsSelected = false.obs;
RxBool filterIsSelected = false.obs;
RxList<int> filterSelected = <int>[].obs;
@override
void onReady() {

View File

@@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_core/presentation/widget/buttons/fab.dart';
import 'logic.dart';
@@ -15,190 +16,194 @@ class TaggingPage extends GetView<TaggingLogic> {
title: 'پلاک کوبی',
leadingWidth: 40,
leading: Assets.vec.messageAddSvg.svg(width: 12, height: 12),
additionalActions: [
GestureDetector(
onTap: () {
if (controller.searchIsSelected.value) {
controller.searchIsSelected.value = !controller.searchIsSelected.value;
}
controller.filterIsSelected.value = !controller.filterIsSelected.value;
},
child: Assets.icons.filter.svg(width: 20, height: 20),
),
SizedBox(width: 16),
GestureDetector(
onTap: () {
if (controller.filterIsSelected.value) {
controller.filterIsSelected.value = !controller.filterIsSelected.value;
}
controller.searchIsSelected.value = !controller.searchIsSelected.value;
},
child: Assets.icons.search.svg(width: 20, height: 20),
),
],
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 15),
child: Column(
children: [
Row(
children: [
Expanded(
child: Container(
height: 40,
decoration: BoxDecoration(
color: AppColor.greenLightHover,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.darkGreyLight),
),
alignment: Alignment.center,
child: Text('آمار ثبت شده : سبک 5 و سنگین 8 راس'),
),
body: Stack(
children: [
Column(
children: [
_buildFilterWidget(),
_buildSearchWidget(),
_buildInfoDetails(),
_buildListContent(),
SizedBox(height: 10),
Padding(
padding: const EdgeInsets.fromLTRB(35, 0, 35, 20),
child: RElevated(
text: 'ثبت نهایی و ارسال به اتحادیه',
textStyle: AppFonts.yekan18,
height: 40,
backgroundColor: AppColor.greenNormal,
onPressed: () {},
isFullWidth: true,
),
SizedBox(width: 4),
IconButton(
onPressed: () {
Get.bottomSheet(_buildBottomSheet(), isScrollControlled: true);
},
style: IconButton.styleFrom(
backgroundColor: AppColor.blueNormal,
fixedSize: Size(40, 40),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
],
),
Positioned(
right: 10,
bottom: 75,
child: RFab.add(
onPressed: () {
Get.bottomSheet(_buildBottomSheet(), isScrollControlled: true);
},
),
),
],
),
);
}
Container _buildInfoDetails() {
return Container(
height: 40,
margin: EdgeInsets.fromLTRB(15, 10, 15, 2),
decoration: BoxDecoration(
color: AppColor.greenLightHover,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColor.darkGreyLight),
),
alignment: Alignment.center,
child: Text('پلاک شده : سبک 5 و سنگین 8 راس'),
);
}
Expanded _buildListContent() {
return Expanded(
child: ListView.separated(
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
itemCount: 20,
physics: BouncingScrollPhysics(),
cacheExtent: 280,
addRepaintBoundaries: true,
itemBuilder: (context, index) {
return _buildItemList(index);
},
separatorBuilder: (BuildContext context, int index) => SizedBox(height: 6),
),
);
}
Stack _buildItemList(int index) {
return Stack(
clipBehavior: Clip.none,
children: [
Container(
width: Get.width,
height: 75,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(
width: 2,
color:
index < 5
? AppColor.yellowNormal
: index < 12
? AppColor.greenLightActive
: AppColor.blueLight,
),
),
child: Row(
children: [
SizedBox(width: 30),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Get.bottomSheet(_buildInfoBottomSheet(), isScrollControlled: true);
},
child: Stack(
clipBehavior: Clip.none,
children: [
Text('123456789012346', style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal)),
Positioned(top: -20, right: -10, child: Assets.icons.virtual.svg(width: 20, height: 20)),
],
),
),
Spacer(),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('گوسفند ماده', style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal)),
SizedBox(height: 4),
Text('نوع نژاد', style: AppFonts.yekan14.copyWith(color: AppColor.bgDark)),
],
),
Spacer(),
Text('18 ماه', style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark)),
Spacer(),
Padding(
padding: const EdgeInsets.symmetric(vertical: 6),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Assets.vec.editSvg.svg(
width: 20,
height: 20,
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
),
Assets.vec.trashSvg.svg(
width: 20,
height: 20,
colorFilter: ColorFilter.mode(AppColor.error, BlendMode.srcIn),
),
],
),
),
SizedBox(width: 8),
],
),
),
Positioned(
right: -12,
top: 0,
bottom: 0,
child: Container(
width: 30,
height: 30,
child: Stack(
alignment: Alignment.center,
children: [
Assets.vec.tagLabelSvg.svg(width: 30, height: 30),
Positioned(
bottom: 25,
right: 2,
left: 2,
child: Text(
(index > 10 ? index * 1000 : index + 1).toString(),
textAlign: TextAlign.center,
style: AppFonts.yekan10.copyWith(
fontSize: ((index > 10 ? index * 1000 : index + 1).toString()).length > 3 ? 6 : 8,
color: AppColor.blueDarkActive,
),
textScaler: TextScaler.linear(1.5),
),
icon: Assets.vec.addSvg.svg(),
),
],
),
Expanded(
child: ListView.separated(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
itemCount: 20,
itemBuilder: (context, index) {
return Container(
width: Get.width,
height: 85,
decoration: BoxDecoration(
color:
index < 5
? AppColor.yellowNormal
: index < 12
? AppColor.greenLightActive
: AppColor.blueLight,
borderRadius: BorderRadius.circular(8),
),
child: Row(
children: [
SizedBox(width: 5),
Expanded(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topRight: Radius.circular(8),
bottomRight: Radius.circular(8),
),
border: Border.all(
color:
index < 5
? AppColor.yellowNormal
: index < 12
? AppColor.greenLightActive
: AppColor.blueLight,
width: 2,
),
),
child: Column(
children: [
SizedBox(height: 10),
Expanded(child: Row(
children: [
SizedBox(width: 10,),
Container(
padding: EdgeInsets.all(8),
alignment: AlignmentDirectional.center,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black54,),
child: Text((index+1).toString(),style: AppFonts.yekan18.copyWith(color: Colors.white),),
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Container(
padding: EdgeInsets.all(8),
alignment: AlignmentDirectional.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.black26,),
child: Text('ماده',style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),),
),
Container(
padding: EdgeInsets.all(8),
alignment: AlignmentDirectional.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.black26,),
child: Text('18 ماه',style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),),
),
Container(
padding: EdgeInsets.all(8),
alignment: AlignmentDirectional.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.black26,),
child: Text('سرابی',style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),),
),
],
),
),
],
)),
SizedBox(height: 10),
Expanded(child:
Row(
children: [
SizedBox(width: 10,),
Text('پلاک : 1212115112512', style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark)),
Spacer(),
Assets.vec.editSvg.svg(
width: 24,
height: 24,
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
),
SizedBox(width: 10),
Assets.vec.trashSvg.svg(
width: 24,
height: 24,
colorFilter: ColorFilter.mode(AppColor.error, BlendMode.srcIn)),
SizedBox(width: 10,),
],
)),
],
),
),
),
Container(
width: 20,
child: Center(
child: RotatedBox(
quarterTurns: 3,
child: Text(
index < 5
? 'گاو'
: index < 12
? 'گوسفند'
: 'مرغ',
style: AppFonts.yekan8,
textAlign: TextAlign.center,
),
),
),
),
],
),
);
}, separatorBuilder: (BuildContext context, int index) =>SizedBox(height: 4,)
),
),
SizedBox(height: 10),
RElevated(
text: 'ثبت نهایی و ارسال به اتحادیه',
textStyle: AppFonts.yekan18,
height: 40,
backgroundColor: AppColor.greenNormal,
onPressed: () {},
isFullWidth: true,
),
],
),
),
),
],
);
}
@@ -278,7 +283,6 @@ class TaggingPage extends GetView<TaggingLogic> {
),
),
);
}
Widget _buildBottomSheet() {
@@ -319,6 +323,178 @@ class TaggingPage extends GetView<TaggingLogic> {
);
}
Widget _buildInfoBottomSheet() {
return BaseBottomSheet(
height: Get.height * 0.5,
bgColor: const Color(0xFFF5F5F5),
child: Card(
color: Colors.white,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
spacing: 15,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Assets.vec.editSvg.svg(
width: 16,
height: 16,
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
),
Text('محمد احمدی', style: AppFonts.yekan14),
GestureDetector(
onTap: () {
_buildDeleteDialog(onConfirm: () {
});
},
child: Assets.vec.trashSvg.svg(
width: 16,
height: 16,
colorFilter: ColorFilter.mode(AppColor.error, BlendMode.srcIn),
),
),
],
),
Container(
height: 32,
padding: EdgeInsets.all(8),
decoration: BoxDecoration(color: AppColor.blueLightHover),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'تاریخ ثبت',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),
),
Text(
'1404/2/2',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),
),
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'شماره پلاک',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),
),
Text(
'123456789012346',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'جنسیت ',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),
),
Text(
'ماده',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'نوع نژاد',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),
),
Text(
'افشاری',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'نوع گله',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),
),
Text(
'روستایی',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'شهر',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),
),
Text(
'کرج',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'سن',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),
),
Text(
'18 ماه',
textAlign: TextAlign.center,
style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDark),
),
],
),
],
),
),
),
);
}
void _buildDeleteDialog({required VoidCallback onConfirm}) {
Get.defaultDialog(
title: 'حذف دام',
middleText: 'آیا از حذف این دام مطمئن هستید؟',
confirm: ElevatedButton(
style: ElevatedButton.styleFrom(backgroundColor: AppColor.error, foregroundColor: Colors.white),
onPressed: onConfirm,
child: Text('بله'),
),
cancel: ElevatedButton(
onPressed: () {
Get.back();
},
child: Text('خیر'),
),
);
}
SizedBox _buildLiveStockImage() {
return SizedBox(
width: Get.width,
@@ -482,4 +658,107 @@ class TaggingPage extends GetView<TaggingLogic> {
labelBuilder: (item) => Text(item ?? 'گونه دام'),
);
}
ObxValue<RxBool> _buildFilterWidget() {
return ObxValue((data) {
return AnimatedContainer(
duration: Duration(milliseconds: 300),
padding: EdgeInsets.only(top: 5),
curve: Curves.easeInOut,
height: data.value ? 50 : 0,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
padding: EdgeInsets.symmetric(horizontal: 12),
child: ObxValue((data) {
return Row(
spacing: 12,
children: [
CustomChip(
title: 'انتخاب فیلتر',
index: 0,
isSelected: true,
selectedColor: AppColor.blueNormal,
onTap: (index) {},
),
RFilterChips(
title: 'درخواست‌های من',
index: 1,
isSelected: data.contains(1),
selectedColor: AppColor.yellowNormal,
onTap: (index) {
if (data.contains(1)) {
data.remove(1);
} else {
data.add(1);
}
},
),
RFilterChips(
title: 'در انتظار ثبت ',
index: 2,
selectedColor: AppColor.greenLightActive,
isSelected: data.contains(2),
onTap: (index) {
if (data.contains(2)) {
data.remove(2);
} else {
data.add(2);
}
},
),
RFilterChips(
title: 'ارجاع به تعاونی',
index: 3,
selectedColor: AppColor.blueLightHover,
isSelected: data.contains(3),
onTap: (index) {
if (data.contains(3)) {
data.remove(3);
} else {
data.add(3);
}
},
),
],
);
}, controller.filterSelected),
),
);
}, controller.filterIsSelected);
}
ObxValue<RxBool> _buildSearchWidget() {
return ObxValue((data) {
return AnimatedContainer(
duration: Duration(milliseconds: 300),
padding: EdgeInsets.only(top: 5),
curve: Curves.easeInOut,
height: data.value ? 50 : 0,
child: Visibility(
visible: data.value,
child: Padding(
padding: const EdgeInsets.only(right: 8.0, left: 20.0),
child: RTextField(
suffixIcon: Padding(
padding: const EdgeInsets.all(12.0),
child: Assets.vec.searchSvg.svg(
width: 10,
height: 10,
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
),
),
hintText: 'جستجو',
onChanged: (value) {
//controller.search(value);
},
controller: TextEditingController(),
),
),
),
);
}, controller.searchIsSelected);
}
}