5/3/1
This commit is contained in:
@@ -53,7 +53,7 @@ android {
|
|||||||
applicationId "com.mobileapp.store.ride"
|
applicationId "com.mobileapp.store.ride"
|
||||||
// You can update the following values to match your application needs.
|
// You can update the following values to match your application needs.
|
||||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||||
minSdkVersion 22
|
minSdkVersion 23
|
||||||
targetSdkVersion flutter.targetSdkVersion
|
targetSdkVersion flutter.targetSdkVersion
|
||||||
versionCode 22
|
versionCode 22
|
||||||
versionName '1.4.6'
|
versionName '1.4.6'
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class BoxName {
|
|||||||
static const String sexDriver = "sexDriver";
|
static const String sexDriver = "sexDriver";
|
||||||
static const String lastNameDriver = "lastNameDriver";
|
static const String lastNameDriver = "lastNameDriver";
|
||||||
static const String name = "name";
|
static const String name = "name";
|
||||||
|
static const String locationPermission = "locationPermission";
|
||||||
static const String nameDriver = "nameDriver";
|
static const String nameDriver = "nameDriver";
|
||||||
static const String driverPhotoUrl = "driverPhotoUrl";
|
static const String driverPhotoUrl = "driverPhotoUrl";
|
||||||
static const String email = "email";
|
static const String email = "email";
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import 'package:SEFER/controller/functions/secure_storage.dart';
|
|||||||
import 'package:SEFER/main.dart';
|
import 'package:SEFER/main.dart';
|
||||||
import 'package:SEFER/views/auth/verify_email_page.dart';
|
import 'package:SEFER/views/auth/verify_email_page.dart';
|
||||||
import 'package:SEFER/views/home/map_page_passenger.dart';
|
import 'package:SEFER/views/home/map_page_passenger.dart';
|
||||||
|
import 'package:location/location.dart';
|
||||||
|
// import 'package:permission_handler/permission_handler.dart';
|
||||||
|
|
||||||
class LoginController extends GetxController {
|
class LoginController extends GetxController {
|
||||||
final formKey = GlobalKey<FormState>();
|
final formKey = GlobalKey<FormState>();
|
||||||
@@ -147,8 +149,45 @@ class LoginController extends GetxController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final location = Location();
|
||||||
|
|
||||||
|
// late PermissionStatus permissionGranted = PermissionStatus.denied;
|
||||||
|
Future<void> getLocationPermission() async {
|
||||||
|
bool serviceEnabled;
|
||||||
|
PermissionStatus permissionGranted;
|
||||||
|
|
||||||
|
// Check if location services are enabled
|
||||||
|
serviceEnabled = await location.serviceEnabled();
|
||||||
|
if (!serviceEnabled) {
|
||||||
|
serviceEnabled = await location.requestService();
|
||||||
|
if (!serviceEnabled) {
|
||||||
|
// Location services are still not enabled, handle the error
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the app has permission to access location
|
||||||
|
permissionGranted = await location.hasPermission();
|
||||||
|
if (permissionGranted == PermissionStatus.denied) {
|
||||||
|
permissionGranted = await location.requestPermission();
|
||||||
|
if (permissionGranted != PermissionStatus.granted) {
|
||||||
|
// Location permission is still not granted, handle the error
|
||||||
|
permissionGranted = await location.requestPermission();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print('permisson is ${permissionGranted.toString()}');
|
||||||
|
if ('PermissionStatus.granted' == permissionGranted.toString()) {
|
||||||
|
box.write(BoxName.locationPermission, 'true');
|
||||||
|
}
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() async {
|
||||||
|
// permissionLocation = await Permission.locationWhenInUse.isGranted;
|
||||||
|
// print('permisson is ${permissionGranted}');
|
||||||
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1725,13 +1725,39 @@ class MapPassengerController extends GetxController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dialoge() {
|
||||||
|
Get.defaultDialog(
|
||||||
|
title: 'Location '.tr,
|
||||||
|
content: Container(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'We use location to get accurate and nearest driver for you'.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
// await Permission.location.request();
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'Grant'.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
double speed = 0;
|
double speed = 0;
|
||||||
Future<void> getLocation() async {
|
Future<void> getLocation() async {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
update();
|
update();
|
||||||
bool serviceEnabled;
|
bool serviceEnabled;
|
||||||
PermissionStatus permissionGranted;
|
PermissionStatus permissionGranted;
|
||||||
|
// dialoge();
|
||||||
// Check if location services are enabled
|
// Check if location services are enabled
|
||||||
serviceEnabled = await location.serviceEnabled();
|
serviceEnabled = await location.serviceEnabled();
|
||||||
if (!serviceEnabled) {
|
if (!serviceEnabled) {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class PaymobManager extends GetxController {
|
|||||||
// 2. Prepare Payment Data Payload
|
// 2. Prepare Payment Data Payload
|
||||||
final Map<String, dynamic> data = {
|
final Map<String, dynamic> data = {
|
||||||
"source": {
|
"source": {
|
||||||
"identifier": "01010101010", // Replace with actual source identifier
|
"identifier": box.read(BoxName.phone), //"01010101010"
|
||||||
"subtype": "WALLET",
|
"subtype": "WALLET",
|
||||||
},
|
},
|
||||||
"payment_token": paymentToken,
|
"payment_token": paymentToken,
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ import 'package:SEFER/main.dart';
|
|||||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||||
import 'package:SEFER/views/widgets/my_textField.dart';
|
import 'package:SEFER/views/widgets/my_textField.dart';
|
||||||
|
import 'package:location/location.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
// import 'package:permission_handler/permission_handler.dart';
|
||||||
|
|
||||||
import '../../constant/info.dart';
|
import '../../constant/info.dart';
|
||||||
import '../../controller/auth/login_controller.dart';
|
import '../../controller/auth/login_controller.dart';
|
||||||
@@ -34,6 +37,8 @@ class LoginPage extends StatelessWidget {
|
|||||||
agreedPage()
|
agreedPage()
|
||||||
else if (box.read(BoxName.countryCode) == null)
|
else if (box.read(BoxName.countryCode) == null)
|
||||||
CountryPicker()
|
CountryPicker()
|
||||||
|
else if (box.read(BoxName.locationPermission) != 'true')
|
||||||
|
locationPermissionDialog()
|
||||||
else
|
else
|
||||||
SingleChildScrollView(
|
SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -320,4 +325,38 @@ class LoginPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
locationPermissionDialog() {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Container(
|
||||||
|
height: Get.height * .4,
|
||||||
|
decoration: AppStyle.boxDecoration1,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
child: Center(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'We use location to get accurate and nearest driver for you'
|
||||||
|
.tr,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
MyElevatedButton(
|
||||||
|
title: 'Grant Location'.tr,
|
||||||
|
onPressed: () async {
|
||||||
|
await controller.getLocationPermission();
|
||||||
|
},
|
||||||
|
kolor: AppColor.greenColor,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user