This commit is contained in:
Hamza-Ayed
2023-10-16 16:53:27 +03:00
parent 2105de243c
commit 06905be0e9
13 changed files with 339 additions and 191 deletions

View File

@@ -327,7 +327,7 @@ GetBuilder<MapPassengerController> buttomSheetMapPage() {
.tr,
style: AppStyle.title,
),
Container(
SizedBox(
height:
200, // Set the desired height here
child: CupertinoPicker(

View File

@@ -71,24 +71,26 @@ class MainBottomMenuMap extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
height: 30,
child: AnimatedTextKit(
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)}'),
],
isRepeatingAnimation: true,
onTap: () {
print("Tap Event");
},
),
),
height: 30,
child: Text(
'${'Where to'.tr} ${box.read(BoxName.name)}')
// AnimatedTextKit(
// 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)}'),
// ],
// isRepeatingAnimation: true,
// onTap: () {
// print("Tap Event");
// },
// ),
),
Row(
mainAxisAlignment:
MainAxisAlignment.center,
@@ -148,96 +150,88 @@ class FavioratePlacesDialogu extends StatelessWidget {
builder: (controller) => DefaultTextStyle(
style: AppStyle.title,
child: Center(
child: AnimatedTextKit(
animatedTexts: [
TypewriterAnimatedText('Favorite Places'.tr),
ScaleAnimatedText(
'Favorite Places'.tr,
),
// TyperAnimatedText(
// 'Favorite Places'.tr,
// ),
],
isRepeatingAnimation: true,
onTap: () async {
List favoritePlaces =
await sql.getAllData(TableName.placesFavorite);
print(favoritePlaces);
Get.defaultDialog(
title: 'Favorite Places'.tr,
content: SizedBox(
width: Get.width * .8,
height: 300,
child: favoritePlaces.isEmpty
? Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
child: InkWell(
onTap: () async {
List favoritePlaces =
await sql.getAllData(TableName.placesFavorite);
// print(favoritePlaces);
Get.defaultDialog(
title: 'Favorite Places'.tr,
content: SizedBox(
width: Get.width * .8,
height: 300,
child: favoritePlaces.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,
),
],
),
)
: ListView.builder(
itemCount: favoritePlaces.length,
itemBuilder: (BuildContext context, int index) {
return Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
const Icon(
Icons.hourglass_empty_rounded,
size: 99,
color: AppColor.primaryColor,
TextButton(
onPressed: () async {
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(
favoritePlaces[index]['name'],
style: AppStyle.title,
),
),
Text(
'You Dont Have Any places yet !'.tr,
style: AppStyle.title,
IconButton(
onPressed: () async {
await sql.deleteData(
TableName.placesFavorite,
favoritePlaces[index]['id']);
Get.back();
// ignore: use_build_context_synchronously
Toast.show(
context,
'${'You are Delete'.tr} ${favoritePlaces[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),
),
],
),
)
: ListView.builder(
itemCount: favoritePlaces.length,
itemBuilder: (BuildContext context, int index) {
return Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
TextButton(
onPressed: () async {
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(
favoritePlaces[index]['name'],
style: AppStyle.title,
),
),
IconButton(
onPressed: () async {
await sql.deleteData(
TableName.placesFavorite,
favoritePlaces[index]['id']);
Get.back();
// ignore: use_build_context_synchronously
Toast.show(
context,
'${'You are Delete'.tr} ${favoritePlaces[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),
),
],
);
},
),
),
cancel: MyElevatedButton(
title: 'Back'.tr, onPressed: () => Get.back()),
);
},
);
},
),
),
cancel: MyElevatedButton(
title: 'Back'.tr, onPressed: () => Get.back()),
);
},
child: Text(
'\u{1F3D8} ' 'Favorite Places'.tr,
style: AppStyle.title,
),
),
)),
));
}
}

View File

@@ -1,5 +1,8 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ride/constant/box_name.dart';
import 'package:ride/controller/profile/profile_controller.dart';
import 'package:ride/main.dart';
import 'package:ride/views/widgets/elevated_btn.dart';
import '../../../constant/colors.dart';
@@ -13,6 +16,7 @@ class RideBeginPassenger extends StatelessWidget {
@override
Widget build(BuildContext context) {
ProfileController profileController = Get.put(ProfileController());
return GetBuilder<MapPassengerController>(builder: (controller) {
if (controller.rideTimerBegin) {
return Positioned(
@@ -26,6 +30,7 @@ class RideBeginPassenger extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'You will arrive to your destination after '.tr,
@@ -50,34 +55,137 @@ class RideBeginPassenger extends StatelessWidget {
)
],
),
controller.remainingTimeTimerRideBegin < 5
? MyElevatedButton(
title:
'If you in destination Now. Press finish The Ride',
onPressed: () async {
//todo finish the trip and rest all counter ,start new counter of the trip time
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
IconButton(
onPressed: () {
if (box.read(BoxName.sosPhonePassenger).toString() ==
'') {
Get.defaultDialog(
title: 'You dont Add Emergency Phone Yet!'.tr,
content: Column(
children: [
Form(
key: controller.sosFormKey,
child: TextFormField(
keyboardType: TextInputType
.phone, // Set the keyboard type to phone
validator: (value) {
if (value!.isEmpty ||
value.length < 10) {
return 'Please enter a phone number';
}
// Add additional validation if needed
return null;
},
decoration: const InputDecoration(
border: OutlineInputBorder(),
hintText: 'Type here',
),
),
)
],
),
confirm: MyElevatedButton(
title: 'Add Phone'.tr,
onPressed: () async {
await profileController
.updatField('sosPhone');
box.write(
BoxName.sosPhonePassenger,
profileController
.prfoileData['sosPhone']);
}));
} else {
controller
.sendSMS(box.read(BoxName.sosPhonePassenger));
}
},
icon: const Icon(
Icons.sos_rounded,
color: AppColor.redColor,
),
),
IconButton(
onPressed: () {
if (box.read(BoxName.sosPhonePassenger).toString() ==
'') {
Get.defaultDialog(
title: 'You dont Add Emergency Phone Yet!'.tr,
content: Column(
children: [
Form(
key: controller.sosFormKey,
child: TextFormField(
keyboardType: TextInputType
.phone, // Set the keyboard type to phone
validator: (value) {
if (value!.isEmpty ||
value.length < 10) {
return 'Please enter a phone number';
}
// Add additional validation if needed
return null;
},
decoration: const InputDecoration(
border: OutlineInputBorder(),
hintText: 'Type here',
),
),
)
],
),
confirm: MyElevatedButton(
title: 'Add Phone'.tr,
onPressed: () async {
await profileController
.updatField('sosPhone');
box.write(
BoxName.sosPhonePassenger,
profileController
.prfoileData['sosPhone']);
}));
} else {
controller.sendWhatsapp(
box.read(BoxName.sosPhonePassenger));
}
},
icon: const Icon(
Icons.ring_volume,
color: AppColor.blueColor,
),
),
],
)
// controller.remainingTimeTimerRideBegin < 5
// ? MyElevatedButton(
// title:
// 'If you in destination Now. Press finish The Ride',
// onPressed: () async {
//todo finish the trip and rest all counter ,start new counter of the trip time
// await CRUD()
// .post(link: AppLink.updateRides, payload: {
// 'id': controller.rideId,
// 'rideTimeStart': DateTime.now().toString(),
// 'status': 'Applied'
// });
// controller.driverArrivePassenger();
// // Send notification to driver to alert him that trip is begin
// FirebaseMessagesController()
// .sendNotificationToAnyWithoutData(
// 'BeginTrip',
// box.read(BoxName.name).toString(),
// controller.driverToken.toString(),
// );
// print(controller.driverToken.toString());
// Get.defaultDialog(
// title: 'The Ride is Begin'.tr,
// backgroundColor: AppColor.greenColor,
// );
})
: const SizedBox()
// await CRUD()
// .post(link: AppLink.updateRides, payload: {
// 'id': controller.rideId,
// 'rideTimeStart': DateTime.now().toString(),
// 'status': 'Applied'
// });
// controller.driverArrivePassenger();
// // Send notification to driver to alert him that trip is begin
// FirebaseMessagesController()
// .sendNotificationToAnyWithoutData(
// 'BeginTrip',
// box.read(BoxName.name).toString(),
// controller.driverToken.toString(),
// );
// print(controller.driverToken.toString());
// Get.defaultDialog(
// title: 'The Ride is Begin'.tr,
// backgroundColor: AppColor.greenColor,
// );
// })
// : const SizedBox()
],
),
),