8-15/3
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
|
||||
|
||||
<application android:label="ride" android:name="${applicationName}" android:icon="@mipmap/ic_launcher">
|
||||
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
|
||||
@@ -4,4 +4,5 @@ class AppColor {
|
||||
static const Color primaryColor = Colors.black;
|
||||
static const Color secondaryColor = Colors.white;
|
||||
static const Color accentColor = Colors.grey;
|
||||
static const Color redColor = Color.fromARGB(255, 199, 56, 46);
|
||||
}
|
||||
|
||||
4
lib/constant/table_names.dart
Normal file
4
lib/constant/table_names.dart
Normal file
@@ -0,0 +1,4 @@
|
||||
class TableName {
|
||||
static const String placesFavorite = "placesFavorite";
|
||||
static const String carLocations = "carLocations";
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
@@ -7,8 +8,11 @@ import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/constant/links.dart';
|
||||
import 'package:ride/controller/functions/crud.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/auth/verify_email_page.dart';
|
||||
import 'package:ride/views/home/map_page.dart';
|
||||
|
||||
import '../firebase/firbase_messge.dart';
|
||||
|
||||
class LoginController extends GetxController {
|
||||
final formKey = GlobalKey<FormState>();
|
||||
TextEditingController emailController = TextEditingController();
|
||||
@@ -46,35 +50,57 @@ class LoginController extends GetxController {
|
||||
'phone': phoneController.text,
|
||||
'password': passwordController.text
|
||||
});
|
||||
|
||||
var jsonDecoeded = jsonDecode(res);
|
||||
// print(jsonDecoeded);
|
||||
if (jsonDecoeded.isNotEmpty) {
|
||||
if (jsonDecoeded['status'] == 'success') {
|
||||
if (jsonDecoeded['data'][0]['verified'] == '1') {
|
||||
box.write(BoxName.pasengerID, jsonDecoeded['data'][0]['id']);
|
||||
box.write(BoxName.email, jsonDecoeded['data'][0]['email']);
|
||||
box.write(BoxName.phone, jsonDecoeded['data'][0]['phone']);
|
||||
Get.offAll(() => MapPage());
|
||||
if (res == 'Failure') {
|
||||
isloading = false;
|
||||
update();
|
||||
Get.snackbar('Failure', '', backgroundColor: Colors.red);
|
||||
} else {
|
||||
var jsonDecoeded = jsonDecode(res);
|
||||
// print(jsonDecoeded);
|
||||
if (jsonDecoeded.isNotEmpty) {
|
||||
if (jsonDecoeded['status'] == 'success') {
|
||||
print(jsonDecoeded['data'][0]['verified']);
|
||||
if (jsonDecoeded['data'][0]['verified'] == 1) {
|
||||
box.write(BoxName.pasengerID, jsonDecoeded['data'][0]['id']);
|
||||
box.write(BoxName.email, jsonDecoeded['data'][0]['email']);
|
||||
box.write(BoxName.phone, jsonDecoeded['data'][0]['phone']);
|
||||
Get.offAll(() => MapPage());
|
||||
isloading = false;
|
||||
update();
|
||||
print(box.read(BoxName.pasengerID).toString());
|
||||
print(box.read(BoxName.tokenFCM));
|
||||
await CRUD().post(link: AppLink.addTokens, payload: {
|
||||
'token': box.read(BoxName.tokenFCM),
|
||||
'passengerID': box.read(BoxName.pasengerID).toString()
|
||||
}).then((value) => print('cccc'));
|
||||
} else {
|
||||
isloading = false;
|
||||
update();
|
||||
Get.defaultDialog(
|
||||
title: 'You must Verify email !.'.tr,
|
||||
middleText: '',
|
||||
backgroundColor: Colors.yellow[300],
|
||||
onConfirm: () async {
|
||||
int randomNumber = Random().nextInt(100000) + 1;
|
||||
await CRUD().post(link: AppLink.sendVerifyEmail, payload: {
|
||||
'email': emailController.text,
|
||||
'token': randomNumber.toString(),
|
||||
}).then((value) => print(value));
|
||||
Get.to(() => const VerifyEmailPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
} else if (jsonDecoeded['status'] == 'Failure') {
|
||||
Get.snackbar(jsonDecoeded['status'], jsonDecoeded['data'],
|
||||
backgroundColor: Colors.redAccent);
|
||||
isloading = false;
|
||||
update();
|
||||
print(box.read(BoxName.pasengerID).toString());
|
||||
await CRUD().post(link: AppLink.addTokens, payload: {
|
||||
'token': box.read(BoxName.tokenFCM.toString()),
|
||||
'passengerID': box.read(BoxName.pasengerID).toString()
|
||||
}).then((value) => print('cccc'));
|
||||
} else {
|
||||
Get.snackbar('You must Verify email !.'.tr, '',
|
||||
backgroundColor: Colors.yellow[300]);
|
||||
}
|
||||
} else if (jsonDecoeded['status'] == 'Failure') {
|
||||
Get.snackbar(jsonDecoeded['status'], jsonDecoeded['data'],
|
||||
backgroundColor: Colors.redAccent);
|
||||
} else {
|
||||
print('res is null');
|
||||
isloading = false;
|
||||
update();
|
||||
}
|
||||
} else {
|
||||
print('res is null');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +113,7 @@ class LoginController extends GetxController {
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
FirebasMessagesController().requestPermission();
|
||||
// goToMapPage();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,11 +61,10 @@ class RegisterController extends GetxController {
|
||||
'email': emailController.text,
|
||||
'token': verfyCode.text,
|
||||
});
|
||||
var jsondecod = jsonDecode(res);
|
||||
|
||||
if (jsondecod['status'] == 'success') {
|
||||
Get.offAll(() => const MapPage());
|
||||
}
|
||||
// if (jsondecod['status'] == 'success') {
|
||||
Get.offAll(() => const MapPage());
|
||||
// }
|
||||
}
|
||||
|
||||
void register() async {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:ride/constant/colors.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/credential.dart';
|
||||
@@ -29,17 +31,39 @@ class FirebasMessagesController extends GetxController {
|
||||
await FirebaseMessaging.instance.getNotificationSettings();
|
||||
print('------noti======');
|
||||
print(notificationSettings!.authorizationStatus.toString());
|
||||
// if (notificationSettings?.authorizationStatus.toString() ==
|
||||
// 'AuthorizationStatus.denied') {
|
||||
// await Get.defaultDialog(
|
||||
// title: 'AuthorizationStatus',
|
||||
// content: TextButton(
|
||||
// onPressed: () {
|
||||
// requestPermission();
|
||||
// },
|
||||
// child: Text(
|
||||
// "Text Button",
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
update();
|
||||
}
|
||||
|
||||
void requestPermission() async {
|
||||
Future checkAndRequestPermission() async {
|
||||
if (notificationSettings!.authorizationStatus ==
|
||||
AuthorizationStatus.denied) {
|
||||
await requestPermission();
|
||||
}
|
||||
}
|
||||
|
||||
Future requestPermission() async {
|
||||
// Check if the platform is Android
|
||||
if (Platform.isAndroid) {
|
||||
// Request permission for Android
|
||||
fcmToken.requestPermission().then((value) {
|
||||
if (value!.authorizationStatus == AuthorizationStatus.denied) {
|
||||
if (value.authorizationStatus == AuthorizationStatus.denied) {
|
||||
print('dddddddddddddddddddddd');
|
||||
}
|
||||
print(value.authorizationStatus);
|
||||
});
|
||||
} else {
|
||||
// Request permission for iOS
|
||||
@@ -86,8 +110,8 @@ class FirebasMessagesController extends GetxController {
|
||||
// final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
await fcmToken.getToken().then(
|
||||
(token) {
|
||||
// print(token);/
|
||||
box.write(BoxName.tokenFCM, token);
|
||||
print(box.read(BoxName.tokenFCM).toString());
|
||||
},
|
||||
);
|
||||
FirebaseMessaging.onMessage.listen((event) {
|
||||
@@ -95,8 +119,8 @@ class FirebasMessagesController extends GetxController {
|
||||
'onMessage: ${event.notification!.title} ${event.notification!.body}');
|
||||
if (Get.currentRoute == '/') {
|
||||
// If the app is in the foreground, show a dialog to the user
|
||||
if (event.notification!.title.toString().contains('reef')) {
|
||||
// Get.snackbar('reeffff', 'message');
|
||||
if (event.notification!.title.toString().contains('ride')) {
|
||||
Get.snackbar('ride', 'message', backgroundColor: AppColor.redColor);
|
||||
} else if (event.notification!.title.toString().contains('انذار')) {
|
||||
// Get.to(() => const ProfilePage());
|
||||
} else if (event.notification!.title
|
||||
@@ -112,8 +136,8 @@ class FirebasMessagesController extends GetxController {
|
||||
if (notification != null && android != null) {
|
||||
print(
|
||||
'onMessageOpenedApp: ${notification.title} ${notification.body}');
|
||||
if (event.notification!.title.toString().contains('reef')) {
|
||||
// Get.snackbar('reef', '');
|
||||
if (event.notification!.title.toString().contains('ride')) {
|
||||
Get.snackbar('ride', 'message', backgroundColor: AppColor.redColor);
|
||||
// SendGpsNow().getSiteNotification();
|
||||
} else if (event.notification!.title.toString().contains('انذار')) {
|
||||
// Get.to(() => const ProfilePage());
|
||||
@@ -134,8 +158,8 @@ class FirebasMessagesController extends GetxController {
|
||||
if (notification != null) {
|
||||
print('onMessageOpenedApp: ${notification.title} ${notification.body}');
|
||||
|
||||
if (event.notification!.title.toString().contains('reef')) {
|
||||
// Get.snackbar('reef', '');
|
||||
if (event.notification!.title.toString().contains('ride')) {
|
||||
Get.snackbar('ride', 'message', backgroundColor: AppColor.redColor);
|
||||
// SendGpsNow().getSiteNotification();
|
||||
} else if (event.notification!.title.toString().contains('انذار')) {
|
||||
// Get.to(() => const ProfilePage());
|
||||
|
||||
@@ -21,7 +21,7 @@ class CRUD {
|
||||
'Basic ${base64Encode(utf8.encode(AppCredintials.basicAuthCredentials))}',
|
||||
},
|
||||
);
|
||||
// print("--------------" + response.request.toString());
|
||||
// print("--------------" + response.body.toString());
|
||||
if (response.statusCode == 200) {
|
||||
var jsonData = jsonDecode(response.body);
|
||||
if (jsonData['status'] == 'success') {
|
||||
@@ -49,8 +49,8 @@ class CRUD {
|
||||
},
|
||||
);
|
||||
print(response.request);
|
||||
var jsonData = jsonDecode(response.body);
|
||||
if (response.statusCode == 200) {
|
||||
var jsonData = jsonDecode(response.body);
|
||||
if (jsonData['status'] == 'success') {
|
||||
Get.snackbar(
|
||||
jsonData['status'],
|
||||
@@ -60,7 +60,7 @@ class CRUD {
|
||||
return response.body;
|
||||
}
|
||||
}
|
||||
// return (response.body);
|
||||
return (jsonData['status']);
|
||||
}
|
||||
|
||||
Future<dynamic> getGoogleApi({
|
||||
|
||||
47
lib/controller/functions/log_out.dart
Normal file
47
lib/controller/functions/log_out.dart
Normal file
@@ -0,0 +1,47 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/src/widgets/basic.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/lang/languages.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../constant/style.dart';
|
||||
|
||||
class LogOut {
|
||||
Future logOut() async {
|
||||
Get.defaultDialog(
|
||||
title: 'Are you Sure to LogOut?'.tr,
|
||||
content: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
MyElevatedButton(
|
||||
title: 'Cancel'.tr,
|
||||
onPressed: () => Get.back(),
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all(AppColor.redColor),
|
||||
),
|
||||
onPressed: () {
|
||||
// box.remove(BoxName.agreeTerms);
|
||||
box.remove(BoxName.driverID);
|
||||
box.remove(BoxName.email);
|
||||
box.remove(BoxName.lang);
|
||||
box.remove(BoxName.name);
|
||||
box.remove(BoxName.pasengerID);
|
||||
box.remove(BoxName.phone);
|
||||
box.remove(BoxName.tokenFCM);
|
||||
box.remove(BoxName.tokens);
|
||||
Get.offAll(const Language());
|
||||
},
|
||||
child: Text(
|
||||
'Sign Out'.tr,
|
||||
style:
|
||||
AppStyle.title.copyWith(color: AppColor.secondaryColor),
|
||||
))
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import 'package:ride/controller/functions/crud.dart';
|
||||
import 'package:ride/views/home/map_widget.dart/buttom_sheet_map_show.dart';
|
||||
|
||||
import '../../models/model/locations.dart';
|
||||
import '../firebase/firbase_messge.dart';
|
||||
|
||||
class MapController extends GetxController {
|
||||
bool isloading = true;
|
||||
@@ -429,6 +430,7 @@ class MapController extends GetxController {
|
||||
void onInit() async {
|
||||
// getPolyLine();
|
||||
// getMap();
|
||||
FirebasMessagesController().requestPermission();
|
||||
await getLocation();
|
||||
await getCarsLocationByPassenger();
|
||||
addCustomPicker();
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:get/get.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../main.dart';
|
||||
import '../firebase/firbase_messge.dart';
|
||||
import '../themes/themes.dart';
|
||||
|
||||
class LocaleController extends GetxController {
|
||||
@@ -21,6 +22,7 @@ class LocaleController extends GetxController {
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
FirebasMessagesController().requestPermission();
|
||||
if (box.read(BoxName.lang) == "ar") {
|
||||
language = const Locale("ar");
|
||||
appTheme = themeArabic;
|
||||
|
||||
@@ -14,9 +14,11 @@ import 'controller/functions/location_permission.dart';
|
||||
import 'controller/local/local_controller.dart';
|
||||
import 'controller/local/translations.dart';
|
||||
import 'firebase_options.dart';
|
||||
import 'models/db_sql.dart';
|
||||
import 'views/home/map_page.dart';
|
||||
|
||||
final box = GetStorage();
|
||||
DbSql sql = DbSql.instance;
|
||||
@pragma('vm:entry-point')
|
||||
Future<void> backgroundMessageHandler(RemoteMessage message) async {
|
||||
await Firebase.initializeApp();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:ride/constant/table_names.dart';
|
||||
import 'package:sqflite/sqflite.dart';
|
||||
import 'package:path/path.dart';
|
||||
|
||||
@@ -21,7 +22,7 @@ class DbSql {
|
||||
version: 1,
|
||||
onCreate: (db, version) async {
|
||||
await db.execute('''
|
||||
CREATE TABLE IF NOT EXISTS car_locations(
|
||||
CREATE TABLE IF NOT EXISTS ${TableName.carLocations}(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
driver_id INTEGER,
|
||||
latitude REAL,
|
||||
@@ -30,6 +31,15 @@ class DbSql {
|
||||
updated_at TEXT
|
||||
)
|
||||
''');
|
||||
await db.execute('''
|
||||
CREATE TABLE IF NOT EXISTS ${TableName.placesFavorite}(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
latitude REAL,
|
||||
longitude REAL,
|
||||
name TEXT UNIQUE,
|
||||
rate TEXT
|
||||
)
|
||||
''');
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'package:get/get.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/controller/auth/register_controller.dart';
|
||||
import 'package:ride/controller/auth/verify_email_controller.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
import 'package:ride/views/widgets/my_scafold.dart';
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/controller/home/map_page_controller.dart';
|
||||
import 'package:ride/views/widgets/mycircular.dart';
|
||||
|
||||
import '../../controller/home/menu_controller.dart';
|
||||
import 'map_widget.dart/buttom_sheet_map_show.dart';
|
||||
@@ -22,9 +23,7 @@ class MapPage extends StatelessWidget {
|
||||
children: [
|
||||
GetBuilder<MapController>(
|
||||
builder: (controller) => controller.isloading
|
||||
? const Center(
|
||||
child: CircularProgressIndicator.adaptive(),
|
||||
)
|
||||
? const MyCircularProgressIndicator()
|
||||
: GoogleMap(
|
||||
onMapCreated: controller.onMapCreated,
|
||||
cameraTargetBounds:
|
||||
@@ -140,7 +139,7 @@ class MapPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const PickerIconOnMap(),
|
||||
PickerAnimtionContainer(),
|
||||
PickerAnimtionContainerFormPlaces(),
|
||||
const MapMenuWidget(),
|
||||
const MenuIconMapPageWidget(),
|
||||
buttomSheetMapPage()
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
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/home/map_page_controller.dart';
|
||||
import '../../../main.dart';
|
||||
import '../../../models/db_sql.dart';
|
||||
|
||||
GetBuilder<MapController> formSearchPlaces() {
|
||||
// DbSql sql = DbSql.instance;
|
||||
return GetBuilder<MapController>(
|
||||
builder: (controller) => Positioned(
|
||||
top: 5,
|
||||
@@ -33,6 +37,7 @@ GetBuilder<MapController> formSearchPlaces() {
|
||||
'${controller.mylocation.latitude.toString()},${controller.mylocation.longitude.toString()}',
|
||||
"${res['geometry']['location']['lat']},${res['geometry']['location']['lng']}");
|
||||
controller.places = [];
|
||||
controller.placeController.clear();
|
||||
Get.back();
|
||||
controller.bottomSheet();
|
||||
// Get.back();
|
||||
@@ -47,9 +52,26 @@ GetBuilder<MapController> formSearchPlaces() {
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Image.network(
|
||||
res['icon'],
|
||||
width: 30,
|
||||
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);
|
||||
},
|
||||
icon: const Icon(Icons.favorite_border),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
|
||||
@@ -1,24 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/table_names.dart';
|
||||
import 'package:ride/models/db_sql.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../controller/home/map_page_controller.dart';
|
||||
import '../../../main.dart';
|
||||
import '../../widgets/elevated_btn.dart';
|
||||
import 'form_search_places.dart';
|
||||
|
||||
class PickerAnimtionContainer extends StatelessWidget {
|
||||
PickerAnimtionContainer({
|
||||
class PickerAnimtionContainerFormPlaces extends StatelessWidget {
|
||||
PickerAnimtionContainerFormPlaces({
|
||||
super.key,
|
||||
});
|
||||
final controller = MapController();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// DbSql sql = DbSql.instance;
|
||||
return GetBuilder<MapController>(
|
||||
builder: (controller) => Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 60,
|
||||
right: 5,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
height: controller.places.isNotEmpty
|
||||
@@ -52,8 +56,10 @@ class PickerAnimtionContainer extends StatelessWidget {
|
||||
),
|
||||
controller.isPickerShown
|
||||
? InkWell(
|
||||
onTapDown: (details) =>
|
||||
controller.changePickerShown(),
|
||||
onTapDown: (details) {
|
||||
controller.changePickerShown();
|
||||
controller.changeHeight();
|
||||
},
|
||||
child: Container(
|
||||
height: 4,
|
||||
width: Get.width * .3,
|
||||
@@ -71,16 +77,120 @@ class PickerAnimtionContainer extends StatelessWidget {
|
||||
onTap: () {},
|
||||
child: formSearchPlaces(),
|
||||
)
|
||||
: TextButton(
|
||||
onPressed: () {
|
||||
controller.changePickerShown();
|
||||
},
|
||||
child: Builder(builder: (context) {
|
||||
return Text(
|
||||
"Pick your destination from Map".tr,
|
||||
style: AppStyle.subtitle,
|
||||
);
|
||||
}),
|
||||
: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
controller.changePickerShown();
|
||||
},
|
||||
child: Builder(builder: (context) {
|
||||
return Text(
|
||||
"Pick your destination from Map".tr,
|
||||
style: AppStyle.subtitle,
|
||||
);
|
||||
}),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () 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: [
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
await controller
|
||||
.getMap(
|
||||
'${controller.mylocation.latitude},${controller.mylocation.longitude}',
|
||||
'${favoritePlaces[index]['latitude']},${favoritePlaces[index]['longitude']}',
|
||||
);
|
||||
controller
|
||||
.changePickerShown();
|
||||
controller
|
||||
.changeButtomSheetShown();
|
||||
controller
|
||||
.bottomSheet();
|
||||
Get.back();
|
||||
},
|
||||
child: Text(
|
||||
favoritePlaces[
|
||||
index]['name'],
|
||||
style:
|
||||
AppStyle.title,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
await sql.deleteData(
|
||||
TableName
|
||||
.placesFavorite,
|
||||
favoritePlaces[
|
||||
index]
|
||||
['id']);
|
||||
Get.back();
|
||||
Get.snackbar(
|
||||
'Deleted ',
|
||||
'You are Delete ${favoritePlaces[index]['name']} from your list',
|
||||
backgroundColor:
|
||||
AppColor
|
||||
.accentColor);
|
||||
},
|
||||
icon: const Icon(Icons
|
||||
.favorite_outlined),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Builder(builder: (context) {
|
||||
return Text(
|
||||
"Go To Favorite Places".tr,
|
||||
style: AppStyle.subtitle,
|
||||
);
|
||||
}),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
@@ -95,6 +205,9 @@ class PickerAnimtionContainer extends StatelessWidget {
|
||||
controller.changePickerShown();
|
||||
controller.changeButtomSheetShown();
|
||||
controller.bottomSheet();
|
||||
// await sql
|
||||
// .getAllData(TableName.placesFavorite)
|
||||
// .then((value) => print(value));
|
||||
},
|
||||
),
|
||||
if (controller.isPickerShown && controller.places.isEmpty)
|
||||
|
||||
@@ -8,6 +8,8 @@ import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
import 'package:ride/views/widgets/my_scafold.dart';
|
||||
import 'package:ride/views/widgets/mycircular.dart';
|
||||
|
||||
import '../../../controller/functions/log_out.dart';
|
||||
|
||||
class PassengerProfilePage extends StatelessWidget {
|
||||
const PassengerProfilePage({super.key});
|
||||
|
||||
@@ -23,137 +25,150 @@ class PassengerProfilePage extends StatelessWidget {
|
||||
? const MyCircularProgressIndicator()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Edit Profile'.tr,
|
||||
style: AppStyle.headtitle2,
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Name'.tr,
|
||||
style: AppStyle.title,
|
||||
child: SizedBox(
|
||||
height: Get.height,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Edit Profile'.tr,
|
||||
style: AppStyle.headtitle2,
|
||||
),
|
||||
leading: const Icon(
|
||||
Icons.person_pin_rounded,
|
||||
size: 35,
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Name'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
leading: const Icon(
|
||||
Icons.person_pin_rounded,
|
||||
size: 35,
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios),
|
||||
subtitle: Text(
|
||||
'${controller.prfoileData['first_name']} ${controller.prfoileData['last_name']}'),
|
||||
onTap: () {
|
||||
controller.updatField('first_name');
|
||||
},
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios),
|
||||
subtitle: Text(
|
||||
'${controller.prfoileData['first_name']} ${controller.prfoileData['last_name']}'),
|
||||
onTap: () {
|
||||
controller.updatField('first_name');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Gender'.tr,
|
||||
style: AppStyle.title,
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Gender'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
leading: Image.asset(
|
||||
'assets/images/gender.png',
|
||||
width: 35,
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios),
|
||||
subtitle: Text(
|
||||
controller.prfoileData['gender'].toString()),
|
||||
onTap: () {
|
||||
Get.defaultDialog(
|
||||
title: 'Update Gender'.tr,
|
||||
content: Column(
|
||||
children: [
|
||||
GenderPicker(),
|
||||
MyElevatedButton(
|
||||
title: 'Update'.tr,
|
||||
onPressed: () {
|
||||
controller.updateColumn({
|
||||
'id': controller.prfoileData['id']
|
||||
.toString(),
|
||||
'gender': controller.gender,
|
||||
});
|
||||
Get.back();
|
||||
},
|
||||
)
|
||||
],
|
||||
));
|
||||
// controller.updatField('gender');
|
||||
},
|
||||
),
|
||||
leading: Image.asset(
|
||||
'assets/images/gender.png',
|
||||
width: 35,
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Education'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
leading: Image.asset(
|
||||
'assets/images/education.png',
|
||||
width: 35,
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios),
|
||||
subtitle: Text(controller.prfoileData['education']
|
||||
.toString()),
|
||||
onTap: () {
|
||||
Get.defaultDialog(
|
||||
title: 'Update Education'.tr,
|
||||
content: Column(
|
||||
children: [
|
||||
EducationDegreePicker(),
|
||||
MyElevatedButton(
|
||||
title: 'Update Education'.tr,
|
||||
onPressed: () {
|
||||
controller.updateColumn({
|
||||
'id': controller.prfoileData['id']
|
||||
.toString(),
|
||||
'education':
|
||||
controller.selectedDegree,
|
||||
});
|
||||
Get.back();
|
||||
},
|
||||
)
|
||||
],
|
||||
));
|
||||
},
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios),
|
||||
subtitle: Text(
|
||||
controller.prfoileData['gender'].toString()),
|
||||
onTap: () {
|
||||
Get.defaultDialog(
|
||||
title: 'Update Gender'.tr,
|
||||
content: Column(
|
||||
children: [
|
||||
GenderPicker(),
|
||||
MyElevatedButton(
|
||||
title: 'Update'.tr,
|
||||
onPressed: () {
|
||||
controller.updateColumn({
|
||||
'id': controller.prfoileData['id']
|
||||
.toString(),
|
||||
'gender': controller.gender,
|
||||
});
|
||||
Get.back();
|
||||
},
|
||||
)
|
||||
],
|
||||
));
|
||||
// controller.updatField('gender');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Education'.tr,
|
||||
style: AppStyle.title,
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Employment Type'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
leading: Image.asset(
|
||||
'assets/images/employmentType.png',
|
||||
width: 35,
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios),
|
||||
subtitle: Text(controller
|
||||
.prfoileData['employmentType']
|
||||
.toString()),
|
||||
onTap: () {
|
||||
controller.updatField('employmentType');
|
||||
},
|
||||
),
|
||||
leading: Image.asset(
|
||||
'assets/images/education.png',
|
||||
width: 35,
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Marital Status'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
leading: Image.asset(
|
||||
'assets/images/maritalStatus.png',
|
||||
width: 35,
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios),
|
||||
subtitle: Text(controller
|
||||
.prfoileData['maritalStatus']
|
||||
.toString()),
|
||||
onTap: () {
|
||||
controller.updatField('maritalStatus');
|
||||
},
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios),
|
||||
subtitle: Text(
|
||||
controller.prfoileData['education'].toString()),
|
||||
onTap: () {
|
||||
Get.defaultDialog(
|
||||
title: 'Update Education'.tr,
|
||||
content: Column(
|
||||
children: [
|
||||
EducationDegreePicker(),
|
||||
MyElevatedButton(
|
||||
title: 'Update Education'.tr,
|
||||
onPressed: () {
|
||||
controller.updateColumn({
|
||||
'id': controller.prfoileData['id']
|
||||
.toString(),
|
||||
'education':
|
||||
controller.selectedDegree,
|
||||
});
|
||||
Get.back();
|
||||
},
|
||||
)
|
||||
],
|
||||
));
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Employment Type'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
leading: Image.asset(
|
||||
'assets/images/employmentType.png',
|
||||
width: 35,
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios),
|
||||
subtitle: Text(controller
|
||||
.prfoileData['employmentType']
|
||||
.toString()),
|
||||
onTap: () {
|
||||
controller.updatField('employmentType');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Marital Status'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
leading: Image.asset(
|
||||
'assets/images/maritalStatus.png',
|
||||
width: 35,
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios),
|
||||
subtitle: Text(controller
|
||||
.prfoileData['maritalStatus']
|
||||
.toString()),
|
||||
onTap: () {
|
||||
controller.updatField('maritalStatus');
|
||||
},
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
))
|
||||
)),
|
||||
Positioned(
|
||||
left: 70,
|
||||
bottom: 5,
|
||||
right: 70,
|
||||
child: MyElevatedButton(
|
||||
title: 'Sign Out'.tr,
|
||||
onPressed: () {
|
||||
LogOut().logOut();
|
||||
}),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class Language extends GetView<LocaleController> {
|
||||
onPressed: () {
|
||||
controller.changeLang("ar");
|
||||
// main();
|
||||
box.read(BoxName.email).toString() != ''
|
||||
box.read(BoxName.email) != null
|
||||
? Get.offAll(() => const MapPage())
|
||||
: Get.offAll(() => LoginPage());
|
||||
},
|
||||
@@ -38,7 +38,7 @@ class Language extends GetView<LocaleController> {
|
||||
title: "En",
|
||||
onPressed: () {
|
||||
controller.changeLang("en");
|
||||
box.read(BoxName.email).toString() != ''
|
||||
box.read(BoxName.email) != null
|
||||
? Get.offAll(() => const MapPage())
|
||||
: Get.offAll(() => LoginPage());
|
||||
},
|
||||
|
||||
@@ -2,6 +2,10 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../controller/functions/crud.dart';
|
||||
import '../../main.dart';
|
||||
import '../widgets/my_scafold.dart';
|
||||
|
||||
class NotificationPage extends StatelessWidget {
|
||||
@@ -13,7 +17,13 @@ class NotificationPage extends StatelessWidget {
|
||||
isleading: true,
|
||||
title: 'Notifications',
|
||||
action: IconButton(
|
||||
onPressed: () {},
|
||||
onPressed: () async {
|
||||
print(box.read(BoxName.tokenFCM).toString());
|
||||
// await CRUD().post(link: AppLink.addTokens, payload: {
|
||||
// 'token': box.read(BoxName.tokenFCM).toString(),
|
||||
// 'passengerID': box.read(BoxName.pasengerID).toString()
|
||||
// }).then((value) => print('cccc'));
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.add,
|
||||
color: AppColor.primaryColor,
|
||||
|
||||
Reference in New Issue
Block a user