diff --git a/example/lib/main.dart b/example/lib/main.dart index 8953ac1..4ad6d28 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -39,44 +39,10 @@ class MyHomePage extends StatefulWidget { class _MyHomePageState extends State { - Future _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 diff --git a/example/pubspec.lock b/example/pubspec.lock index b88d402..1e2e217 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -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" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 6ffefb3..b87a641 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -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: ../ diff --git a/lib/src/map_camera.dart b/lib/src/map_camera.dart index da4a82e..a79d240 100644 --- a/lib/src/map_camera.dart +++ b/lib/src/map_camera.dart @@ -80,7 +80,7 @@ class _MapCameraLocationState extends State { /// 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 { @override void dispose() { _controller.dispose(); - // _followCurrentLocationStreamController.close(); + _followCurrentLocationStreamController.close(); super.dispose(); } @@ -436,14 +436,6 @@ class _MapCameraLocationState extends State { // 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) {