From 8622785385e2c4c00c0fe5efd60eefbbb62773c0 Mon Sep 17 00:00:00 2001 From: "mr.mojtaba" Date: Mon, 2 Jun 2025 11:45:02 +0330 Subject: [PATCH] feat : app bar --- .../lib/presentation/filter/view.dart | 199 ++++++------------ 1 file changed, 66 insertions(+), 133 deletions(-) diff --git a/packages/inspection/lib/presentation/filter/view.dart b/packages/inspection/lib/presentation/filter/view.dart index 6a65bc1..1508409 100644 --- a/packages/inspection/lib/presentation/filter/view.dart +++ b/packages/inspection/lib/presentation/filter/view.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:rasadyar_inspection/presentation/routes/app_routes.dart'; import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_core/presentation/widget/buttons/fab.dart'; +import 'package:rasadyar_inspection/presentation/routes/app_routes.dart'; import 'logic.dart'; @@ -11,24 +11,41 @@ class SupervisionFilterPage extends GetView { @override Widget build(BuildContext context) { return Scaffold( - appBar: RAppBar.noBack(title: 'نقشه'), + appBar: RAppBar.noBack(title: 'نقشه', additionalActions: [_searchButton(), _filterButton()]), body: PopScope( canPop: !controller.bottomSheetManager.isAnyVisible, onPopInvokedWithResult: (didPop, result) { controller.bottomSheetManager.closeFirstVisible(); }, child: Stack( - children: [ - _buildMap(), - _buildGpsButton(), - _buildFilterButton(), - Obx(() => controller.bottomSheetManager.buildVisibleSheet()), - ], + children: [_buildMap(), _buildGpsButton(), Obx(() => controller.bottomSheetManager.buildVisibleSheet())], ), ), ); } + GestureDetector _searchButton() { + return GestureDetector( + onTap: () async{ + + }, + child: Assets.vec.searchSvg + .svg(width: 24, height: 24, colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn)) + .paddingOnly(left: 16), + ); + } + + GestureDetector _filterButton() { + return GestureDetector( + onTap: () { + controller.filterBottomSheetController.toggle(); + }, + child: Assets.vec.filterSvg + .svg(width: 24, height: 24, colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn)) + .paddingOnly(left: 16), + ); + } + Widget _buildMap() { return ObxValue((currentLocation) { return FlutterMap( @@ -41,25 +58,19 @@ class SupervisionFilterPage extends GetView { }, ), children: [ - TileLayer( - urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', - ), + TileLayer(urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png'), ObxValue((markers) { return MarkerLayer( - markers: - markers - .map( - (e) => markerWidget( - marker: e, - onTap: () { - controller - .selectedLocationBottomSheetController - .isVisible - .value = true; - }, - ), - ) - .toList(), + markers: markers + .map( + (e) => markerWidget( + marker: e, + onTap: () { + controller.selectedLocationBottomSheetController.isVisible.value = true; + }, + ), + ) + .toList(), ); }, controller.markers), ], @@ -70,12 +81,12 @@ class SupervisionFilterPage extends GetView { Widget _buildGpsButton() { return Positioned( right: 10, - bottom: 83, + bottom: 15, child: ObxValue((data) { - return RFab.small( + return RFab( backgroundColor: AppColor.greenNormal, isLoading: data.value, - icon: Assets.vec.gpsSvg.svg(), + icon: Assets.vec.gpsSvg.svg(width: 28, height: 28), onPressed: () async { controller.isLoading.value = true; await controller.determineCurrentPosition(); @@ -85,18 +96,6 @@ class SupervisionFilterPage extends GetView { }, controller.isLoading), ); } - - Widget _buildFilterButton() { - return Positioned( - right: 10, - bottom: 30, - child: RFab.small( - backgroundColor: AppColor.blueNormal, - icon: Assets.vec.filterSvg.svg(width: 24,height: 24), - onPressed: () => controller.filterBottomSheetController.toggle(), - ), - ); - } } Marker markerWidget({required LatLng marker, required VoidCallback onTap}) { @@ -105,14 +104,7 @@ Marker markerWidget({required LatLng marker, required VoidCallback onTap}) { child: GestureDetector( onTap: onTap, behavior: HitTestBehavior.opaque, - child: SizedBox( - width: 36, - height: 36, - child:Assets.vec.mapMarkerSvg.svg( - width: 30, - height: 30, - ) - ), + child: SizedBox(width: 36, height: 36, child: Assets.vec.mapMarkerSvg.svg(width: 30, height: 30)), ), ); } @@ -316,9 +308,7 @@ Widget markerDetailsWidget() { Text( 'داود خرم پور', textAlign: TextAlign.center, - style: AppFonts.yekan16.copyWith( - color: AppColor.darkGreyDarkHover, - ), + style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyDarkHover), ), Spacer(), vecWidgetWithOnTap( @@ -355,9 +345,7 @@ Widget markerDetailsWidget() { padding: EdgeInsets.symmetric(horizontal: 10, vertical: 4), decoration: ShapeDecoration( color: AppColor.blueLight, - shape: RoundedRectangleBorder( - side: BorderSide(width: 1, color: AppColor.blueLightHover), - ), + shape: RoundedRectangleBorder(side: BorderSide(width: 1, color: AppColor.blueLightHover)), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -365,16 +353,12 @@ Widget markerDetailsWidget() { Text( 'باقی مانده', textAlign: TextAlign.center, - style: AppFonts.yekan14.copyWith( - color: AppColor.darkGreyDarkHover, - ), + style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), ), Text( '0 کیلوگرم', textAlign: TextAlign.center, - style: AppFonts.yekan14.copyWith( - color: AppColor.darkGreyDarkHover, - ), + style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), ), ], ), @@ -387,16 +371,12 @@ Widget markerDetailsWidget() { Text( 'شماره همراه', textAlign: TextAlign.center, - style: AppFonts.yekan14.copyWith( - color: AppColor.darkGreyDarkHover, - ), + style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), ), Text( '0326598653', textAlign: TextAlign.center, - style: AppFonts.yekan14.copyWith( - color: AppColor.darkGreyDarkHover, - ), + style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), ), ], ), @@ -408,17 +388,13 @@ Widget markerDetailsWidget() { Text( 'آخرین فعالیت', textAlign: TextAlign.center, - style: AppFonts.yekan14.copyWith( - color: AppColor.darkGreyDarkHover, - ), + style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), ), Text( '1409/12/12', textAlign: TextAlign.center, - style: AppFonts.yekan14.copyWith( - color: AppColor.darkGreyDarkHover, - ), + style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), ), ], ), @@ -430,16 +406,12 @@ Widget markerDetailsWidget() { Text( 'موجودی', textAlign: TextAlign.center, - style: AppFonts.yekan14.copyWith( - color: AppColor.darkGreyDarkHover, - ), + style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), ), Text( '5کیلوگرم', textAlign: TextAlign.center, - style: AppFonts.yekan14.copyWith( - color: AppColor.darkGreyDarkHover, - ), + style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), ), ], ), @@ -454,16 +426,12 @@ Widget markerDetailsWidget() { Text( 'فروش رفته', textAlign: TextAlign.center, - style: AppFonts.yekan14.copyWith( - color: AppColor.darkGreyDarkHover, - ), + style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), ), Text( '0 کیلوگرم', textAlign: TextAlign.center, - style: AppFonts.yekan14.copyWith( - color: AppColor.darkGreyDarkHover, - ), + style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), ), ], ), @@ -473,12 +441,7 @@ Widget markerDetailsWidget() { ); } -Widget customChip({ - bool isSelected = false, - required String title, - required int index, - required Function(int) onTap, -}) { +Widget customChip({bool isSelected = false, required String title, required int index, required Function(int) onTap}) { return GestureDetector( onTap: () { onTap.call(index); @@ -489,18 +452,14 @@ Widget customChip({ decoration: BoxDecoration( color: isSelected ? AppColor.blueNormal : AppColor.whiteGreyNormal, borderRadius: BorderRadius.circular(8), - border: - isSelected - ? Border.fromBorderSide(BorderSide.none) - : Border.all(width: 0.25, color: const Color(0xFFB0B0B0)), + border: isSelected + ? Border.fromBorderSide(BorderSide.none) + : Border.all(width: 0.25, color: const Color(0xFFB0B0B0)), ), child: Text( title, textAlign: TextAlign.center, - style: - isSelected - ? AppFonts.yekan10.copyWith(color: AppColor.whiteLight) - : AppFonts.yekan10, + style: isSelected ? AppFonts.yekan10.copyWith(color: AppColor.whiteLight) : AppFonts.yekan10, ), ), ); @@ -531,11 +490,8 @@ Widget selectedLocationWidget({ 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), + borderRadius: BorderRadius.only(bottomRight: Radius.circular(8), topRight: Radius.circular(8)), + child: Assets.vec.mapSvg.svg(width: 24, height: 24), ), CustomSlidableAction( onPressed: (context) { @@ -549,12 +505,9 @@ Widget selectedLocationWidget({ 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()), - + borderRadius: BorderRadius.only(bottomLeft: Radius.circular(8), topLeft: Radius.circular(8)), + child: Assets.vec.securityTimeSvg.svg(), + ), ], ), child: GestureDetector( @@ -572,34 +525,14 @@ Widget selectedLocationWidget({ children: [ Column( children: [ - Text( - 'داود خرم مهری پور', - style: AppFonts.yekan10.copyWith( - color: AppColor.blueNormal, - ), - ), - Text( - 'گوشت و مرغ', - style: AppFonts.yekan12.copyWith( - color: AppColor.darkGreyDarkHover, - ), - ), + 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, - ), - ), + Text('باقی مانده', style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)), + Text('0 کیلوگرم', style: AppFonts.yekan12.copyWith(color: AppColor.darkGreyDarkHover)), ], ), Assets.vec.scanBarcodeSvg.svg(),