This commit is contained in:
Hamza-Ayed
2023-09-11 19:12:33 +03:00
parent a626915f45
commit 8b0b5e9cef
10 changed files with 556 additions and 275 deletions

View File

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:ride/constant/colors.dart';
import 'package:ride/constant/style.dart';
import 'package:ride/controller/home/map_page_controller.dart';
import 'package:ride/views/home/map_widget.dart/cancel_raide_page.dart';
import 'package:ride/views/widgets/mycircular.dart';
@@ -53,204 +54,234 @@ class MapPage extends StatelessWidget {
// ),
// ),
body: Stack(
children: [
GetBuilder<MapController>(
builder: (controller) => controller.isloading
? const MyCircularProgressIndicator()
: GoogleMap(
onMapCreated: controller.onMapCreated,
cameraTargetBounds:
CameraTargetBounds(controller.boundsdata),
minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
onLongPress: (argument) {
Get.defaultDialog(
title: 'Are you want to go to this site'.tr,
content: Column(
children: [
Text('${argument.latitude},${argument.longitude}'),
],
),
onConfirm: () async {
controller.clearpolyline();
await controller.getMap(
'${controller.mylocation.latitude},${controller.mylocation.longitude}',
'${argument.latitude.toString()},${argument.longitude.toString()}');
body: SafeArea(
child: Stack(
children: [
GetBuilder<MapController>(
builder: (controller) => controller.isloading
? const MyCircularProgressIndicator()
: GoogleMap(
onMapCreated: controller.onMapCreated,
cameraTargetBounds:
CameraTargetBounds(controller.boundsdata),
minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
onLongPress: (argument) {
Get.defaultDialog(
title: 'Are you want to go to this site'.tr,
content: Column(
children: [
Text(
'${argument.latitude},${argument.longitude}'),
],
),
onConfirm: () async {
controller.clearpolyline();
await controller.getMap(
'${controller.mylocation.latitude},${controller.mylocation.longitude}',
'${argument.latitude.toString()},${argument.longitude.toString()}');
Get.back();
controller.bottomSheet();
controller.showBottomSheet1();
//
},
);
},
Get.back();
controller.bottomSheet();
controller.showBottomSheet1();
//
},
);
},
onTap: (argument) {
controller.hidePlaces();
onTap: (argument) {
controller.hidePlaces();
controller.changeButtomSheetShown();
// controller.bottomSheet();
},
initialCameraPosition: CameraPosition(
target: controller.mylocation,
zoom: 15,
),
markers: {
for (var carLocation
in controller.carsLocationByPassenger)
controller.changeButtomSheetShown();
// controller.bottomSheet();
},
initialCameraPosition: CameraPosition(
target: controller.mylocation,
zoom: 15,
),
markers: {
for (var carLocation
in controller.carsLocationByPassenger)
Marker(
// anchor: const Offset(4, 4),
position: carLocation,
icon: controller.carIcon,
markerId: MarkerId(carLocation.toString())),
Marker(
// anchor: const Offset(4, 4),
position: carLocation,
icon: controller.carIcon,
markerId: MarkerId(carLocation.toString())),
Marker(
markerId: MarkerId('MyLocation'.tr),
position: controller.mylocation,
draggable: true,
icon: controller.markerIcon,
onDragEnd: (value) {
print(value);
},
infoWindow: InfoWindow(title: 'my location'.tr),
),
Marker(
markerId: MarkerId('Target'.tr),
position: controller.mydestination,
draggable: true,
onDragEnd: (v) {
print(v);
},
),
},
polylines: {
Polyline(
zIndex: 2,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('route'),
points: controller.polylineCoordinates,
color: AppColor.primaryColor,
width: 5,
),
// Polyline(
// zIndex: 2,
// consumeTapEvents: true,
// geodesic: true,
// endCap: Cap.buttCap,
// startCap: Cap.buttCap,
// visible: true,
// polylineId: PolylineId('g'),
// points: [
// LatLng(controller.southwest.latitude,
// controller.southwest.longitude),
// LatLng(controller.northeast.latitude,
// controller.northeast.longitude)
// ],
// color: AppColor.primaryColor,
// width: 5,
// ),
},
// circles: {
// Circle(
// circleId: const CircleId('kk'),
// center: controller.mylocation,
// radius: 60,
// fillColor: AppColor.primaryColor,)
// },
mapType:
controller.mapType ? MapType.satellite : MapType.normal,
myLocationButtonEnabled: true,
// liteModeEnabled: true, tiltGesturesEnabled: false,
markerId: MarkerId('MyLocation'.tr),
position: controller.mylocation,
draggable: true,
icon: controller.markerIcon,
onDragEnd: (value) {
print(value);
},
infoWindow: InfoWindow(title: 'my location'.tr),
),
Marker(
markerId: MarkerId('Target'.tr),
position: controller.mydestination,
draggable: true,
onDragEnd: (v) {
print(v);
},
),
},
polylines: {
Polyline(
zIndex: 2,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('route'),
points: controller.polylineCoordinates,
color: AppColor.primaryColor,
width: 5,
),
// Polyline(
// zIndex: 2,
// consumeTapEvents: true,
// geodesic: true,
// endCap: Cap.buttCap,
// startCap: Cap.buttCap,
// visible: true,
// polylineId: PolylineId('g'),
// points: [
// LatLng(controller.southwest.latitude,
// controller.southwest.longitude),
// LatLng(controller.northeast.latitude,
// controller.northeast.longitude)
// ],
// color: AppColor.primaryColor,
// width: 5,
// ),
},
// circles: {
// Circle(
// circleId: const CircleId('kk'),
// center: controller.mylocation,
// radius: 60,
// fillColor: AppColor.primaryColor,)
// },
mapType: controller.mapType
? MapType.satellite
: MapType.normal,
myLocationButtonEnabled: true,
// liteModeEnabled: true, tiltGesturesEnabled: false,
// indoorViewEnabled: true,
trafficEnabled: controller.mapTraficON,
buildingsEnabled: true,
mapToolbarEnabled: true,
onCameraMove: (position) {
controller.newMylocation = position.target;
// print('my' + controller.mylocation.toString());
// print('new' + controller.newMylocation.toString());
},
myLocationEnabled: true,
// liteModeEnabled: true,
),
),
GetBuilder<MapController>(
builder: (controller) => Positioned(
top: 85,
left: 6,
child: Column(
children: [
AnimatedContainer(
duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTrafic,
decoration: BoxDecoration(
border: Border.all(),
color: AppColor.secondaryColor,
borderRadius: BorderRadius.circular(15)),
child: IconButton(
onPressed: () {
controller.changeMapType();
// Toast.show(context, 'This is a toast message!');
},
icon: const Icon(
Icons.satellite_alt,
size: 29,
// indoorViewEnabled: true,
trafficEnabled: controller.mapTraficON,
buildingsEnabled: true,
mapToolbarEnabled: true,
onCameraMove: (position) {
controller.newMylocation = position.target;
// print('my' + controller.mylocation.toString());
// print('new' + controller.newMylocation.toString());
},
myLocationEnabled: true,
// liteModeEnabled: true,
),
),
GetBuilder<MapController>(
builder: (controller) => Positioned(
top: 85,
left: 6,
child: Column(
children: [
AnimatedContainer(
duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTrafic,
decoration: BoxDecoration(
border: Border.all(),
color: AppColor.secondaryColor,
borderRadius: BorderRadius.circular(15)),
child: IconButton(
onPressed: () {
controller.changeMapType();
// Toast.show(context, 'This is a toast message!');
},
icon: const Icon(
Icons.satellite_alt,
size: 29,
),
),
),
),
const SizedBox(
height: 5,
),
AnimatedContainer(
duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTrafic,
decoration: BoxDecoration(
color: AppColor.secondaryColor,
border: Border.all(),
borderRadius: BorderRadius.circular(15)),
child: IconButton(
onPressed: () {
controller.changeMapTraffic();
// Toast.show(context, 'This is a toast message!');
},
icon: const Icon(
Icons.streetview_sharp,
size: 29,
const SizedBox(
height: 5,
),
AnimatedContainer(
duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTrafic,
decoration: BoxDecoration(
color: AppColor.secondaryColor,
border: Border.all(),
borderRadius: BorderRadius.circular(15)),
child: IconButton(
onPressed: () {
controller.changeMapTraffic();
// Toast.show(context, 'This is a toast message!');
},
icon: const Icon(
Icons.streetview_sharp,
size: 29,
),
),
),
),
],
)),
),
const PickerIconOnMap(),
// PickerAnimtionContainerFormPlaces(),
const MainBottomMenuMap(),
const MapMenuWidget(),
const MenuIconMapPageWidget(),
buttomSheetMapPage(),
cancelRidePage(),
GetBuilder<MapController>(
builder: (controller) => controller.data.isNotEmpty
? Positioned(
right: 5,
top: 55,
child: GestureDetector(
onTap: () {
controller.changeCancelRidePageShow();
},
child: const Icon(
Icons.clear,
size: 30,
],
)),
),
const PickerIconOnMap(),
// PickerAnimtionContainerFormPlaces(),
const MainBottomMenuMap(),
const MapMenuWidget(),
const MenuIconMapPageWidget(),
buttomSheetMapPage(),
GetBuilder<MapController>(
builder: ((controller) => controller.rideConfirm
? Positioned(
top: Get.height * .2,
left: Get.width * .2,
right: Get.width * .2,
child: AnimatedContainer(
duration: const Duration(microseconds: 300),
height: 350,
width: 200,
decoration: BoxDecoration(
border: Border.all(),
color: AppColor.secondaryColor,
borderRadius: BorderRadius.circular(15)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'Waiting for Captin ...'.tr,
style: AppStyle.title,
),
],
),
),
))
: const SizedBox()),
const CashConfirmPageShown(),
const PaymentMethodPage()
],
)
: const SizedBox())),
cancelRidePage(),
GetBuilder<MapController>(
builder: (controller) => controller.data.isNotEmpty
? Positioned(
right: 5,
top: 55,
child: GestureDetector(
onTap: () {
controller.changeCancelRidePageShow();
},
child: const Icon(
Icons.clear,
size: 30,
),
))
: const SizedBox()),
const CashConfirmPageShown(),
const PaymentMethodPage()
],
),
),
);
}

View File

@@ -76,12 +76,12 @@ class MainBottomMenuMap extends StatelessWidget {
animatedTexts: [
ScaleAnimatedText(
'${'Where to'.tr} ${box.read(BoxName.name)}'),
WavyAnimatedText(
'${'Where to'.tr} ${box.read(BoxName.name)}'),
FlickerAnimatedText(
'${'Where to'.tr} ${box.read(BoxName.name)}'),
WavyAnimatedText(
'${'Where to'.tr} ${box.read(BoxName.name)}'),
// WavyAnimatedText(
// '${'Where to'.tr} ${box.read(BoxName.name)}'),
// FlickerAnimatedText(
// '${'Where to'.tr} ${box.read(BoxName.name)}'),
// WavyAnimatedText(
// '${'Where to'.tr} ${box.read(BoxName.name)}'),
],
isRepeatingAnimation: true,
onTap: () {