feat : new map page item

onTap location
This commit is contained in:
2025-07-26 09:36:07 +03:30
parent 8a4d55f6e9
commit ad456d5855
20 changed files with 335 additions and 98 deletions

View File

@@ -17,6 +17,7 @@ class InspectionMapLogic extends GetxController with GetTickerProviderStateMixin
RxList<LatLng> markers = <LatLng>[].obs;
Timer? _debounceTimer;
RxBool isLoading = false.obs;
RxBool isSelectedDetailsLocation = false.obs;
RxInt filterIndex = 0.obs;
RxInt showIndex = 0.obs;

View File

@@ -56,7 +56,7 @@ class InspectionMapPage extends GetView<InspectionMapLogic> {
marker: e,
onTap: () {
Get.bottomSheet(
selectedLocationWidget(
selectedLocationWidget2(
showHint: false,
sliderController: controller.slidController.value,
trigger: () {},
@@ -107,6 +107,196 @@ class InspectionMapPage extends GetView<InspectionMapLogic> {
);
}, 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(
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(),
],
),
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: () {
buildDeleteDialog(
onConfirm: () async {
// controller.denyAllocation(item.key ?? '');
//await controller.deleteAllocation(item);
},
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,
),
);
}, controller.isSelectedDetailsLocation);
}
}
Marker markerWidget({required LatLng marker, required VoidCallback onTap}) {
@@ -652,69 +842,3 @@ Widget selectedLocationWidget({
),
);
}
Widget selectedLocationWidget2({
required bool showHint,
required SlidableController sliderController,
required VoidCallback trigger,
required VoidCallback toggle,
}) {
if (showHint) {
trigger.call();
}
return BaseBottomSheet(
height: 150.h,
child: ListItem(
index: 0,
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(),
],
),
) ,
secondChild: Container(
height: 350.h,
color: Colors.redAccent,
),
labelColor: Colors.blue,
labelIcon: Assets.vec.mapSvg.path,
onTap: () {
},
selected: true,
),
);
}

View File

@@ -126,6 +126,107 @@ class ListItem extends StatelessWidget {
}
}
class ListItemWithOutCounter extends StatelessWidget {
const ListItemWithOutCounter({
super.key,
required this.child,
required this.secondChild,
required this.labelColor,
required this.labelIcon,
required this.onTap,
required this.selected,
this.labelIconColor = AppColor.mediumGreyDarkHover,
});
final Widget child;
final Widget secondChild;
final Color labelColor;
final String labelIcon;
final Color? labelIconColor;
final VoidCallback onTap;
final bool selected;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Container(
width: Get.width,
margin: const EdgeInsets.fromLTRB(0, 0, 10, 0),
decoration: BoxDecoration(
color: labelColor,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1, color: AppColor.lightGreyNormalHover),
),
child: AnimatedSize(
duration: Duration(milliseconds: 400),
alignment: Alignment.center,
child: AnimatedSize(
duration: Duration(milliseconds: 300),
child: Container(
width: Get.width - 30,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(8),
),
child: Row(
children: [
Expanded(
child: AnimatedCrossFade(
alignment: Alignment.center,
firstChild: Container(
height: 75,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.zero,
bottomRight: Radius.circular(8),
topLeft: Radius.zero,
topRight: Radius.circular(8),
),
),
clipBehavior: Clip.antiAlias,
child: child,
),
secondChild: Container(
padding: EdgeInsets.all(8),
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
child: secondChild,
),
crossFadeState: selected
? CrossFadeState.showSecond
: CrossFadeState.showFirst,
duration: Duration(milliseconds: 300),
),
),
Visibility(
visible: selected==false,
child: Container(
width: 20,
child: Center(
child: SvgGenImage.vec(labelIcon).svg(
width: 16.w,
height: 16.h,
colorFilter: ColorFilter.mode(labelColor, BlendMode.srcIn),
),
),
),
),
],
),
),
),
),
),
);
}
}
class ListItem2 extends StatelessWidget {
const ListItem2({
super.key,