map_camera_flutter 0.0.5 copy "map_camera_flutter: ^0.0.5" to clipboard
map_camera_flutter: ^0.0.5 copied to clipboard

The Map Camera flutter package provides a convenient way to capture images with map and location data using the device's camera.

example/lib/main.dart

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});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: MyHomePage(
        title: 'Camera With Map Location',
        camera: camera,
      ),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title, required this.camera});
  final CameraDescription camera;

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          backgroundColor: Theme.of(context).colorScheme.inversePrimary,
          title: Text(widget.title),
        ),
        body: MapCameraLocation(
          camera: widget.camera,
          onImageCaptured: (ImageAndLocationData data) {
            print('Captured image path: ${data.imagePath}');
            print('Latitude: ${data.latitude}');
            print('Longitude: ${data.longitude}');
            print('Location name: ${data.locationName}');
            print('Sublocation: ${data.subLocation}');
          },
        ));
  }
}
7
likes
110
pub points
70%
popularity

Publisher

unverified uploader

The Map Camera flutter package provides a convenient way to capture images with map and location data using the device's camera.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

camera, cupertino_icons, flutter, flutter_compass, flutter_map, flutter_map_location_marker, geocoding, geolocator, intl, latlong2, path_provider, permission_handler, url_launcher

More

Packages that depend on map_camera_flutter