diff --git a/packages/inspection/lib/presentation/inspection_map/view.dart b/packages/inspection/lib/presentation/inspection_map/view.dart index 385af1f..f287f66 100644 --- a/packages/inspection/lib/presentation/inspection_map/view.dart +++ b/packages/inspection/lib/presentation/inspection_map/view.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_inspection/presentation/routes/app_routes.dart'; import 'package:rasadyar_inspection/presentation/widget/base_page/view.dart'; +import 'package:rasadyar_inspection/presentation/widget/list_item/list_item.dart'; import 'package:rasadyar_inspection/presentation/widget/search.dart'; import 'logic.dart'; @@ -43,7 +44,10 @@ class InspectionMapPage extends GetView { }, ), children: [ - TileLayer(urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png'), + TileLayer( + urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', + userAgentPackageName: 'ir.mnpc.rasadyar', + ), ObxValue((markers) { return MarkerLayer( markers: markers @@ -648,3 +652,69 @@ 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, + ), + ); +} diff --git a/packages/inspection/lib/presentation/widget/list_item/list_item.dart b/packages/inspection/lib/presentation/widget/list_item/list_item.dart new file mode 100644 index 0000000..fd65df6 --- /dev/null +++ b/packages/inspection/lib/presentation/widget/list_item/list_item.dart @@ -0,0 +1,242 @@ +import 'package:flutter/material.dart'; +import 'package:rasadyar_core/core.dart'; + +class ListItem extends StatelessWidget { + const ListItem({ + super.key, + required this.index, + required this.child, + required this.secondChild, + required this.labelColor, + required this.labelIcon, + required this.onTap, + required this.selected, + this.labelIconColor = AppColor.mediumGreyDarkHover, + }); + + final int index; + 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: Stack( + clipBehavior: Clip.none, + alignment: Alignment.centerRight, + children: [ + 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.fromLTRB(8, 12, 14, 12), + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + child: secondChild, + ), + crossFadeState: selected + ? CrossFadeState.showSecond + : CrossFadeState.showFirst, + duration: Duration(milliseconds: 300), + ), + ), + Container( + width: 20, + child: Center( + child: SvgGenImage.vec(labelIcon).svg( + width: 16.w, + height: 16.h, + colorFilter: ColorFilter.mode(labelColor, BlendMode.srcIn), + ), + ), + ), + ], + ), + ), + ), + + Positioned( + right: -12, + child: Container( + width: index < 999 ? 24 : null, + height: index < 999 ? 24 : null, + padding: EdgeInsets.all(2), + decoration: BoxDecoration( + color: AppColor.greenLightHover, + borderRadius: BorderRadius.circular(4), + border: Border.all(width: 0.50, color: AppColor.greenDarkActive), + ), + alignment: Alignment.center, + child: Text( + (index + 1).toString(), + style: AppFonts.yekan12.copyWith(color: Colors.black), + ), + ), + ), + ], + ), + ), + ), + ); + } +} + +class ListItem2 extends StatelessWidget { + const ListItem2({ + super.key, + required this.index, + required this.child, + required this.secondChild, + required this.labelColor, + required this.labelIcon, + required this.onTap, + required this.selected, + this.labelIconColor = AppColor.mediumGreyDarkHover, + }); + + final int index; + 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: Stack( + clipBehavior: Clip.none, + alignment: Alignment.centerRight, + children: [ + AnimatedCrossFade( + firstChild: Row( + children: [ + Expanded( + child: 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, + ), + ), + Container( + width: 20, + child: Center( + child: SvgGenImage.vec(labelIcon).svg( + width: 16.w, + height: 16.h, + //TODO + colorFilter: ColorFilter.mode( + labelIconColor ?? AppColor.mediumGreyDarkActive, + BlendMode.srcIn, + ), + ), + ), + ), + ], + ), + secondChild: Container( + padding: EdgeInsets.fromLTRB(8, 8, 12, 12), + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + ), + child: secondChild, + ), + crossFadeState: selected ? CrossFadeState.showSecond : CrossFadeState.showFirst, + duration: Duration(milliseconds: 300), + ), + + Positioned( + right: -12, + child: Container( + width: index < 999 ? 24 : null, + height: index < 999 ? 24 : null, + padding: EdgeInsets.all(2), + decoration: BoxDecoration( + color: AppColor.greenLightHover, + borderRadius: BorderRadius.circular(4), + border: Border.all(width: 0.50, color: AppColor.greenDarkActive), + ), + alignment: Alignment.center, + child: Text( + (index + 1).toString(), + style: AppFonts.yekan12.copyWith(color: Colors.black), + ), + ), + ), + ], + ), + ), + ), + ); + } +}