A Flutter package that provides a widget for capturing high-quality images with the device camera and overlaying location information as readable text.
- High-quality image capture using the device camera (no screenshots)
- Real-time location tracking with GPS coordinates and address information
- Text overlay with location data, coordinates, and timestamp
- Fast processing - captures and processes images in under 1 second
- Clean UI with minimal overlay elements for better image quality
- Automatic location updates every second
To use this package, add map_camera_flutter as a dependency in your pubspec.yaml file.
dependencies:
map_camera_flutter: ^1.0.0Import the package in your Dart file:
import 'package:map_camera_flutter/map_camera_flutter.dart';Before using the package, make sure to add the necessary location permission to your AndroidManifest.xml file.
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />The MapCameraLocation widget is used to capture high-quality images with location data overlay. It requires a CameraDescription object and an optional callback function for receiving the captured image and location data.
MapCameraLocation(
camera: yourCameraDescription,
onImageCaptured: yourCallbackFunction,
)The camera parameter is required and represents the camera to be used for capturing images. You can obtain a CameraDescription object using the camera package or any other camera plugin.
The onImageCaptured parameter is an optional callback function that will be triggered when an image and location data are captured. The function should have the following signature:
void yourCallbackFunction(ImageAndLocationData data) {
// Handle the captured image and location data
}The ImageAndLocationData object contains the captured image file path and the location information (latitude, longitude, location name, and sublocation).
- Camera Preview: Displays a live camera feed with minimal UI overlays
- Location Tracking: Continuously updates GPS coordinates and address information
- Image Capture: Takes a high-quality photo using the camera's native resolution
- Text Overlay: Adds location data, coordinates, and timestamp as readable text
- Fast Processing: Optimized image processing for quick results
Here's an example of how to use the MapCameraLocation widget:
import 'package:flutter/material.dart';
import 'package:map_camera_flutter/map_camera_flutter.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final cameras = await availableCameras();
final firstCamera = cameras.first;
runApp(MyApp(camera: firstCamera));
}
class MyApp extends StatelessWidget {
final CameraDescription camera;
const MyApp({super.key, required this.camera});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('High-Quality Camera with Location'),
),
body: Center(
child: MapCameraLocation(
camera: camera,
onImageCaptured: (ImageAndLocationData data) {
// Handle the captured image and location data
print('Image Path: ${data.imagePath}');
print('Latitude: ${data.latitude}');
print('Longitude: ${data.longitude}');
print('Location Name: ${data.locationName}');
print('SubLocation: ${data.subLocation}');
},
),
),
),
);
}
}This package is specifically designed for applications that require high-quality images with readable text, such as:
- Document scanning and OCR applications
- Field inspection and survey tools
- Real estate and property documentation
- Travel and tourism photo apps
- Any application where text readability is crucial
- Capture Speed: Images are captured and processed in under 1 second
- Memory Efficient: Optimized image processing with minimal memory usage
- Battery Friendly: Efficient location updates and camera management
If you encounter any issues or have suggestions for improvements, please file an issue on the GitHub repository.
Pull requests are also welcome! If you would like to contribute to this package, feel free to open a pull request with your proposed changes.
This package is released under the MIT License. See the LICENSE file for more details.
