Files
rasadyar_application/packages/inspection/lib/presentation/pages/inspection_map/view.dart

1114 lines
44 KiB
Dart
Raw Normal View History

2025-07-24 16:57:34 +03:30
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
2025-07-29 14:33:15 +03:30
import 'package:rasadyar_inspection/data/model/response/poultry_location/poultry_location_model.dart';
2025-07-24 16:57:34 +03:30
import 'package:rasadyar_inspection/presentation/routes/app_routes.dart';
import 'package:rasadyar_inspection/presentation/widget/base_page/view.dart';
2025-07-26 15:47:22 +03:30
import 'package:rasadyar_inspection/presentation/widget/custom_chips.dart';
2025-07-24 16:57:34 +03:30
import 'logic.dart';
class InspectionMapPage extends GetView<InspectionMapLogic> {
const InspectionMapPage({super.key});
@override
Widget build(BuildContext context) {
return BasePage(
hasSearch: true,
hasFilter: true,
hasBack: false,
defaultSearch: false,
filteringWidget: filterWidget(showIndex: 3.obs, filterIndex: 5.obs),
2025-07-29 14:33:15 +03:30
onSearchTap: _handleSearchTap,
2025-07-24 16:57:34 +03:30
widgets: [_buildMap()],
floatingActionButton: _buildGpsButton(),
);
}
2025-07-29 14:33:15 +03:30
void _handleSearchTap() {
controller.baseLogic.isSearchSelected.value = !controller.baseLogic.isSearchSelected.value;
}
2025-07-24 16:57:34 +03:30
Widget _buildMap() {
return Expanded(
child: Stack(
fit: StackFit.expand,
children: [
ObxValue((currentLocation) {
return FlutterMap(
mapController: controller.animatedMapController.mapController,
options: MapOptions(
initialCenter: currentLocation.value,
2025-07-29 10:50:18 +03:30
interactionOptions: const InteractionOptions(
flags: InteractiveFlag.all & ~InteractiveFlag.rotate,
),
initialZoom: 15,
2025-07-24 16:57:34 +03:30
onPositionChanged: (camera, hasGesture) {
2025-07-29 12:37:17 +03:30
controller.debouncedUpdateVisibleMarkers(
center: camera.center,
zoom: camera.zoom,
);
2025-07-24 16:57:34 +03:30
},
),
2025-07-29 10:50:18 +03:30
2025-07-24 16:57:34 +03:30
children: [
2025-07-26 08:06:30 +03:30
TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName: 'ir.mnpc.rasadyar',
),
2025-07-29 12:37:17 +03:30
2025-07-29 14:33:15 +03:30
ObxValue((markers) {
return MarkerClusterLayerWidget(
options: MarkerClusterLayerOptions(
maxClusterRadius: 80,
size: const Size(40, 40),
alignment: Alignment.center,
padding: const EdgeInsets.all(50),
maxZoom: 15,
markers: buildMarkers(markers),
builder: (context, clusterMarkers) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.blue,
),
child: Center(
child: Text(
clusterMarkers.length.toString(),
style: const TextStyle(color: Colors.white),
2025-07-29 12:37:17 +03:30
),
2025-07-29 14:33:15 +03:30
),
);
},
),
);
}, controller.markers2),
2025-07-24 16:57:34 +03:30
],
);
}, controller.currentLocation),
Obx(() {
if (controller.baseLogic.isSearchSelected.value) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (Get.isBottomSheetOpen != true) {
Get.bottomSheet(
searchWidget(),
isDismissible: true,
ignoreSafeArea: false,
isScrollControlled: true,
);
}
});
}
return const SizedBox.shrink();
}),
// Uncomment the following lines to enable the search widget
/* Positioned(
2025-07-24 16:57:34 +03:30
top: 10,
left: 20,
right: 20,
child: ObxValue((data) {
if (data.value) {
return SearchWidget(
onSearchChanged: (data) {
controller.baseLogic.searchValue.value = data;
},
);
} else {
return SizedBox.shrink();
}
}, controller.baseLogic.isSearchSelected),
),*/
],
),
);
}
BaseBottomSheet searchWidget() {
return BaseBottomSheet(
height: Get.height * 0.85,
rootChild: Column(
spacing: 8,
children: [
RTextField(
height: 40,
borderColor: AppColor.blackLight,
suffixIcon: ObxValue(
(data) => Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: (data.value == null)
? Assets.vec.searchSvg.svg(
width: 10,
height: 10,
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
)
: IconButton(
onPressed: () {
controller.baseLogic.searchTextController.clear();
controller.baseLogic.searchValue.value = null;
controller.baseLogic.isSearchSelected.value = false;
controller.searchedPoultryLocation.value = Resource.initial();
},
enableFeedback: true,
padding: EdgeInsets.zero,
iconSize: 24,
splashRadius: 50,
icon: Assets.vec.closeCircleSvg.svg(
width: 20,
height: 20,
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
),
),
),
controller.baseLogic.searchValue,
),
hintText: 'جستجو کنید ...',
hintStyle: AppFonts.yekan16.copyWith(color: AppColor.blueNormal),
filledColor: Colors.white,
filled: true,
controller: controller.baseLogic.searchTextController,
onChanged: (val) => controller.baseLogic.searchValue.value = val,
),
Expanded(
child: ObxValue((rxData) {
final resource = rxData.value;
final status = resource.status;
final items = resource.data;
final message = resource.message ?? 'خطا در بارگذاری';
if (status == ResourceStatus.initial) {
return Center(child: Text('ابتدا جستجو کنید'));
}
if (status == ResourceStatus.loading) {
return const Center(child: CircularProgressIndicator());
}
if (status == ResourceStatus.error) {
return Center(child: Text(message));
}
if (items == null || items.isEmpty) {
return Center(child: EmptyWidget());
}
return ListView.separated(
itemCount: items.length,
separatorBuilder: (context, index) => SizedBox(height: 8),
itemBuilder: (context, index) {
final item = items[index]; // اگر item استفاده نمیشه، می‌تونه حذف بشه
return ListItem2(
index: index,
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.cowSvg.path,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
item.unitName ?? 'N/A',
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
),
Text(
item.user?.fullname ?? '',
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'جوجه ریزی فعال',
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
),
Text(
(item.hatching != null && item.hatching!.isNotEmpty)
? 'دارد'
: 'ندراد',
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
],
),
);
},
);
}, controller.searchedPoultryLocation),
2025-07-24 16:57:34 +03:30
),
],
),
);
}
Widget _buildGpsButton() {
return ObxValue((data) {
return RFab(
backgroundColor: AppColor.greenNormal,
isLoading: data.value,
icon: Assets.vec.gpsSvg.svg(width: 40.w, height: 40.h),
onPressed: () async => await controller.determineCurrentPosition(),
);
}, controller.isLoading);
}
Widget selectedLocationWidget2({
required bool showHint,
required SlidableController sliderController,
required VoidCallback trigger,
required VoidCallback toggle,
}) {
return ObxValue((data) {
return BaseBottomSheet(
height: data.value ? 450.h : 150.h,
child: ListItemWithOutCounter(
secondChild: Column(
spacing: 8,
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 12.w),
child: Column(
spacing: 8,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'داوود خرم پور',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
),
],
),
Container(
height: 32.h,
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1.w, color: AppColor.blueLightHover),
borderRadius: BorderRadius.circular(8),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
spacing: 3,
children: [
Text(
'تاریخ بازرسی',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
),
Text(
'1403/12/12',
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
],
),
),
buildRow(
title: 'تلفن خریدار',
value: '0326598653',
valueStyle: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
),
buildRow(title: 'آخرین فعالیت', value: '1409/12/12'),
buildRow(title: 'موجودی', value: '5KG'),
buildRow(title: 'فروش رفته', value: '5KG'),
],
),
),
Row(
children: [
Expanded(
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
spacing: 7,
children: [
RElevated(
width: 40.h,
height: 38.h,
backgroundColor: AppColor.greenNormal,
child: Assets.vec.messageAddSvg.svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
onPressed: () {},
),
RElevated(
width: 150.w,
height: 40.h,
backgroundColor: AppColor.blueNormal,
onPressed: () {
/*controller.setEditData(item);
Get.bottomSheet(
addOrEditBottomSheet(true),
isScrollControlled: true,
backgroundColor: Colors.transparent,
).whenComplete(() {
});*/
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
spacing: 8,
children: [
Assets.vec.mapSvg.svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
Text(
'مسیریابی',
style: AppFonts.yekan14Bold.copyWith(color: Colors.white),
),
],
),
),
ROutlinedElevated(
width: 150.w,
height: 40.h,
onPressed: () {
2025-07-26 15:47:22 +03:30
buildDeleteDialog(onConfirm: () async {}, onRefresh: () async {});
},
borderColor: AppColor.bgIcon,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 8,
children: [
Assets.vec.securityTimeSvg.svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(AppColor.bgIcon, BlendMode.srcIn),
),
Text(
'سوابق بازرسی',
style: AppFonts.yekan14Bold.copyWith(color: AppColor.bgIcon),
),
],
),
),
],
),
),
],
),
],
),
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.cowSvg.path,
labelIconColor: AppColor.bgIcon,
onTap: () => data.value = !data.value,
selected: data.value,
2025-07-26 15:47:22 +03:30
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'داود خرم مهری پور',
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
),
Text(
'گوشت و مرغ',
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('باقی مانده', style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)),
Text(
'0 کیلوگرم',
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Assets.vec.scanBarcodeSvg.svg(),
],
),
),
);
}, controller.isSelectedDetailsLocation);
}
2025-07-29 14:33:15 +03:30
List<Marker> buildMarkers(RxList<PoultryLocationModel> markers) {
final visibleBounds = controller.animatedMapController.mapController.camera.visibleBounds;
final isZoomedIn = controller.currentZoom > 17;
final updatedMarkers = markers.map((location) {
final point = LatLng(location.lat ?? 0, location.long ?? 0);
final isVisible = visibleBounds.contains(point);
return Marker(
point: point,
width: isZoomedIn && isVisible ? 180.w : 40.h,
height: isZoomedIn && isVisible ? 50.h : 50.h,
child: GestureDetector(
onTap: () {
bool hasHatching = location.hatching != null && location.hatching!.isNotEmpty;
Get.bottomSheet(
ObxValue((data) {
return BaseBottomSheet(
height: data.value
? hasHatching
? 550.h
: 400.h
: 150.h,
child: Column(
spacing: 12,
children: [
ListItemWithOutCounter(
secondChild: Column(
spacing: 8,
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 12.w),
child: Column(
spacing: 8,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
location.unitName ?? 'N/A',
textAlign: TextAlign.center,
style: AppFonts.yekan16.copyWith(color: AppColor.greenDark),
),
],
),
Container(
height: 32.h,
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(
width: 1.w,
color: AppColor.blueLightHover,
),
borderRadius: BorderRadius.circular(8),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
spacing: 3,
2025-07-29 14:33:15 +03:30
children: [
Text(
'جوجه ریزی فعال',
style: AppFonts.yekan14.copyWith(
color: AppColor.textColor,
2025-07-29 14:33:15 +03:30
),
),
Text(
hasHatching ? 'دارد' : 'ندارد',
style: AppFonts.yekan14.copyWith(
color: AppColor.blueNormal,
2025-07-29 14:33:15 +03:30
),
),
],
),
),
buildRow(
title: 'مشخصات خریدار',
value: location.user?.fullname ?? 'N/A',
),
2025-07-29 14:33:15 +03:30
buildRow(
title: 'تلفن خریدار',
value: location.user?.mobile ?? 'N/A',
valueStyle: AppFonts.yekan14.copyWith(
color: AppColor.blueNormal,
2025-07-29 14:33:15 +03:30
),
),
2025-07-29 14:33:15 +03:30
Visibility(
visible: location.address?.city?.name != null,
child: buildRow(
title: 'شهر',
value: location.address?.city?.name ?? 'N/A',
2025-07-29 14:33:15 +03:30
),
),
Visibility(
visible: location.address?.address != null,
child: buildRow(
title: 'آردس',
value: location.address?.address ?? 'N/A',
),
),
buildRow(
title: 'شناسه یکتا',
value: location.breedingUniqueId ?? 'N/A',
),
],
2025-07-29 14:33:15 +03:30
),
),
Row(
children: [
Expanded(
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
spacing: 7,
children: [
RElevated(
width: 40.h,
height: 38.h,
backgroundColor: AppColor.greenNormal,
child: Assets.vec.messageAddSvg.svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(
Colors.white,
BlendMode.srcIn,
2025-07-29 14:33:15 +03:30
),
),
onPressed: () {},
),
RElevated(
width: 150.w,
height: 40.h,
backgroundColor: AppColor.blueNormal,
onPressed: () {
/* controller.setEditData(item);
Get.bottomSheet(
addOrEditBottomSheet(true),
isScrollControlled: true,
backgroundColor: Colors.transparent,
).whenComplete(() {});*/
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
spacing: 8,
children: [
Assets.vec.mapSvg.svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(
Colors.white,
BlendMode.srcIn,
2025-07-29 14:33:15 +03:30
),
),
Text(
'جزییات کامل',
style: AppFonts.yekan14Bold.copyWith(
color: Colors.white,
2025-07-29 14:33:15 +03:30
),
),
],
2025-07-29 14:33:15 +03:30
),
),
ROutlinedElevated(
width: 150.w,
height: 40.h,
onPressed: () {
buildDeleteDialog(
onConfirm: () async {},
onRefresh: () async {},
);
},
borderColor: AppColor.bgIcon,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 8,
children: [
Assets.vec.securityTimeSvg.svg(
width: 24.w,
height: 24.h,
colorFilter: ColorFilter.mode(
AppColor.bgIcon,
BlendMode.srcIn,
2025-07-29 14:33:15 +03:30
),
),
Text(
'سوابق بازرسی',
style: AppFonts.yekan14Bold.copyWith(
color: AppColor.bgIcon,
2025-07-29 14:33:15 +03:30
),
),
],
2025-07-29 14:33:15 +03:30
),
),
],
2025-07-29 14:33:15 +03:30
),
),
],
),
],
),
labelColor: AppColor.blueLight,
labelIcon: Assets.vec.cowSvg.path,
labelIconColor: AppColor.bgIcon,
onTap: () => data.value = !data.value,
selected: data.value,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
location.unitName ?? 'N/A',
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
),
Text(
location.user?.fullname ?? '',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'جوجه ریزی فعال',
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
),
Text(
(location.hatching != null && location.hatching!.isNotEmpty)
? 'دارد'
: 'ندراد',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Assets.vec.scanBarcodeSvg.svg(),
],
),
),
Visibility(
visible: hasHatching,
child: Container(
width: Get.width,
margin: const EdgeInsets.fromLTRB(0, 0, 10, 0),
padding: EdgeInsets.all(8.r),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1, color: AppColor.lightGreyNormalHover),
2025-07-29 14:33:15 +03:30
),
child: Column(
spacing: 8.h,
2025-07-29 14:33:15 +03:30
children: [
Container(
height: 32.h,
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: ShapeDecoration(
color: AppColor.blueLight,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1.w, color: AppColor.blueLightHover),
borderRadius: BorderRadius.circular(8),
2025-07-29 14:33:15 +03:30
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
spacing: 3,
children: [
Text(
'تاریخ',
style: AppFonts.yekan14.copyWith(color: AppColor.textColor),
2025-07-29 14:33:15 +03:30
),
Text(
location.hatching?.first.date?.formattedJalaliDate ?? 'N/A',
style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal),
2025-07-29 14:33:15 +03:30
),
],
),
),
buildRow(
title: 'باقیمانده',
value: location.hatching?.first.leftOver.separatedByComma ?? 'N/A',
),
buildRow(
title: 'سن جوجه ریزی',
value: '${location.hatching?.first.chickenAge ?? 'N/A'} روز',
),
buildRow(
title: 'شماره مجوز جوجه ریزی',
value: location.hatching?.first.licenceNumber.toString() ?? 'N/A',
2025-07-29 14:33:15 +03:30
),
],
),
),
),
],
),
);
}, controller.isSelectedDetailsLocation),
isScrollControlled: true,
isDismissible: true,
);
},
child: isZoomedIn && isVisible
? Container(
2025-07-29 14:33:15 +03:30
height: 30.h,
padding: EdgeInsets.all(5.r),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15.r),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.1),
blurRadius: 5,
offset: const Offset(0, 2),
),
],
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 8,
children: [
Assets.vec.chickenMapMarkerSvg.svg(width: 24.w, height: 24.h),
Text(location.user?.fullname ?? '', style: AppFonts.yekan12),
],
),
)
: Assets.vec.chickenMapMarkerSvg.svg(width: 24.w, height: 24.h),
),
2025-07-29 14:33:15 +03:30
);
}).toList();
return updatedMarkers;
}
2025-07-24 16:57:34 +03:30
}
Marker markerWidget({required LatLng marker, required VoidCallback onTap}) {
2025-07-28 15:57:30 +03:30
iLog('lat: ${marker.latitude}, lng: ${marker.longitude}');
2025-07-24 16:57:34 +03:30
return Marker(
point: marker,
child: GestureDetector(
onTap: onTap,
behavior: HitTestBehavior.opaque,
child: SizedBox(
width: 36,
height: 36,
child: Assets.vec.mapMarkerSvg.svg(width: 30, height: 30),
),
),
);
}
Widget filterWidget({required RxInt filterIndex, required RxInt showIndex}) {
return BaseBottomSheet(
height: Get.height * 0.5,
child: Column(
spacing: 16,
children: [
SizedBox(height: 1),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
spacing: 16,
children: [
cardWithLabel(
title: 'اصناف',
count: 1234567,
icon: Assets.vec.shopSvg.svg(width: 24.w, height: 24.h),
backgroundColor: AppColor.greenLight,
backgroundBadgeColor: AppColor.greenLightActive,
),
cardWithLabel(
title: 'دامداران',
count: 1234567,
icon: Assets.vec.peopleSvg.svg(width: 24.w, height: 24.h),
backgroundColor: AppColor.blueLight,
backgroundBadgeColor: AppColor.blueLightActive,
),
cardWithLabel(
title: 'مرغداران',
count: 1234567,
icon: Assets.vec.profile2Svg.svg(width: 24.w, height: 24.h),
backgroundColor: AppColor.redLight,
backgroundBadgeColor: AppColor.redLightActive,
),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 12,
children: [
Text(
'فیلتر نمایش',
textAlign: TextAlign.center,
style: AppFonts.yekan13.copyWith(color: AppColor.blueNormal),
),
ObxValue((data) {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
spacing: 8,
children: [
customChip(
isSelected: data.value == 0,
onTap: (data) {
filterIndex.value = data;
},
index: 0,
title: 'دامداران',
),
customChip(
isSelected: data.value == 1,
title: 'مرغداران',
onTap: (data) {
filterIndex.value = data;
},
index: 1,
),
customChip(
isSelected: data.value == 2,
title: 'اصناف',
onTap: (data) {
filterIndex.value = data;
},
index: 2,
),
],
);
}, filterIndex),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 12,
children: [
Text(
'نمایش',
textAlign: TextAlign.center,
style: AppFonts.yekan13.copyWith(color: AppColor.blueNormal),
),
ObxValue((data) {
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
spacing: 8,
children: [
customChip(
isSelected: data.value == 0,
title: 'نمایش همه',
onTap: (data) {
showIndex.value = data;
},
index: 0,
),
customChip(
isSelected: data.value == 1,
title: 'دارای تراکنش',
onTap: (data) {
showIndex.value = data;
},
index: 1,
),
2025-07-26 15:47:22 +03:30
2025-07-24 16:57:34 +03:30
customChip(
isSelected: data.value == 2,
title: 'بازرسی شده ها',
onTap: (data) {
showIndex.value = data;
},
index: 2,
),
customChip(
isSelected: data.value == 3,
title: 'بازرسی نشده ها',
onTap: (data) {
showIndex.value = data;
},
index: 3,
),
customChip(
isSelected: data.value == 4,
title: 'متخلفین',
onTap: (data) {
showIndex.value = data;
},
index: 4,
),
],
),
);
}, showIndex),
],
),
],
),
);
}
Widget cardWithLabel({
required String title,
required int count,
String unit = 'عدد',
required Widget icon,
required Color backgroundColor,
required Color backgroundBadgeColor,
}) {
return SizedBox(
width: 114.w,
height: 115.h,
child: Stack(
clipBehavior: Clip.antiAlias,
alignment: Alignment.topCenter,
children: [
Positioned(
bottom: 0,
right: 0,
left: 0,
child: Container(
width: 114.w,
height: 91.h,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
color: backgroundColor,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 0.25, color: AppColor.blackLightHover),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 6,
children: [
Text(title, style: AppFonts.yekan12.copyWith(color: AppColor.textColor)),
Text(
count.separatedByComma,
style: AppFonts.yekan16.copyWith(color: AppColor.textColor),
),
Text(unit, style: AppFonts.yekan12.copyWith(color: AppColor.textColor)),
],
),
),
),
Positioned(
top: 5.h,
child: Container(
width: 32.w,
height: 32.h,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: backgroundBadgeColor,
borderRadius: BorderRadius.circular(50),
border: Border.all(color: AppColor.borderColor, width: 0.25),
),
child: Center(child: icon),
),
),
],
),
);
}
Widget selectedLocationWidget({
required bool showHint,
required SlidableController sliderController,
required VoidCallback trigger,
required VoidCallback toggle,
}) {
if (showHint) {
trigger.call();
}
return BaseBottomSheet(
height: 150.h,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
child: Slidable(
key: Key('selectedLocationWidget'),
controller: sliderController,
endActionPane: ActionPane(
motion: StretchMotion(),
children: [
CustomSlidableAction(
onPressed: (context) {
Get.toNamed(InspectionRoutes.inspectionLocationDetails);
},
backgroundColor: AppColor.blueNormal,
foregroundColor: Colors.white,
padding: EdgeInsets.all(16),
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(8),
topRight: Radius.circular(8),
),
child: Assets.vec.mapSvg.svg(width: 24, height: 24),
),
CustomSlidableAction(
onPressed: (context) {
Get.toNamed(InspectionRoutes.inspectionAddSupervision);
},
backgroundColor: AppColor.greenNormal,
padding: EdgeInsets.all(16),
child: Assets.vec.messageAddSvg.svg(),
),
CustomSlidableAction(
onPressed: (context) {},
backgroundColor: AppColor.warning,
padding: EdgeInsets.all(16),
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(8),
topLeft: Radius.circular(8),
),
child: Assets.vec.securityTimeSvg.svg(),
),
],
),
child: GestureDetector(
onTap: toggle,
child: Container(
height: 58,
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1, color: AppColor.blackLightHover),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
Text(
'داود خرم مهری پور',
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
),
Text(
'گوشت و مرغ',
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Column(
children: [
Text(
'باقی مانده',
style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal),
),
Text(
'0 کیلوگرم',
style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover),
),
],
),
Assets.vec.scanBarcodeSvg.svg(),
],
),
),
),
),
),
);
}