This commit is contained in:
Hamza-Ayed
2023-12-31 00:11:49 +03:00
parent 1b9b0dc9e8
commit c2dc5ec44c
21 changed files with 792 additions and 496 deletions

View File

@@ -10,6 +10,7 @@ import 'package:ride/views/widgets/elevated_btn.dart';
import '../../../constant/colors.dart';
import '../../../constant/table_names.dart';
import '../../../controller/functions/toast.dart';
import 'form_search_start.dart';
class MainBottomMenuMap extends StatelessWidget {
const MainBottomMenuMap({super.key});
@@ -37,185 +38,245 @@ class MainBottomMenuMap extends StatelessWidget {
topLeft: Radius.circular(15),
topRight: Radius.circular(15),
)),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(15),
child: InkWell(
onTap: () => controller.changeMainBottomMenuMap(),
child: Container(
width: Get.width * .8,
height: Get.height * .1,
decoration: const BoxDecoration(
boxShadow: [
BoxShadow(
color: AppColor.accentColor,
blurRadius: 5,
offset: Offset(2, 4)),
BoxShadow(
color: AppColor.accentColor,
blurRadius: 5,
offset: Offset(-2, -2))
],
color: AppColor.secondaryColor,
borderRadius: BorderRadius.all(
Radius.elliptical(15, 30),
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(15),
child: InkWell(
onTap: () => controller.changeMainBottomMenuMap(),
child: Container(
width: Get.width * .8,
height: Get.height * .1,
decoration: const BoxDecoration(
boxShadow: [
BoxShadow(
color: AppColor.accentColor,
blurRadius: 5,
offset: Offset(2, 4)),
BoxShadow(
color: AppColor.accentColor,
blurRadius: 5,
offset: Offset(-2, -2))
],
color: AppColor.secondaryColor,
borderRadius: BorderRadius.all(
Radius.elliptical(15, 30),
),
),
),
child: DefaultTextStyle(
style: AppStyle.title,
child: Center(
child: controller.isPickerShown
? TextButton(
onPressed: () async {
controller.clearPolyline();
controller.data = [];
await controller.getMap(
'${controller.myLocation.latitude},${controller.myLocation.longitude}',
'${controller.newMyLocation.latitude},${controller.newMyLocation.longitude}',
);
controller.places = [];
controller.placeController.clear();
child: DefaultTextStyle(
style: AppStyle.title,
child: Center(
child: controller.isPickerShown
? TextButton(
onPressed: () async {
controller.clearPolyline();
controller.data = [];
if (controller
.startLocationFromMap ==
true) {
controller.newMyLocation =
controller
.newStartPointLocation;
controller.startLocationFromMap =
false;
controller.isPickerShown = false;
print(controller.myLocation);
print(controller
.newStartPointLocation);
} else {
controller.newMyLocation =
controller.newMyLocation;
controller.isPickerShown = false;
print(controller.myLocation);
print(controller.newMyLocation);
}
controller.showBottomSheet1();
Get.back();
controller.showBottomSheet1();
// controller.changeMainBottomMenuMap();
},
child: Row(
// await controller.getMap(
// '${controller.myLocation.latitude},${controller.myLocation.longitude}',
// '${controller.newMyLocation.latitude},${controller.newMyLocation.longitude}',
// );
controller.placesDestination = [];
controller
.placeDestinationController
.clear();
controller.showBottomSheet1();
Get.back();
controller.showBottomSheet1();
controller
.changeMainBottomMenuMap();
},
child: Row(
children: [
IconButton(
onPressed: () {
controller
.changeMainBottomMenuMap();
},
icon: controller
.isMainBottomMenuMap
? const Icon(
Icons
.arrow_circle_up_rounded,
size: 35,
)
: const Icon(
Icons
.arrow_circle_down_rounded,
size: 35,
),
),
Text(
"Click here point".tr,
style: AppStyle.title,
),
],
),
)
: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
IconButton(
onPressed: () {
controller
.changeMainBottomMenuMap();
},
icon:
controller.isMainBottomMenuMap
? const Icon(
Icons
.arrow_circle_up_rounded,
size: 35,
)
: const Icon(
Icons
.arrow_circle_down_rounded,
size: 35,
SizedBox(
height: 30,
child: Row(
children: [
IconButton(
onPressed: () {
controller
.changeMainBottomMenuMap();
},
icon: controller
.isMainBottomMenuMap
? const Icon(
Icons
.arrow_circle_up_rounded,
size: 35,
)
: const Icon(
Icons
.arrow_circle_down_rounded,
size: 35,
),
),
Text(
'${'Where to'.tr} ${box.read(BoxName.name)}'),
],
)),
Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
const SizedBox(
width: 10,
),
controller.noCarString == false
? Text(
'Nearest Car for you about '
.tr)
: Container(
decoration:
BoxDecoration(
borderRadius:
BorderRadius
.circular(12),
color:
AppColor.redColor,
),
),
Text(
"Click here to go to this location"
.tr,
style: AppStyle.title,
),
child: Padding(
padding:
const EdgeInsets
.all(6),
child: Text(
'No Car in your site. Sorry!'
.tr,
style: AppStyle
.title
.copyWith(
color: AppColor
.secondaryColor),
),
),
),
controller.noCarString == false
? Container(
decoration: BoxDecoration(
border: Border.all(
color: AppColor
.redColor,
width: 3)),
child: Padding(
padding:
const EdgeInsets
.all(4),
child: Text((controller
.nearestCar !=
null
? controller
.durationByPassenger
.toString()
: 'N/A')),
),
)
: const SizedBox(),
],
)
],
),
)
: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
SizedBox(
height: 30,
child: Row(
children: [
IconButton(
onPressed: () {
controller
.changeMainBottomMenuMap();
},
icon: controller
.isMainBottomMenuMap
? const Icon(
Icons
.arrow_circle_up_rounded,
size: 35,
)
: const Icon(
Icons
.arrow_circle_down_rounded,
size: 35,
),
),
Text(
'${'Where to'.tr} ${box.read(BoxName.name)}'),
],
)),
Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
const SizedBox(
width: 10,
),
controller.noCarString == false
? Text(
'Nearest Car for you about '
.tr)
: Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius
.circular(12),
color:
AppColor.redColor,
),
child: Padding(
padding:
const EdgeInsets
.all(6),
child: Text(
'No Car in your site. Sorry!'
.tr,
style: AppStyle.title
.copyWith(
color: AppColor
.secondaryColor),
),
),
),
controller.noCarString == false
? Container(
decoration: BoxDecoration(
border: Border.all(
color: AppColor
.redColor,
width: 3)),
child: Padding(
padding:
const EdgeInsets
.all(4),
child: Text((controller
.nearestCar !=
null
? controller
.durationByPassenger
.toString()
: 'N/A')),
),
)
: const SizedBox(),
],
)
],
),
),
)),
),
)),
),
),
),
controller.isMainBottomMenuMap
? const FavioratePlacesDialogu()
: const SizedBox(),
controller.isMainBottomMenuMap
? const SizedBox()
: Text(
'From : Current Location'.tr,
style: AppStyle.subtitle,
),
controller.isMainBottomMenuMap
? const SizedBox()
: formSearchPlaces()
],
controller.isMainBottomMenuMap
? const FavioratePlacesDialogu()
: const SizedBox(),
controller.isMainBottomMenuMap
? const SizedBox()
: InkWell(
onTap: () async {
controller.getCurrentLocationFormString();
},
child: Text(
'From : ${controller.currentLocationString}'.tr,
style: AppStyle.subtitle,
),
),
controller.isMainBottomMenuMap
? const SizedBox()
: Column(
children: [
controller.currentLocationToFormPlaces
? const SizedBox()
: formSearchPlacesStart(),
formSearchPlaces(),
const SizedBox(
height: 30,
),
MyElevatedButton(
title: 'Go to Ride',
onPressed: () async {
controller.changeMainBottomMenuMap();
await controller.getMap(
'${controller.newStartPointLocation.latitude},${controller.newStartPointLocation.longitude}',
'${controller.newMyLocation.latitude},${controller.newMyLocation.longitude}',
);
controller.currentLocationToFormPlaces =
false;
controller.placesDestination = [];
controller.clearPlacesStart();
controller.clearPlacesDestination();
controller.showBottomSheet1();
Get.back();
controller.showBottomSheet1();
})
],
)
],
),
),
),
));
@@ -270,13 +331,15 @@ class FavioratePlacesDialogu extends StatelessWidget {
children: [
TextButton(
onPressed: () async {
Get.back();
await controller.getLocation();
await controller.getMap(
'${controller.myLocation.latitude},${controller.myLocation.longitude}',
'${favoritePlaces[index]['latitude']},${favoritePlaces[index]['longitude']}',
);
// controller.changePickerShown();
controller.showBottomSheet1();
Get.back();
controller.showBottomSheet1();
},
child: Text(