-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat 🥳: Added geo-tagging📍 functionality while reporting issues
- Loading branch information
1 parent
521d06a
commit e12bd0f
Showing
19 changed files
with
231 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import 'dart:developer'; | ||
|
||
import 'package:file_picker/file_picker.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:geolocator/geolocator.dart'; | ||
import 'package:provider/provider.dart'; | ||
|
||
import '../provider/report_provider.dart'; | ||
import 'global_navigator.dart'; | ||
import 'screen_names.dart'; | ||
|
||
Future<bool> handleLocationPermission() async { | ||
bool serviceEnabled; | ||
LocationPermission permission; | ||
final context = navigatorKey.currentContext!; | ||
var scaffold = ScaffoldMessenger.of(context); | ||
|
||
serviceEnabled = await Geolocator.isLocationServiceEnabled(); | ||
if (!serviceEnabled) { | ||
scaffold.showSnackBar(const SnackBar( | ||
content: Text( | ||
'Location services are disabled. Please enable the services', | ||
))); | ||
return false; | ||
} | ||
permission = await Geolocator.checkPermission(); | ||
if (permission == LocationPermission.denied) { | ||
permission = await Geolocator.requestPermission(); | ||
if (permission == LocationPermission.denied) { | ||
scaffold.showSnackBar( | ||
const SnackBar( | ||
content: Text('Location permissions are denied'), | ||
), | ||
); | ||
return false; | ||
} | ||
} | ||
if (permission == LocationPermission.deniedForever) { | ||
scaffold.showSnackBar( | ||
const SnackBar( | ||
content: Text( | ||
'Location permissions are permanently denied, we cannot request permissions.', | ||
), | ||
), | ||
); | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
Future<void> chooseImageFromGallery() async { | ||
final context = navigatorKey.currentContext!; | ||
final navigator = Navigator.of(context); | ||
final model = context.read<ReportProvider>(); | ||
FilePickerResult? result = await FilePicker.platform.pickFiles(); | ||
|
||
if (result != null) { | ||
final String imagePath = result.files.single.path ?? ""; | ||
model.path = imagePath; | ||
navigator.pushNamed( | ||
Screens.reportScreen.route, | ||
); | ||
log("imagePath = $imagePath"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class ReviewScreen extends StatelessWidget { | ||
const ReviewScreen({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return const Placeholder(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.