feat : BottomSheet manger and some changed in draggable bottom sheet

This commit is contained in:
2025-05-05 09:06:35 +03:30
parent 2ba786b556
commit 6ef1ab06c9
10 changed files with 804 additions and 755 deletions

View File

@@ -1,12 +1,10 @@
import 'dart:async';
import 'package:flutter/animation.dart';
import 'package:flutter/material.dart';
import 'package:inspection/data/utils/marker_generator.dart';
import 'package:inspection/presentation/filter/view.dart';
import 'package:rasadyar_core/core.dart';
enum BottomSheetStep { filter, markerSelected, markerDetails }
class InspectorFilterLogic extends GetxController
with GetTickerProviderStateMixin {
Rx<LatLng> currentLocation = LatLng(35.824891, 50.948025).obs;
@@ -19,22 +17,22 @@ class InspectorFilterLogic extends GetxController
RxInt showIndex = 0.obs;
bool showSlideHint = true;
Rx<BottomSheetStep> bottomSheetStep = BottomSheetStep.filter.obs;
late Rx<SlidableController> slidController;
Rx<MapController> mapController = MapController().obs;
late final AnimatedMapController animatedMapController;
late Rx<DraggableBottomSheetController> sheetController;
late DraggableBottomSheetController filterBottomSheetController;
late DraggableBottomSheetController selectedLocationBottomSheetController;
late DraggableBottomSheetController detailsLocationBottomSheetController;
late final BottomSheetManager bottomSheetManager;
Future<void> determineCurrentPosition() async {
final position = await Geolocator.getCurrentPosition(
locationSettings: AndroidSettings(accuracy: LocationAccuracy.best),
);
final latLng = LatLng(position.latitude, position.longitude);
currentLocation.value = latLng;
markers.add(latLng);
animatedMapController.animateTo(
@@ -77,7 +75,6 @@ class InspectorFilterLogic extends GetxController
allMarkers.value = generatedMarkers;
}
@override
void onInit() {
super.onInit();
@@ -87,53 +84,43 @@ class InspectorFilterLogic extends GetxController
curve: Curves.easeInOut,
cancelPreviousAnimations: true,
);
sheetController =
DraggableBottomSheetController(
initialVisibility: false,
initialHeight: 300,
minHeight: 70,
maxHeight: 600,
).obs;
filterBottomSheetController = DraggableBottomSheetController(
initialHeight: 350,
minHeight: 200,
maxHeight: Get.height * 0.5,
);
selectedLocationBottomSheetController = DraggableBottomSheetController(
initialHeight: 200,
minHeight: 100,
maxHeight: 200,
);
detailsLocationBottomSheetController = DraggableBottomSheetController(
initialHeight: Get.height * 0.5,
minHeight: Get.height * 0.37,
maxHeight: Get.height * 0.5,
);
slidController = SlidableController(this).obs;
/*bottomSheetStep.listen((data) {
tLog('1 bottomSheetStep -> ${data.nme}');
if (data == BottomSheetStep.filter) {
sheetController.value = DraggableBottomSheetController(
initialVisibility: true,
initialHeight: 300,
minHeight: 70,
maxHeight: 600,
);
} else if (data == BottomSheetStep.markerSelected) {
sheetController.value =
DraggableBottomSheetController(
initialVisibility: true,
initialHeight: 250,
minHeight: 50,
maxHeight: 300,
);
}else if(data == BottomSheetStep.markerDetails){
sheetController.value =
DraggableBottomSheetController(
initialVisibility: true,
initialHeight: 500,
minHeight: 50,
maxHeight: 700,
);
}
sheetController.refresh();
sheetController.value.toggle();
});*/
bottomSheetManager = BottomSheetManager({
filterBottomSheetController:
() => filterWidget(filterIndex: filterIndex, showIndex: showIndex),
selectedLocationBottomSheetController:
() => selectedLocationWidget(
showHint: selectedLocationBottomSheetController.isVisible.value,
sliderController: slidController.value,
trigger: triggerSlidableAnimation,
toggle: selectedLocationBottomSheetController.toggle,
),
detailsLocationBottomSheetController: () => markerDetailsWidget(),
});
}
@override
void onReady() {
super.onReady();
// determineCurrentPosition();
determineCurrentPosition();
generatedMarkers();
}
@@ -147,6 +134,7 @@ class InspectorFilterLogic extends GetxController
@override
void onClose() {
slidController.close();
super.onClose();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -113,42 +113,39 @@ class RootPage extends GetView<RootLogic> {
controller.currentIndex,
),
Align(
alignment: Alignment.bottomCenter,
child: WaveBottomNavigation(
items: [
WaveBottomNavigationItem(title: 'خانه', icon: Assets.vecMapSvg),
WaveBottomNavigationItem(
title: 'عملیات',
icon: Assets.vecUserSvg,
),
WaveBottomNavigationItem(
title: 'افزودن',
icon: Assets.vecAddSvg,
),
WaveBottomNavigationItem(
title: 'آمار',
icon: Assets.vecDiagramSvg,
),
WaveBottomNavigationItem(
title: 'تماس',
icon: Assets.vecCallSvg,
),
WaveBottomNavigationItem(
title: 'مکان ',
icon: Assets.vecGpsSvg,
),
WaveBottomNavigationItem(
title: 'تاریخ',
icon: Assets.vecCalendarSvg,
),
],
onPageChanged: (index) {
controller.changePage(index);
},
),
],
),
bottomNavigationBar: WaveBottomNavigation(
items: [
WaveBottomNavigationItem(title: 'خانه', icon: Assets.vecMapSvg),
WaveBottomNavigationItem(
title: 'عملیات',
icon: Assets.vecUserSvg,
),
WaveBottomNavigationItem(
title: 'افزودن',
icon: Assets.vecAddSvg,
),
WaveBottomNavigationItem(
title: 'آمار',
icon: Assets.vecDiagramSvg,
),
WaveBottomNavigationItem(
title: 'تماس',
icon: Assets.vecCallSvg,
),
WaveBottomNavigationItem(
title: 'مکان ',
icon: Assets.vecGpsSvg,
),
WaveBottomNavigationItem(
title: 'تاریخ',
icon: Assets.vecCalendarSvg,
),
],
onPageChanged: (index) {
controller.changePage(index);
},
),
);
}

View File

@@ -100,7 +100,7 @@ packages:
source: sdk
version: "0.0.0"
flutter_map:
dependency: "direct main"
dependency: transitive
description:
name: flutter_map
sha256: f7d0379477274f323c3f3bc12d369a2b42eb86d1e7bd2970ae1ea3cff782449a
@@ -108,7 +108,7 @@ packages:
source: hosted
version: "8.1.1"
flutter_map_animations:
dependency: "direct main"
dependency: transitive
description:
name: flutter_map_animations
sha256: bf583863561861aaaf4854ae7ed8940d79bea7d32918bf7a85d309b25235a09e
@@ -161,7 +161,7 @@ packages:
source: hosted
version: "3.0.0"
geolocator:
dependency: "direct main"
dependency: transitive
description:
name: geolocator
sha256: e7ebfa04ce451daf39b5499108c973189a71a919aa53c1204effda1c5b93b822
@@ -228,18 +228,18 @@ packages:
dependency: transitive
description:
name: hive_ce
sha256: ac66daee46ad46486a1ed12cf91e9d7479c875fb46889be8d2c96b557406647f
sha256: fdc19336f03ecd01dbc1d1afe69d87ed9336bdf996c5374a25f9c21ef5f2989e
url: "https://pub.dev"
source: hosted
version: "2.10.1"
version: "2.11.1"
hive_ce_flutter:
dependency: transitive
description:
name: hive_ce_flutter
sha256: "74c1d5f10d803446b4e7913bb272137e2724ba8a56465444f9e7713aeb60a877"
sha256: "5eaf57a5af980eda63ddaa8c34d618dc446f76fe79410f2a283522744291c05c"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
version: "2.3.0"
http:
dependency: transitive
description:
@@ -264,6 +264,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.19.0"
isolate_channel:
dependency: transitive
description:
name: isolate_channel
sha256: bafedfbcc1e9796ada179b5dac7043b33eb85d35204b089ca37d480d9c0068df
url: "https://pub.dev"
source: hosted
version: "0.2.2"
json_annotation:
dependency: transitive
description:
@@ -273,7 +281,7 @@ packages:
source: hosted
version: "4.9.0"
latlong2:
dependency: "direct main"
dependency: transitive
description:
name: latlong2
sha256: "98227922caf49e6056f91b6c56945ea1c7b166f28ffcd5fb8e72fc0b453cc8fe"
@@ -288,30 +296,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.1"
location:
dependency: "direct main"
description:
name: location
sha256: c2c4304071ec860525d5c50d142410072f8620c1d9f74874811af2e804e1a9c8
url: "https://pub.dev"
source: hosted
version: "8.0.0"
location_platform_interface:
dependency: transitive
description:
name: location_platform_interface
sha256: a3404ea6d74e89b121630be62ed8edcc7b39fd108bd19805d0ae55c397135dd7
url: "https://pub.dev"
source: hosted
version: "6.0.0"
location_web:
dependency: transitive
description:
name: location_web
sha256: "744bdff53dc455a2dc9a34474c49cde364d4fbef2aee009f8b0b4b68570c27a1"
url: "https://pub.dev"
source: hosted
version: "6.0.0"
logger:
dependency: transitive
description:
@@ -523,10 +507,10 @@ packages:
dependency: transitive
description:
name: shamsi_date
sha256: "4614789ed11bfffe5ba0aa157a20f2857ab6328528401766e0d924e453c866bd"
sha256: b6c79ff34ddfb1e9e4761347f18e30afdd7d16cc3db77defd5a40e2d93894c51
url: "https://pub.dev"
source: hosted
version: "1.0.4"
version: "1.1.0"
sky_engine:
dependency: transitive
description: flutter