redmi update
This commit is contained in:
@@ -39,44 +39,10 @@ class MyHomePage extends StatefulWidget {
|
|||||||
|
|
||||||
class _MyHomePageState extends State<MyHomePage> {
|
class _MyHomePageState extends State<MyHomePage> {
|
||||||
|
|
||||||
Future<Position> _determinePosition() async {
|
|
||||||
bool serviceEnabled;
|
|
||||||
LocationPermission permission;
|
|
||||||
|
|
||||||
// Check if location services are enabled
|
|
||||||
serviceEnabled = await Geolocator.isLocationServiceEnabled();
|
|
||||||
if (!serviceEnabled) {
|
|
||||||
// If location services are disabled, show an error message or request the user to enable them
|
|
||||||
throw Exception('Location services are disabled.');
|
|
||||||
}
|
|
||||||
// Check location permission
|
|
||||||
permission = await Geolocator.checkPermission();
|
|
||||||
if (permission == LocationPermission.denied) {
|
|
||||||
// If location permission is denied, request it
|
|
||||||
permission = await Geolocator.requestPermission();
|
|
||||||
if (permission == LocationPermission.denied) {
|
|
||||||
// If location permission is still denied, show an error message or redirect the user to the app settings
|
|
||||||
throw Exception('Location permissions are denied');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if location permission is permanently denied
|
|
||||||
if (permission == LocationPermission.deniedForever) {
|
|
||||||
// Show an error message or redirect the user to the app settings to enable location permissions
|
|
||||||
throw Exception('Location permissions are permanently denied, we cannot request permissions.');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the current position
|
|
||||||
return await Geolocator.getCurrentPosition(
|
|
||||||
desiredAccuracy: LocationAccuracy.best,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
// TODO: implement initState
|
// TODO: implement initState
|
||||||
super.initState();
|
super.initState();
|
||||||
_determinePosition();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ packages:
|
|||||||
path: ".."
|
path: ".."
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "0.0.0"
|
version: "0.0.2"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -416,7 +416,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.7"
|
version: "2.1.7"
|
||||||
permission_handler:
|
permission_handler:
|
||||||
dependency: "direct dev"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: permission_handler
|
name: permission_handler
|
||||||
sha256: "37fcc3c3182ac0bf8856f3e973e11c7bef5556d69f1a0d8fb908f51019c2912d"
|
sha256: "37fcc3c3182ac0bf8856f3e973e11c7bef5556d69f1a0d8fb908f51019c2912d"
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ dependencies:
|
|||||||
# The following adds the Cupertino Icons font to your application.
|
# The following adds the Cupertino Icons font to your application.
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
# Use with the CupertinoIcons class for iOS style icons.
|
||||||
cupertino_icons: ^1.0.2
|
cupertino_icons: ^1.0.2
|
||||||
|
permission_handler:
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
@@ -46,7 +47,6 @@ dev_dependencies:
|
|||||||
# package. See that file for information about deactivating specific lint
|
# package. See that file for information about deactivating specific lint
|
||||||
# rules and activating additional ones.
|
# rules and activating additional ones.
|
||||||
flutter_lints: ^2.0.0
|
flutter_lints: ^2.0.0
|
||||||
permission_handler:
|
|
||||||
map_camera_flutter:
|
map_camera_flutter:
|
||||||
path: ../
|
path: ../
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class _MapCameraLocationState extends State<MapCameraLocation> {
|
|||||||
/// File path of the captured camera image.
|
/// File path of the captured camera image.
|
||||||
|
|
||||||
File? ssImage;
|
File? ssImage;
|
||||||
/// (Please provide information about its purpose.)
|
/// File path of the captured screen shot image.
|
||||||
|
|
||||||
String? dateTime;
|
String? dateTime;
|
||||||
/// A formatted string representing the current date and time.
|
/// A formatted string representing the current date and time.
|
||||||
@@ -135,7 +135,7 @@ class _MapCameraLocationState extends State<MapCameraLocation> {
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_controller.dispose();
|
_controller.dispose();
|
||||||
// _followCurrentLocationStreamController.close();
|
_followCurrentLocationStreamController.close();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,14 +436,6 @@ class _MapCameraLocationState extends State<MapCameraLocation> {
|
|||||||
// If location services are disabled, throw an exception
|
// If location services are disabled, throw an exception
|
||||||
throw Exception('Location services are disabled.');
|
throw Exception('Location services are disabled.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check camera permission
|
|
||||||
final cameraStatus = await Permission.camera.status;
|
|
||||||
if (cameraStatus.isDenied || cameraStatus.isPermanentlyDenied) {
|
|
||||||
// If camera permission is not granted, request it
|
|
||||||
await Permission.camera.request();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check location permission
|
// Check location permission
|
||||||
permission = await Geolocator.checkPermission();
|
permission = await Geolocator.checkPermission();
|
||||||
if (permission == LocationPermission.denied) {
|
if (permission == LocationPermission.denied) {
|
||||||
|
|||||||
Reference in New Issue
Block a user