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

@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart';
import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart';
import 'package:rasadyar_chicken/presentation/widget/list_row_item.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';

View File

@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/models/response/waiting_arrival/waiting_arrival.dart';
import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart';
import 'package:rasadyar_chicken/presentation/widget/list_row_item.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';

View File

@@ -9,7 +9,7 @@ import 'package:rasadyar_chicken/data/models/response/steward_free_bar/steward_f
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_chicken/presentation/widget/inventory_widget.dart';
import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart';
import 'package:rasadyar_chicken/presentation/widget/list_row_item.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';

View File

@@ -6,7 +6,7 @@ import 'package:rasadyar_auth/data/models/local/user_local/user_local_model.dart
import 'package:rasadyar_auth/presentation/routes/pages.dart';
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
import 'package:rasadyar_chicken/data/models/response/user_profile/user_profile.dart';
import 'package:rasadyar_chicken/presentation/widget/list_row_item.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';

View File

@@ -7,7 +7,6 @@ import 'package:rasadyar_chicken/presentation/utils/string_utils.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_chicken/presentation/widget/inventory_widget.dart';
import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart';
import 'package:rasadyar_chicken/presentation/widget/list_row_item.dart';
import 'package:rasadyar_chicken/presentation/widget/page_route.dart';
import 'package:rasadyar_core/core.dart';

View File

@@ -10,7 +10,6 @@ import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_chicken/presentation/widget/filter_bottom_sheet.dart';
import 'package:rasadyar_chicken/presentation/widget/inventory_widget.dart';
import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart';
import 'package:rasadyar_chicken/presentation/widget/list_row_item.dart';
import 'package:rasadyar_chicken/presentation/widget/page_route.dart';
import 'package:rasadyar_core/core.dart';

View File

@@ -4,7 +4,7 @@ import 'package:rasadyar_chicken/data/models/response/out_province_carcasses_buy
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_chicken/presentation/widget/filter_bottom_sheet.dart';
import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart';
import 'package:rasadyar_chicken/presentation/widget/list_row_item.dart';
import 'package:rasadyar_chicken/presentation/widget/page_route.dart';
import 'package:rasadyar_core/core.dart';

View File

@@ -6,7 +6,7 @@ import 'package:rasadyar_chicken/data/models/response/roles_products/roles_produ
import 'package:rasadyar_chicken/data/models/response/steward_free_sale_bar/steward_free_sale_bar.dart';
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart';
import 'package:rasadyar_chicken/presentation/widget/list_row_item.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';

View File

@@ -6,7 +6,7 @@ import 'package:rasadyar_chicken/data/models/response/segmentation_model/segment
import 'package:rasadyar_chicken/presentation/widget/base_page/view.dart';
import 'package:rasadyar_chicken/presentation/widget/filter_bottom_sheet.dart';
import 'package:rasadyar_chicken/presentation/widget/list_item/list_item.dart';
import 'package:rasadyar_chicken/presentation/widget/list_row_item.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';

View File

@@ -88,6 +88,9 @@ class $AssetsIconsGen {
/// File path: assets/icons/convert_cube.svg
SvgGenImage get convertCube => const SvgGenImage('assets/icons/convert_cube.svg');
/// File path: assets/icons/cow.svg
SvgGenImage get cow => const SvgGenImage('assets/icons/cow.svg');
/// File path: assets/icons/cube.svg
SvgGenImage get cube => const SvgGenImage('assets/icons/cube.svg');
@@ -280,6 +283,7 @@ class $AssetsIconsGen {
closeCircle,
closeSquare,
convertCube,
cow,
cube,
cubeBottomRotation,
cubeRotate,
@@ -429,6 +433,9 @@ class $AssetsVecGen {
/// File path: assets/vec/convert_cube.svg.vec
SvgGenImage get convertCubeSvg => const SvgGenImage.vec('assets/vec/convert_cube.svg.vec');
/// File path: assets/vec/cow.svg.vec
SvgGenImage get cowSvg => const SvgGenImage.vec('assets/vec/cow.svg.vec');
/// File path: assets/vec/cube.svg.vec
SvgGenImage get cubeSvg => const SvgGenImage.vec('assets/vec/cube.svg.vec');
@@ -621,6 +628,7 @@ class $AssetsVecGen {
closeCircleSvg,
closeSquareSvg,
convertCubeSvg,
cowSvg,
cubeSvg,
cubeBottomRotationSvg,
cubeRotateSvg,

View File

@@ -51,7 +51,7 @@ class BaseBottomSheet extends StatelessWidget {
],
),
),
SizedBox(height: 2),
SizedBox(height:8),
Expanded(child: SingleChildScrollView(child: child)),
],
),

View File

@@ -5,7 +5,7 @@ import 'package:rasadyar_core/presentation/common/app_fonts.dart';
class RElevated extends StatelessWidget {
const RElevated({
super.key,
required this.text,
this.text,
required this.onPressed,
this.foregroundColor = Colors.white,
this.backgroundColor = AppColor.blueNormal,
@@ -17,9 +17,11 @@ class RElevated extends StatelessWidget {
this.height = 56.0,
this.isFullWidth = false,
this.isLoading = false,
});
this.child,
}) : assert(text != null || child != null, 'Either text or child must be provided');
final String text;
final String? text;
final Widget? child;
final VoidCallback? onPressed;
final double width;
final double height;
@@ -41,27 +43,23 @@ class RElevated extends StatelessWidget {
style: ElevatedButton.styleFrom(
backgroundColor: backgroundColor,
foregroundColor: foregroundColor,
disabledBackgroundColor:
disabledBackgroundColor ?? backgroundColor.withAlpha(38),
disabledBackgroundColor: disabledBackgroundColor ?? backgroundColor.withAlpha(38),
disabledForegroundColor: disabledForegroundColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(radius),
),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(radius)),
minimumSize: Size(isFullWidth ? double.infinity : width, height),
padding: EdgeInsets.zero,
textStyle: textStyle ?? AppFonts.yekan18,
),
child:
isLoading
? SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
strokeWidth: 2.5,
valueColor: AlwaysStoppedAnimation<Color>(foregroundColor),
),
)
: Text(text),
child: isLoading
? SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
strokeWidth: 2.5,
valueColor: AlwaysStoppedAnimation<Color>(foregroundColor),
),
)
: child ?? Text(text!),
);
}
}

View File

@@ -16,7 +16,7 @@ class ROutlinedElevated extends StatefulWidget {
this.child,
this.width,
this.height,
});
}):assert(text!=null || child != null, 'Either text or child must be provided');
final String? text;
final VoidCallback? onPressed;
@@ -120,7 +120,7 @@ class _ROutlinedElevatedState extends State<ROutlinedElevated> {
return widget.textStyle ?? AppFonts.yekan20.copyWith(color: AppColor.blueNormal);
}),
),
child: Text(widget.text ?? ''),
child: widget.child ?? Text(widget.text ?? ''),
),
);
}

View File

@@ -21,5 +21,6 @@ export 'tabs/new_tab.dart';
export 'tabs/r_segment.dart';
export 'tabs/tab.dart';
export 'vec_widget.dart';
export 'list_row_item.dart';
//inputs
export 'inputs/inputs.dart';

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,