feat : new logic
This commit is contained in:
@@ -6,7 +6,6 @@ import 'package:flutter_map_animations/flutter_map_animations.dart';
|
|||||||
import 'package:geolocator/geolocator.dart';
|
import 'package:geolocator/geolocator.dart';
|
||||||
import 'package:latlong2/latlong.dart';
|
import 'package:latlong2/latlong.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
import 'package:rasadyar_core/data/utils.dart';
|
|
||||||
import 'package:supervision/data/utils/marker_generator.dart';
|
import 'package:supervision/data/utils/marker_generator.dart';
|
||||||
|
|
||||||
enum BottomSheetStep { filter, markerSelected, markerDetails }
|
enum BottomSheetStep { filter, markerSelected, markerDetails }
|
||||||
@@ -21,8 +20,10 @@ class SupervisionFilterLogic extends GetxController
|
|||||||
|
|
||||||
RxInt filterIndex = 0.obs;
|
RxInt filterIndex = 0.obs;
|
||||||
RxInt showIndex = 0.obs;
|
RxInt showIndex = 0.obs;
|
||||||
|
bool showSlideHint = true;
|
||||||
|
|
||||||
Rx<BottomSheetStep> bottomSheetStep = BottomSheetStep.filter.obs;
|
Rx<BottomSheetStep> bottomSheetStep = BottomSheetStep.filter.obs;
|
||||||
|
late Rx<SlidableController> slidController;
|
||||||
|
|
||||||
Rx<MapController> mapController = MapController().obs;
|
Rx<MapController> mapController = MapController().obs;
|
||||||
late final AnimatedMapController animatedMapController;
|
late final AnimatedMapController animatedMapController;
|
||||||
@@ -113,8 +114,10 @@ class SupervisionFilterLogic extends GetxController
|
|||||||
maxHeight: 600,
|
maxHeight: 600,
|
||||||
).obs;
|
).obs;
|
||||||
|
|
||||||
bottomSheetStep.listen((data) {
|
slidController = SlidableController(this).obs;
|
||||||
tLog('1 bottomSheetStep -> ${data.name}');
|
|
||||||
|
/*bottomSheetStep.listen((data) {
|
||||||
|
tLog('1 bottomSheetStep -> ${data.nme}');
|
||||||
if (data == BottomSheetStep.filter) {
|
if (data == BottomSheetStep.filter) {
|
||||||
sheetController.value = DraggableBottomSheetController(
|
sheetController.value = DraggableBottomSheetController(
|
||||||
initialVisibility: true,
|
initialVisibility: true,
|
||||||
@@ -143,9 +146,7 @@ class SupervisionFilterLogic extends GetxController
|
|||||||
sheetController.refresh();
|
sheetController.refresh();
|
||||||
sheetController.value.toggle();
|
sheetController.value.toggle();
|
||||||
|
|
||||||
});
|
});*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -153,8 +154,19 @@ class SupervisionFilterLogic extends GetxController
|
|||||||
super.onReady();
|
super.onReady();
|
||||||
determineCurrentPosition();
|
determineCurrentPosition();
|
||||||
generatedMarkers();
|
generatedMarkers();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> triggerSlidableAnimation() async {
|
||||||
|
await Future.delayed(Duration(milliseconds: 200));
|
||||||
|
await slidController.value.openEndActionPane();
|
||||||
|
await Future.delayed(Duration(milliseconds: 200));
|
||||||
|
await slidController.value.close();
|
||||||
|
showSlideHint = !showSlideHint;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
// TODO: implement onClose
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:latlong2/latlong.dart';
|
|||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
import 'package:rasadyar_core/data/utils.dart';
|
import 'package:rasadyar_core/data/utils.dart';
|
||||||
import 'package:rasadyar_core/presentation/widget/buttons/fab.dart';
|
import 'package:rasadyar_core/presentation/widget/buttons/fab.dart';
|
||||||
|
import 'package:supervision/presentation/location_details/view.dart';
|
||||||
import 'package:supervision/presentation/routes/app_routes.dart';
|
import 'package:supervision/presentation/routes/app_routes.dart';
|
||||||
|
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
@@ -23,7 +24,15 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Stack(
|
return PopScope(
|
||||||
|
canPop: controller.sheetController.value.handleBack(),
|
||||||
|
onPopInvokedWithResult: (didPop, result) {
|
||||||
|
if (!didPop &&
|
||||||
|
controller.sheetController.value.bottomSheets.isNotEmpty) {
|
||||||
|
controller.sheetController.value.removeLastBottomSheet();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
ObxValue((currentLocation) {
|
ObxValue((currentLocation) {
|
||||||
return FlutterMap(
|
return FlutterMap(
|
||||||
@@ -32,7 +41,9 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
|
|||||||
initialCenter: currentLocation.value,
|
initialCenter: currentLocation.value,
|
||||||
initialZoom: 18,
|
initialZoom: 18,
|
||||||
onPositionChanged: (camera, hasGesture) {
|
onPositionChanged: (camera, hasGesture) {
|
||||||
controller.debouncedUpdateVisibleMarkers(center: camera.center);
|
controller.debouncedUpdateVisibleMarkers(
|
||||||
|
center: camera.center,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
@@ -64,7 +75,8 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
|
|||||||
controller.isLoading.value = true;
|
controller.isLoading.value = true;
|
||||||
controller.determineCurrentPosition().then(
|
controller.determineCurrentPosition().then(
|
||||||
(value) =>
|
(value) =>
|
||||||
controller.isLoading.value = !controller.isLoading.value,
|
controller.isLoading.value =
|
||||||
|
!controller.isLoading.value,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -77,14 +89,24 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
|
|||||||
backgroundColor: AppColor.blueNormal,
|
backgroundColor: AppColor.blueNormal,
|
||||||
icon: vecWidget(Assets.vecFilterSvg, width: 24, height: 24),
|
icon: vecWidget(Assets.vecFilterSvg, width: 24, height: 24),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (controller.bottomSheetStep.value != BottomSheetStep.filter) {
|
if (controller.bottomSheetStep.value !=
|
||||||
|
BottomSheetStep.filter) {
|
||||||
controller.bottomSheetStep.value = BottomSheetStep.filter;
|
controller.bottomSheetStep.value = BottomSheetStep.filter;
|
||||||
}
|
}
|
||||||
controller.sheetController.value.toggle();
|
controller.sheetController.value.toggle();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ObxValue((data) {
|
Obx(
|
||||||
|
() => Stack(
|
||||||
|
children:
|
||||||
|
controller.sheetController.value.bottomSheets
|
||||||
|
.map((sheet) => sheet)
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
/* ObxValue((data) {
|
||||||
return DraggableBottomSheet(
|
return DraggableBottomSheet(
|
||||||
controller: data.value,
|
controller: data.value,
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
@@ -103,8 +125,9 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
|
|||||||
}
|
}
|
||||||
}, controller.bottomSheetStep),
|
}, controller.bottomSheetStep),
|
||||||
);
|
);
|
||||||
}, controller.sheetController),
|
}, controller.sheetController),*/
|
||||||
],
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,10 +137,12 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
|
|||||||
|
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
controller.bottomSheetStep.value = BottomSheetStep.markerSelected;
|
controller.sheetController.value.addBottomSheet(
|
||||||
if (!controller.sheetController.value.isVisible.value) {
|
child: selectedLocationWidget(),
|
||||||
controller.sheetController.value.show();
|
minHeight: 0,
|
||||||
}
|
maxHeight: 250,
|
||||||
|
initHeight: 250,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
behavior: HitTestBehavior.opaque,
|
behavior: HitTestBehavior.opaque,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
@@ -130,10 +155,15 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget selectedLocationWidget() {
|
Widget selectedLocationWidget() {
|
||||||
|
if (controller.showSlideHint) {
|
||||||
|
controller.triggerSlidableAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
|
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
|
||||||
child: Slidable(
|
child: Slidable(
|
||||||
key: Key('item'),
|
key: Key('selectedLocationWidget'),
|
||||||
|
controller: controller.slidController.value,
|
||||||
endActionPane: ActionPane(
|
endActionPane: ActionPane(
|
||||||
motion: StretchMotion(),
|
motion: StretchMotion(),
|
||||||
children: [
|
children: [
|
||||||
@@ -151,7 +181,14 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
|
|||||||
child: vecWidget(Assets.vecMapSvg, width: 24, height: 24),
|
child: vecWidget(Assets.vecMapSvg, width: 24, height: 24),
|
||||||
),
|
),
|
||||||
CustomSlidableAction(
|
CustomSlidableAction(
|
||||||
onPressed: (context) {},
|
onPressed: (context) {
|
||||||
|
controller.sheetController.value.addBottomSheet(
|
||||||
|
child: LocationDetailsPage(),
|
||||||
|
initHeight: 500,
|
||||||
|
maxHeight: Get.height * 2,
|
||||||
|
minHeight: 0,
|
||||||
|
);
|
||||||
|
},
|
||||||
backgroundColor: AppColor.greenNormal,
|
backgroundColor: AppColor.greenNormal,
|
||||||
padding: EdgeInsets.all(16),
|
padding: EdgeInsets.all(16),
|
||||||
child: vecWidget(Assets.vecMessageAddSvg),
|
child: vecWidget(Assets.vecMessageAddSvg),
|
||||||
@@ -170,10 +207,12 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
|
|||||||
),
|
),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
controller.bottomSheetStep.value = BottomSheetStep.markerDetails;
|
controller.sheetController.value.addBottomSheet(
|
||||||
if (!controller.sheetController.value.isVisible.value) {
|
child: markerDetailsWidget(),
|
||||||
controller.sheetController.value.show();
|
minHeight: 0,
|
||||||
}
|
maxHeight: Get.height * 0.65,
|
||||||
|
initHeight: Get.height * 0.6,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 58,
|
height: 58,
|
||||||
@@ -581,14 +620,13 @@ class SupervisionFilterPage extends GetView<SupervisionFilterLogic> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Widget customChip({
|
Widget customChip({
|
||||||
bool isSelected = false,
|
bool isSelected = false,
|
||||||
required String title,
|
required String title,
|
||||||
required int index,
|
required int index,
|
||||||
required Function(int) onTap,
|
required Function(int) onTap,
|
||||||
}) {
|
}) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
onTap.call(index);
|
onTap.call(index);
|
||||||
@@ -614,4 +652,5 @@ Widget customChip({
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
import 'package:rasadyar_core/presentation/utils/color_utils.dart';
|
import 'package:rasadyar_core/presentation/utils/color_utils.dart';
|
||||||
import 'package:rasadyar_core/presentation/widget/tabs/new_tab.dart';
|
import 'package:rasadyar_core/presentation/widget/tabs/new_tab.dart';
|
||||||
|
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
|
|
||||||
class LocationDetailsPage extends GetView<LocationDetailsLogic> {
|
class LocationDetailsPage extends GetView<LocationDetailsLogic> {
|
||||||
@@ -12,21 +10,8 @@ class LocationDetailsPage extends GetView<LocationDetailsLogic> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
backgroundColor: AppColor.lightGreyLight,
|
||||||
automaticallyImplyLeading: false,
|
appBar: RAppBar(title: 'جزئیات محل'),
|
||||||
actions: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
child: IconButton(
|
|
||||||
onPressed: () {
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
icon: Icon(CupertinoIcons.chevron_back),
|
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
body: Column(
|
body: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@@ -84,7 +69,7 @@ class LocationDetailsPage extends GetView<LocationDetailsLogic> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ROutlinedElevatedIcon(
|
child: ROutlinedElevatedIcon(
|
||||||
icon: Icon(Icons.calendar_month),
|
icon: FaIcon(FontAwesomeIcons.calendar),
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
text: 'از تاریخ',
|
text: 'از تاریخ',
|
||||||
textStyle: AppFonts.yekan16.copyWith(
|
textStyle: AppFonts.yekan16.copyWith(
|
||||||
@@ -94,7 +79,7 @@ class LocationDetailsPage extends GetView<LocationDetailsLogic> {
|
|||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ROutlinedElevatedIcon(
|
child: ROutlinedElevatedIcon(
|
||||||
icon: Icon(Icons.calendar_month),
|
icon: FaIcon(FontAwesomeIcons.calendar),
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
text: 'تا تاریخ',
|
text: 'تا تاریخ',
|
||||||
textStyle: AppFonts.yekan16.copyWith(
|
textStyle: AppFonts.yekan16.copyWith(
|
||||||
@@ -131,7 +116,7 @@ class LocationDetailsPage extends GetView<LocationDetailsLogic> {
|
|||||||
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: GridView.builder(
|
child: GridView.builder(
|
||||||
itemCount: 50,
|
itemCount: 51,
|
||||||
physics: BouncingScrollPhysics(),
|
physics: BouncingScrollPhysics(),
|
||||||
padding: EdgeInsets.fromLTRB(20, 14, 20, 50),
|
padding: EdgeInsets.fromLTRB(20, 14, 20, 50),
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
|||||||
@@ -13,18 +13,11 @@ sealed class SupervisionPages {
|
|||||||
GetPage(
|
GetPage(
|
||||||
name: SupervisionRoutes.supervision,
|
name: SupervisionRoutes.supervision,
|
||||||
page: () => RootPage(),
|
page: () => RootPage(),
|
||||||
bindings: [
|
binding: BindingsBuilder(() {
|
||||||
BindingsBuilder.put(() => RootLogic()),
|
Get.put(RootLogic());
|
||||||
BindingsBuilder.put(() => SupervisionFilterLogic()),
|
Get.put(SupervisionFilterLogic());
|
||||||
],
|
Get.lazyPut(() => LocationDetailsLogic(), fenix: true);
|
||||||
),
|
}),
|
||||||
GetPage(
|
|
||||||
name: SupervisionRoutes.supervision,
|
|
||||||
page: () => RootPage(),
|
|
||||||
bindings: [
|
|
||||||
BindingsBuilder.put(() => RootLogic()),
|
|
||||||
BindingsBuilder.put(() => SupervisionFilterLogic()),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
|
||||||
GetPage(
|
GetPage(
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ export 'package:get/get.dart';
|
|||||||
export 'package:rasadyar_core/presentation/common/common.dart';
|
export 'package:rasadyar_core/presentation/common/common.dart';
|
||||||
export 'package:rasadyar_core/presentation/utils/utils.dart';
|
export 'package:rasadyar_core/presentation/utils/utils.dart';
|
||||||
export 'package:rasadyar_core/presentation/widget/widget.dart';
|
export 'package:rasadyar_core/presentation/widget/widget.dart';
|
||||||
|
|
||||||
|
//other packages
|
||||||
export 'package:flutter_slidable/flutter_slidable.dart';
|
export 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
|
export 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ export 'draggable_bottom_sheet/draggable_bottom_sheet.dart';
|
|||||||
export 'draggable_bottom_sheet/draggable_bottom_sheet_controller.dart';
|
export 'draggable_bottom_sheet/draggable_bottom_sheet_controller.dart';
|
||||||
export 'buttons/outline_elevated_icon.dart';
|
export 'buttons/outline_elevated_icon.dart';
|
||||||
export 'buttons/outline_elevated.dart';
|
export 'buttons/outline_elevated.dart';
|
||||||
|
export 'app_bar/r_app_bar.dart';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user