feat : BottomSheet manger and some changed in draggable bottom sheet
This commit is contained in:
@@ -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
@@ -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);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user