redmi update

This commit is contained in:
bijoy
2023-07-06 17:57:40 +06:00
parent ff605ae6bf
commit 9db8571a8b
4 changed files with 5 additions and 47 deletions

View File

@@ -39,44 +39,10 @@ class MyHomePage extends StatefulWidget {
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
void initState() {
// TODO: implement initState
super.initState();
_determinePosition();
}
@override

View File

@@ -326,7 +326,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.0"
version: "0.0.2"
matcher:
dependency: transitive
description:
@@ -416,7 +416,7 @@ packages:
source: hosted
version: "2.1.7"
permission_handler:
dependency: "direct dev"
dependency: "direct main"
description:
name: permission_handler
sha256: "37fcc3c3182ac0bf8856f3e973e11c7bef5556d69f1a0d8fb908f51019c2912d"

View File

@@ -35,6 +35,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
permission_handler:
dev_dependencies:
flutter_test:
@@ -46,7 +47,6 @@ dev_dependencies:
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.0
permission_handler:
map_camera_flutter:
path: ../

View File

@@ -80,7 +80,7 @@ class _MapCameraLocationState extends State<MapCameraLocation> {
/// File path of the captured camera image.
File? ssImage;
/// (Please provide information about its purpose.)
/// File path of the captured screen shot image.
String? dateTime;
/// A formatted string representing the current date and time.
@@ -135,7 +135,7 @@ class _MapCameraLocationState extends State<MapCameraLocation> {
@override
void dispose() {
_controller.dispose();
// _followCurrentLocationStreamController.close();
_followCurrentLocationStreamController.close();
super.dispose();
}
@@ -436,14 +436,6 @@ class _MapCameraLocationState extends State<MapCameraLocation> {
// If location services are disabled, throw an exception
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
permission = await Geolocator.checkPermission();
if (permission == LocationPermission.denied) {