camera_location_picker 0.0.3
camera_location_picker: ^0.0.3 copied to clipboard
A Flutter plugin for capturing camera images with location overlay.
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:camera_location_picker/camera_location_picker.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Camera Location Picker Demo',
theme: ThemeData(primarySwatch: Colors.blue),
home: const HomePage(),
);
}
}
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
File? capturedImage;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Camera Location Picker Demo'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (capturedImage != null)
Image.file(
capturedImage!,
width: 300,
height: 300,
fit: BoxFit.cover,
)
else
const Text('No image captured yet'),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () async {
// Open plugin's CustomCameraScreen
final file = await Navigator.push<File>(
context,
MaterialPageRoute(
builder: (_) => CustomCameraScreen(
onImageCaptured: (image) {
Navigator.pop(context, image);
},
),
),
);
if (file != null) {
setState(() {
capturedImage = file;
});
}
},
child: const Text('Open Camera'),
),
],
),
),
);
}
}