This commit is contained in:
Hamza-Ayed
2024-02-04 23:53:13 +03:00
parent 87da645ae5
commit 481eff94c2
24 changed files with 708 additions and 332 deletions

View File

@@ -15,7 +15,9 @@ GetBuilder<MapDriverController> driverEndRideBar() {
right: 5,
child: Container(
decoration: AppStyle.boxDecoration,
height: mapDriverController.driverEndPage,
height: mapDriverController.remainingTimeTimerRideBegin < 60
? mapDriverController.driverEndPage = 160
: 100,
width: 200,
child: Column(
children: [

View File

@@ -33,7 +33,7 @@ GetBuilder<MapPassengerController> hexagonClipper() {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'Waiting for Captin ...'.tr,
'Waiting for Driver ...'.tr,
style: AppStyle.title,
),
// IconButton(
@@ -42,12 +42,12 @@ GetBuilder<MapPassengerController> hexagonClipper() {
// },
// icon: const Icon(Icons.add),
// ),
Text(
controller.dataCarsLocationByPassenger['message']
[controller.carsOrder]['phone']
.toString(),
style: AppStyle.title,
),
// Text(
// controller.dataCarsLocationByPassenger['message']
// [controller.carsOrder]['phone']
// .toString(),
// style: AppStyle.title,
// ),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
@@ -87,12 +87,12 @@ GetBuilder<MapPassengerController> hexagonClipper() {
.toString(),
style: AppStyle.title,
),
Text(
controller.dataCarsLocationByPassenger['message']
[controller.carsOrder]['seats']
.toString(),
style: AppStyle.title,
),
// Text(
// controller.dataCarsLocationByPassenger['message']
// [controller.carsOrder]['seats']
// .toString(),
// style: AppStyle.title,
// ),
],
),
Text(

View File

@@ -1,178 +0,0 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ride/constant/table_names.dart';
import '../../../constant/colors.dart';
import '../../../constant/style.dart';
import '../../../controller/functions/toast.dart';
import '../../../controller/home/map_passenger_controller.dart';
import '../../../main.dart';
GetBuilder<MapPassengerController> formSearchPlaces() {
// DbSql sql = DbSql.instance;
return GetBuilder<MapPassengerController>(
builder: (controller) => Column(
children: [
Padding(
padding: const EdgeInsets.all(12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: Get.width * .8,
decoration:
const BoxDecoration(color: AppColor.secondaryColor),
child: TextField(
decoration: InputDecoration(
border: const OutlineInputBorder(
borderRadius: BorderRadius.only(),
gapPadding: 4,
borderSide: BorderSide(
color: AppColor.redColor,
width: 2,
)),
suffixIcon: const Icon(Icons.search),
hintText: controller.hintTextDestinationPoint,
hintStyle: AppStyle.title,
hintMaxLines: 1,
prefixIcon: IconButton(
onPressed: () {
controller.placeDestinationController.clear();
controller.clearPlacesDestination();
},
icon: Icon(
Icons.clear,
color: Colors.red[300],
),
),
),
controller: controller.placeDestinationController,
onChanged: (value) {
if (controller
.placeDestinationController.text.length >
5) {
controller.getPlaces();
controller.changeHeightPlaces();
}
},
// onEditingComplete: () => controller.changeHeight(),
),
),
IconButton(
onPressed: () {
controller.changeMainBottomMenuMap();
controller.changePickerShown();
},
icon: const Icon(
Icons.map_outlined,
color: AppColor.greenColor,
),
),
],
),
),
// controller.placesDestination.isEmpty
// ? InkWell(
// onTap: () {
// controller.changeMainBottomMenuMap();
// controller.changePickerShown();
// },
// child: Text(
// 'Choose from Map'.tr,
// style:
// AppStyle.title.copyWith(color: AppColor.blueColor),
// ),
// )
// : const SizedBox(),
Container(
height: controller.placesDestination.isNotEmpty
? controller.height
: 0,
color: AppColor.secondaryColor,
child: ListView.builder(
itemCount: controller.placesDestination.length,
itemBuilder: (BuildContext context, int index) {
var res = controller.placesDestination[index];
return InkWell(
onTap: () async {
controller.changeHeightPlaces();
controller.changeHeightPlaces();
controller.passengerLocation = controller.newMyLocation;
controller.convertHintTextDestinationNewPlaces(index);
controller.placesDestination = [];
controller.placeDestinationController.clear();
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
Image.network(
res['icon'],
width: 20,
),
IconButton(
onPressed: () async {
await sql.insertData({
'latitude': res['geometry']
['location']['lat'],
'longitude': res['geometry']
['location']['lng'],
'name': res['name'].toString(),
'rate': res['rating'].toString(),
}, TableName.placesFavorite);
Toast.show(
context,
'${res['name']} ${'Saved Sucssefully'.tr}',
AppColor.primaryColor);
},
icon: const Icon(Icons.favorite_border),
),
],
),
Column(
children: [
Text(
res['name'].toString(),
style: AppStyle.title,
),
Text(
res['vicinity'].toString(),
style: AppStyle.subtitle,
),
],
),
Column(
children: [
Text(
'rate',
style: AppStyle.subtitle,
),
Text(
res['rating'].toString(),
style: AppStyle.subtitle,
),
],
),
],
),
const Divider(
thickness: 1,
)
],
),
),
);
},
),
)
],
));
}

View File

@@ -0,0 +1,365 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:ride/constant/box_name.dart';
import 'package:ride/constant/table_names.dart';
import 'package:ride/views/widgets/elevated_btn.dart';
import '../../../constant/colors.dart';
import '../../../constant/style.dart';
import '../../../controller/functions/toast.dart';
import '../../../controller/home/map_passenger_controller.dart';
import '../../../main.dart';
GetBuilder<MapPassengerController> formSearchPlacesDestenation() {
// DbSql sql = DbSql.instance;
if (box.read(BoxName.addWork).toString() == '' ||
box.read(BoxName.addHome).toString() == '') {
box.write(BoxName.addWork, 'addWork');
box.write(BoxName.addHome, 'addHome');
}
return GetBuilder<MapPassengerController>(
builder: (controller) => Column(
children: [
Padding(
padding: const EdgeInsets.all(6),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: Get.width * .7,
height: 40,
decoration: const BoxDecoration(
color: AppColor.secondaryColor),
child: TextField(
decoration: InputDecoration(
border: const OutlineInputBorder(
borderRadius: BorderRadius.only(),
gapPadding: 4,
borderSide: BorderSide(
color: AppColor.redColor,
width: 2,
)),
suffixIcon: const Icon(Icons.search),
hintText: controller.hintTextDestinationPoint,
hintStyle: AppStyle.title,
hintMaxLines: 1,
prefixIcon: IconButton(
onPressed: () {
controller.placeDestinationController.clear();
controller.clearPlacesDestination();
},
icon: Icon(
Icons.clear,
color: Colors.red[300],
),
),
),
controller: controller.placeDestinationController,
onChanged: (value) {
if (controller
.placeDestinationController.text.length >
5) {
controller.getPlaces();
controller.changeHeightPlaces();
}
},
// onEditingComplete: () => controller.changeHeight(),
),
),
IconButton(
onPressed: () {
controller.changeMainBottomMenuMap();
controller.changePickerShown();
},
icon: const Icon(
Icons.map_outlined,
color: AppColor.greenColor,
),
),
IconButton(
onPressed: () async {
List recentLocations = await sql.getCustomQuery(
'''
SELECT * FROM ${TableName.recentLocations}
ORDER BY id DESC
LIMIT 4
''');
Get.defaultDialog(
title: 'Latest Recent Trip'.tr,
content: recentLocations.isEmpty
? Center(
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
const Icon(
Icons.hourglass_empty_rounded,
size: 99,
color: AppColor.primaryColor,
),
Text(
'You Dont Have Any places yet !'.tr,
style: AppStyle.title,
),
],
),
)
: SizedBox(
height: Get.width * .5,
width: Get.width * .8,
child: ListView.builder(
itemCount: recentLocations.length,
itemBuilder:
(BuildContext context, int index) {
return Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
TextButton(
onPressed: () async {
Get.back();
controller
.convertHintTextDestinationNewPlacesFromRecent(
recentLocations,
index);
},
child: Text(
recentLocations[index]
['name'],
style: AppStyle.title,
),
),
IconButton(
onPressed: () async {
await sql.deleteData(
TableName.placesFavorite,
recentLocations[index]
['id']);
Get.back();
// ignore: use_build_context_synchronously
Toast.show(
context,
'${'You are Delete'.tr} ${recentLocations[index]['name']} from your list',
AppColor.redColor);
// Get.snackbar('Deleted'.tr,
// '${'You are Delete'.tr} ${favoritePlaces[index]['name']} from your list',
// backgroundColor:
// AppColor.accentColor);
},
icon: const Icon(
Icons.favorite_outlined),
),
],
);
},
),
),
);
// controller.changeMainBottomMenuMap();
// controller.changePickerShown();
},
icon: const Icon(
Icons.recent_actors,
color: AppColor.blueColor,
),
),
],
),
SizedBox(
height: 50,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
InkWell(
onTap: () {
if (box.read(BoxName.addWork) == 'addWork') {
controller.workLocationFromMap = true;
controller.changeMainBottomMenuMap();
controller.changePickerShown();
} else {
controller.hintTextDestinationPoint = 'To Work';
print(box.read(BoxName.addWork));
final latLng = LatLng(
double.parse(
box.read(BoxName.addWork).split(',')[0]),
double.parse(
box.read(BoxName.addWork).split(',')[1]),
);
print(latLng);
controller.newMyLocation = latLng;
controller.update();
}
},
onLongPress: () {
Get.defaultDialog(
title: 'Do you want to change Work location',
middleText: '',
confirm: MyElevatedButton(
title: 'Yes'.tr,
onPressed: () {
Get.back();
controller.workLocationFromMap = true;
controller.changeMainBottomMenuMap();
controller.changePickerShown();
}));
},
child: Text(
'Work : ${box.read(BoxName.addWork) == 'addWork' ? 'Add Work' : box.read(BoxName.addWork).toString().split(',')[0] + box.read(BoxName.addWork).toString().split(',')[1]} '),
),
InkWell(
onLongPress: () {
Get.defaultDialog(
title: 'Do you want to change Home location',
middleText: '',
confirm: MyElevatedButton(
title: 'Yes'.tr,
onPressed: () {
Get.back();
controller.homeLocationFromMap = true;
controller.changeMainBottomMenuMap();
controller.changePickerShown();
}));
},
onTap: () {
if (box.read(BoxName.addHome) == 'addHome') {
controller.homeLocationFromMap = true;
controller.changeMainBottomMenuMap();
controller.changePickerShown();
} else {
controller.hintTextDestinationPoint = 'To Home';
print(box.read(BoxName.addHome));
final latLng = LatLng(
double.parse(
box.read(BoxName.addHome).split(',')[0]),
double.parse(
box.read(BoxName.addHome).split(',')[1]),
);
print(latLng);
controller.newMyLocation = latLng;
controller.update();
}
},
child: Text(
'Home : ${box.read(BoxName.addHome) == 'addHome' ? 'Add Home' : box.read(BoxName.addHome)} '),
),
],
),
)
],
),
),
// controller.placesDestination.isEmpty
// ? InkWell(
// onTap: () {
// controller.changeMainBottomMenuMap();
// controller.changePickerShown();
// },
// child: Text(
// 'Choose from Map'.tr,
// style:
// AppStyle.title.copyWith(color: AppColor.blueColor),
// ),
// )
// : const SizedBox(),
Container(
height: controller.placesDestination.isNotEmpty
? controller.height
: 0,
color: AppColor.secondaryColor,
child: ListView.builder(
itemCount: controller.placesDestination.length,
itemBuilder: (BuildContext context, int index) {
var res = controller.placesDestination[index];
return InkWell(
onTap: () async {
controller.changeHeightPlaces();
await sql.insertData({
'latitude': res['geometry']['location']['lat'],
'longitude': res['geometry']['location']['lng'],
'name': res['name'].toString(),
'rate': res['rating'].toString(),
}, TableName.recentLocations);
controller.changeHeightPlaces();
controller.passengerLocation = controller.newMyLocation;
controller.convertHintTextDestinationNewPlaces(index);
controller.placesDestination = [];
controller.placeDestinationController.clear();
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
Image.network(
res['icon'],
width: 20,
),
IconButton(
onPressed: () async {
await sql.insertData({
'latitude': res['geometry']
['location']['lat'],
'longitude': res['geometry']
['location']['lng'],
'name': res['name'].toString(),
'rate': res['rating'].toString(),
}, TableName.placesFavorite);
Toast.show(
context,
'${res['name']} ${'Saved Sucssefully'.tr}',
AppColor.primaryColor);
},
icon: const Icon(Icons.favorite_border),
),
],
),
Column(
children: [
Text(
res['name'].toString(),
style: AppStyle.title,
),
Text(
res['vicinity'].toString(),
style: AppStyle.subtitle,
),
],
),
Column(
children: [
Text(
'rate',
style: AppStyle.subtitle,
),
Text(
res['rating'].toString(),
style: AppStyle.subtitle,
),
],
),
],
),
const Divider(
thickness: 1,
)
],
),
),
);
},
),
)
],
));
}

View File

@@ -15,15 +15,16 @@ GetBuilder<MapPassengerController> formSearchPlacesStart() {
builder: (controller) => Column(
children: [
Padding(
padding: const EdgeInsets.all(12),
padding: const EdgeInsets.all(8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: Get.width * .8,
height: 40,
decoration:
const BoxDecoration(color: AppColor.secondaryColor),
child: TextField(
child: TextFormField(
decoration: InputDecoration(
border: const OutlineInputBorder(
borderRadius: BorderRadius.only(),

View File

@@ -2,10 +2,9 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ride/constant/box_name.dart';
import 'package:ride/constant/style.dart';
import 'package:ride/controller/firebase/firbase_messge.dart';
import 'package:ride/controller/home/map_passenger_controller.dart';
import 'package:ride/main.dart';
import 'package:ride/views/home/map_widget.dart/form_search_places.dart';
import 'package:ride/views/home/map_widget.dart/form_search_places_destenation.dart';
import 'package:ride/views/widgets/elevated_btn.dart';
import '../../../constant/colors.dart';
@@ -69,18 +68,53 @@ class MainBottomMenuMap extends StatelessWidget {
controller.newMyLocation =
controller
.newStartPointLocation;
controller.hintTextStartPoint =
'${controller.newStartPointLocation.latitude.toStringAsFixed(4)} , ${controller.newStartPointLocation.longitude.toStringAsFixed(4)}';
controller.startLocationFromMap =
false;
controller.isPickerShown = false;
// print(controller.myLocation);
// print(controller
// .newStartPointLocation);
} else {
} else if (controller
.workLocationFromMap ==
true) {
controller
.hintTextDestinationPoint =
'To Work'.tr;
box.write(BoxName.addWork,
'${controller.newMyLocation.latitude.toStringAsFixed(4)} , ${controller.newMyLocation.longitude.toStringAsFixed(4)}');
controller.newMyLocation =
controller.newMyLocation;
controller.isPickerShown = false;
controller.workLocationFromMap =
false;
Toast.show(
context,
'Work Saved'.tr,
AppColor.greenColor);
} else if (controller
.homeLocationFromMap ==
true) {
controller
.hintTextDestinationPoint =
'To Home'.tr;
box.write(BoxName.addHome,
'${controller.newMyLocation.latitude.toStringAsFixed(4)} , ${controller.newMyLocation.longitude.toStringAsFixed(4)}');
controller.newMyLocation =
controller.newMyLocation;
controller.isPickerShown = false;
controller.homeLocationFromMap =
false;
controller.update();
Toast.show(
context,
'Home Saved'.tr,
AppColor.greenColor);
} else {
controller
.hintTextDestinationPoint =
'${controller.newMyLocation.latitude.toStringAsFixed(4)} , ${controller.newMyLocation.longitude.toStringAsFixed(4)}';
controller.newMyLocation =
controller.newMyLocation;
controller.isPickerShown = false;
// print(controller.myLocation);
// print(controller.newMyLocation);
}
controller.placesDestination = [];
@@ -121,94 +155,96 @@ class MainBottomMenuMap extends StatelessWidget {
],
),
)
: Column(
: Row(
mainAxisAlignment:
MainAxisAlignment.center,
MainAxisAlignment.spaceEvenly,
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(
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,
),
),
Column(
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),
SizedBox(
height: 30,
child: Text(
'${'Where to'.tr} ${box.read(BoxName.name)}')),
Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
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.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(),
],
)
],
)
),
],
),
),
@@ -236,12 +272,12 @@ class MainBottomMenuMap extends StatelessWidget {
controller.currentLocationToFormPlaces
? const SizedBox()
: formSearchPlacesStart(),
formSearchPlaces(),
formSearchPlacesDestenation(),
const SizedBox(
height: 30,
height: 10,
),
MyElevatedButton(
title: 'Get Direction of Trip'.tr,
title: 'Get Details of Trip'.tr,
onPressed: () async {
controller.changeMainBottomMenuMap();
@@ -269,20 +305,6 @@ class MainBottomMenuMap extends StatelessWidget {
style: AppStyle.title,
),
),
// IconButton(
// onPressed: () {
// FirebaseMessagesController()
// .sendNotificationToAnyWithoutData(
// 'title',
// 'body',
// // 'e5IXztYGS1W9zFvv-gmMRL:APA91bF7-fFzksCRXIk0Fm7IfQuhHL0df-vnDW8DNNKa3sWea649j3Obc8PhyJo9UOxKBtrvoJxYcbjclFKpvycAuhG0lv_e4hkavy-LZ6SsAu5J5bYrPz6-0BbyLdLUHoBuOFlNMvmN');
// 'eoV61-RSFUxLrCa88xaSG2:APA91bFmgGVTVH0mhjGhFqrB2_rMf0l0udBUzEUW-V2XlxtnYeDTnpESYRRCI_tMQnbDqQ3PK7pFMzW0-CZolS-pURSkwbwvnbVtV9VHB2UuOrKG3MYpGFsWfmjUdyRIOe30nx-eVkOu');
// },
// icon: const Icon(
// Icons.add,
// color: AppColor.blueColor,
// ),
// ),
],
)
],

View File

@@ -7,7 +7,7 @@ import '../../../constant/style.dart';
import '../../../controller/home/map_passenger_controller.dart';
import '../../../main.dart';
import '../../widgets/elevated_btn.dart';
import 'form_search_places.dart';
import 'form_search_places_destenation.dart';
class PickerAnimtionContainerFormPlaces extends StatelessWidget {
PickerAnimtionContainerFormPlaces({
@@ -73,7 +73,7 @@ class PickerAnimtionContainerFormPlaces extends StatelessWidget {
controller.isPickerShown
? InkWell(
onTap: () {},
child: formSearchPlaces(),
child: formSearchPlacesDestenation(),
)
: Row(
mainAxisAlignment:

View File

@@ -19,7 +19,6 @@ class WaletCaptain extends StatelessWidget {
Get.put(CaptainWalletController());
@override
Widget build(BuildContext context) {
Get.put(CreditCardController());
return MyScafolld(
title: 'Captain Wallet'.tr,
body: [