12/8/1
This commit is contained in:
@@ -17,6 +17,21 @@ class ApplyOrderWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Color _parseColor(String colorHex) {
|
||||
if (colorHex.isEmpty) {
|
||||
return Colors.grey; // Fallback for empty color
|
||||
}
|
||||
|
||||
// Ensure the string starts with '0xff' for ARGB format
|
||||
String processedHex = colorHex.replaceFirst('#', '0xff').trim();
|
||||
|
||||
if (!processedHex.startsWith('0xff')) {
|
||||
processedHex = '0xff$processedHex'; // Add '0xff' if missing
|
||||
}
|
||||
|
||||
return Color(int.parse(processedHex));
|
||||
}
|
||||
|
||||
return GetBuilder<MapPassengerController>(builder: (controller) {
|
||||
if (controller.statusRide == 'Apply' &&
|
||||
controller.isSearchingWindow == false) {
|
||||
@@ -108,36 +123,43 @@ class ApplyOrderWidget extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Image.asset(
|
||||
box.read(BoxName.carType) == 'Comfort'
|
||||
? 'assets/images/blob.png'
|
||||
: box.read(BoxName.carType) == 'Lady'
|
||||
? 'assets/images/lady.png' // Assuming there's an image for Lady
|
||||
: box.read(BoxName.carType) == 'Speed'
|
||||
? 'assets/images/carspeed.png'
|
||||
: box.read(BoxName.carType) ==
|
||||
'Scooter'
|
||||
? 'assets/images/moto.png'
|
||||
: box.read(BoxName.carType) ==
|
||||
'Mishwar Vip'
|
||||
? 'assets/images/freeRide.png'
|
||||
: box.read(BoxName
|
||||
.carType) ==
|
||||
'Awfar Car'
|
||||
? 'assets/images/balash.png'
|
||||
: box.read(BoxName
|
||||
.carType) ==
|
||||
'Pink Bike'
|
||||
? 'assets/images/pinkBike.png'
|
||||
: box.read(BoxName
|
||||
.carType) ==
|
||||
'Rayeh Gai'
|
||||
? 'assets/images/roundtrip.png'
|
||||
: 'assets/images/carspeed.png', // Default image if none of the above
|
||||
width: 80,
|
||||
),
|
||||
// ColorFiltered(
|
||||
// colorFilter: ColorFilter.mode(
|
||||
// _parseColor(controller.colorHex),
|
||||
// BlendMode.srcIn,
|
||||
// ),
|
||||
// child: Image.asset(
|
||||
// box.read(BoxName.carType) == 'Comfort'
|
||||
// ? 'assets/images/blob.png'
|
||||
// : box.read(BoxName.carType) == 'Lady'
|
||||
// ? 'assets/images/lady.png' // Assuming there's an image for Lady
|
||||
// : box.read(BoxName.carType) == 'Speed'
|
||||
// ? 'assets/images/carspeed.png'
|
||||
// : box.read(BoxName.carType) ==
|
||||
// 'Scooter'
|
||||
// ? 'assets/images/moto.png'
|
||||
// : box.read(BoxName.carType) ==
|
||||
// 'Mishwar Vip'
|
||||
// ? 'assets/images/freeRide.png'
|
||||
// : box.read(BoxName
|
||||
// .carType) ==
|
||||
// 'Awfar Car'
|
||||
// ? 'assets/images/balash.png'
|
||||
// : box.read(BoxName
|
||||
// .carType) ==
|
||||
// 'Pink Bike'
|
||||
// ? 'assets/images/pinkBike.png'
|
||||
// : box.read(BoxName
|
||||
// .carType) ==
|
||||
// 'Rayeh Gai'
|
||||
// ? 'assets/images/roundtrip.png'
|
||||
// : 'assets/images/carspeed.png', // Default image if none of the above
|
||||
// width: 80,
|
||||
// ),
|
||||
// ),
|
||||
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
@@ -152,14 +174,31 @@ class ApplyOrderWidget extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
// 'Black',
|
||||
controller.carColor,
|
||||
controller.carColor.toString(),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
ColorFiltered(
|
||||
colorFilter: ColorFilter.mode(
|
||||
_parseColor(controller.colorHex),
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
child: Image.asset(
|
||||
box.read(BoxName.carType) == 'Scooter' ||
|
||||
box.read(BoxName.carType) ==
|
||||
'Pink Bike'
|
||||
? 'assets/images/moto.png'
|
||||
: 'assets/images/car3.png',
|
||||
width: 80,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
@@ -218,7 +257,7 @@ class ApplyOrderWidget extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
// 'fadi ahmad',
|
||||
controller.firstName,
|
||||
controller.driverName,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
|
||||
@@ -242,109 +242,127 @@ GetBuilder<MapPassengerController> formSearchPlacesDestenation() {
|
||||
// )
|
||||
// : 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);
|
||||
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];
|
||||
|
||||
controller.changeHeightPlaces();
|
||||
// Extract fields with null safety
|
||||
var title = res['title']?.toString() ?? 'Unknown Place';
|
||||
var position = res['position'];
|
||||
var latitude = position?['lat'];
|
||||
var longitude = position?['lng'];
|
||||
var address =
|
||||
res['address']?['label'] ?? 'Unknown Address';
|
||||
var categories = res['categories'] ?? [];
|
||||
var primaryCategory = categories.isNotEmpty
|
||||
? categories[0]['name']
|
||||
: 'Unknown Category';
|
||||
|
||||
controller.passengerLocation = controller.newMyLocation;
|
||||
controller.myDestination = LatLng(
|
||||
double.parse(
|
||||
res['geometry']['location']['lat'].toString()),
|
||||
double.parse(
|
||||
res['geometry']['location']['lng'].toString()),
|
||||
);
|
||||
controller.convertHintTextDestinationNewPlaces(index);
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
if (latitude != null && longitude != null) {
|
||||
sql.insertMapLocation({
|
||||
'latitude': latitude,
|
||||
'longitude': longitude,
|
||||
'name': title,
|
||||
'rate': 'N/A',
|
||||
'createdAt': DateTime.now().toIso8601String(),
|
||||
// No rating in this structure, adjust as needed
|
||||
}, TableName.recentLocations);
|
||||
|
||||
controller.placesDestination = [];
|
||||
controller.placeDestinationController.clear();
|
||||
controller.changeMainBottomMenuMap();
|
||||
controller.passengerStartLocationFromMap = true;
|
||||
controller.isPickerShown = true;
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Image.network(
|
||||
res['icon'],
|
||||
width: 20,
|
||||
controller.passengerLocation =
|
||||
controller.newMyLocation;
|
||||
controller.myDestination =
|
||||
LatLng(latitude, longitude);
|
||||
controller
|
||||
.convertHintTextDestinationNewPlaces(index);
|
||||
|
||||
controller.placesDestination = [];
|
||||
controller.placeDestinationController.clear();
|
||||
controller.changeMainBottomMenuMap();
|
||||
controller.passengerStartLocationFromMap = true;
|
||||
controller.isPickerShown = true;
|
||||
} else {
|
||||
Toast.show(
|
||||
context,
|
||||
'Invalid location data',
|
||||
AppColor.redColor,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
const Icon(Icons.place,
|
||||
size: 20), // Fallback icon for places
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
if (latitude != null &&
|
||||
longitude != null) {
|
||||
await sql.insertMapLocation({
|
||||
'latitude': latitude,
|
||||
'longitude': longitude,
|
||||
'name': title,
|
||||
'rate': 'N/A',
|
||||
}, TableName.placesFavorite);
|
||||
Toast.show(
|
||||
context,
|
||||
'$title ${'Saved Successfully'.tr}',
|
||||
AppColor.primaryColor,
|
||||
);
|
||||
} else {
|
||||
Toast.show(
|
||||
context,
|
||||
'Invalid location data',
|
||||
AppColor.redColor,
|
||||
);
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.favorite_border),
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
address,
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
primaryCategory,
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
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,
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(thickness: 1),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
);
|
||||
},
|
||||
))
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ GetBuilder<MapPassengerController> formSearchPlacesStart() {
|
||||
// controller.myLocation =
|
||||
// controller.newStartPointLocation;
|
||||
// }
|
||||
await sql.insertData({
|
||||
await sql.insertMapLocation({
|
||||
'latitude': res['geometry']['location']['lat'],
|
||||
'longitude': res['geometry']['location']['lng'],
|
||||
'name': res['name'].toString(),
|
||||
@@ -130,7 +130,7 @@ GetBuilder<MapPassengerController> formSearchPlacesStart() {
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
await sql.insertData({
|
||||
await sql.insertMapLocation({
|
||||
'latitude': res['geometry']
|
||||
['location']['lat'],
|
||||
'longitude': res['geometry']
|
||||
|
||||
@@ -109,7 +109,7 @@ GetBuilder<MapPassengerController> formSearchPlaces(int index) {
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
await sql.insertData({
|
||||
await sql.insertMapLocation({
|
||||
'latitude': res['geometry']
|
||||
['location']['lat'],
|
||||
'longitude': res['geometry']
|
||||
|
||||
@@ -8,7 +8,7 @@ import '../../../controller/home/map_passenger_controller.dart';
|
||||
import '../../../controller/home/vip_waitting_page.dart';
|
||||
|
||||
GetBuilder<MapPassengerController> leftMainMenuIcons() {
|
||||
final textToSpeechController = Get.put(TextToSpeechController());
|
||||
Get.put(TextToSpeechController());
|
||||
return GetBuilder<MapPassengerController>(
|
||||
builder: (controller) => Positioned(
|
||||
top: Get.height * .008,
|
||||
@@ -108,7 +108,9 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
|
||||
// borderRadius: BorderRadius.circular(15)),
|
||||
// child: IconButton(
|
||||
// onPressed: () async {
|
||||
// print(Get.put(MapPassengerController()).data);
|
||||
// controller.statusRide == 'Apply' &&
|
||||
// controller.isSearchingWindow == false;
|
||||
// controller.update();
|
||||
// },
|
||||
// icon: const Icon(
|
||||
// Octicons
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'package:SEFER/views/widgets/my_dialog.dart';
|
||||
import 'package:SEFER/views/widgets/my_textField.dart';
|
||||
import 'package:SEFER/views/widgets/mysnakbar.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -14,6 +16,7 @@ import '../../../constant/colors.dart';
|
||||
import '../../../constant/table_names.dart';
|
||||
import '../../../controller/functions/toast.dart';
|
||||
import '../../../controller/functions/tts.dart';
|
||||
import '../../../print.dart';
|
||||
import 'form_search_start.dart';
|
||||
|
||||
class MainBottomMenuMap extends StatelessWidget {
|
||||
@@ -46,24 +49,34 @@ class MainBottomMenuMap extends StatelessWidget {
|
||||
child: Container(
|
||||
width: Get.width * .8,
|
||||
height: Get.height * .1,
|
||||
decoration: const BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Color.fromARGB(
|
||||
255, 237, 230, 230),
|
||||
blurRadius: 5,
|
||||
offset: Offset(2, 4)),
|
||||
BoxShadow(
|
||||
color: Color.fromARGB(
|
||||
255, 242, 237, 237),
|
||||
blurRadius: 5,
|
||||
offset: Offset(-2, -2))
|
||||
],
|
||||
color: AppColor.blueColor,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.elliptical(15, 30),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppColor.blueColor.withOpacity(0.8),
|
||||
AppColor.blueColor.withOpacity(0.6),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color.fromARGB(
|
||||
255, 237, 230, 230),
|
||||
blurRadius: 8,
|
||||
offset: Offset(4, 8),
|
||||
),
|
||||
BoxShadow(
|
||||
color: Color.fromARGB(
|
||||
255, 242, 237, 237),
|
||||
blurRadius: 8,
|
||||
offset: Offset(-4, -4),
|
||||
),
|
||||
],
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
|
||||
// decoration: AppStyle.boxDecoration1,
|
||||
child: DefaultTextStyle(
|
||||
style: AppStyle.title.copyWith(
|
||||
@@ -350,6 +363,18 @@ class MainBottomMenuMap extends StatelessWidget {
|
||||
},
|
||||
));
|
||||
},
|
||||
onLongPress: () {
|
||||
MyDialog().getDialog(
|
||||
"Are you sure to delete this location?".tr, '', () {
|
||||
sql.deleteData(TableName.recentLocations,
|
||||
controller.recentPlaces[index]['id']);
|
||||
|
||||
controller.getFavioratePlaces();
|
||||
controller.update();
|
||||
Get.back();
|
||||
mySnackbarSuccess('deleted'.tr);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
|
||||
@@ -53,7 +53,7 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: Text(
|
||||
controller.firstName,
|
||||
controller.driverName,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user