latlong_maps 1.1.2 copy "latlong_maps: ^1.1.2" to clipboard
latlong_maps: ^1.1.2 copied to clipboard

The LatLongMaps Flutter plugin: Effortlessly integrate interactive maps, handle geospatial data with ease. Visualize locations, perform geocoding, reverse geocoding, and customize map styles. Empowers [...]

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:latlong_maps_example/samples/add_marker.dart';
import 'package:latlong_maps_example/samples/add_symbol.dart';
import 'package:latlong_maps_example/samples/place_circle.dart';
import 'page.dart';
import 'samples/full_map.dart';
import 'package:location/location.dart';
import 'package:latlong_maps_example/samples/map_picker_example_app.dart';
import 'package:latlong_maps_example/samples/map_with_search_bar.dart';
import 'package:latlong_maps_example/samples/direction_widget.dart';
import 'package:latlong_maps_example/samples/add_line.dart';
import 'package:latlong_maps_example/samples/annotation_order_maps.dart';
import 'package:latlong_maps_example/samples/click_annotations.dart';

final List<ExamplePage> _allPages = <ExamplePage>[
  const FullMapPage(),
  const AddMarkerPage(),
  const PlaceSymbolPage(),
  const LinePage(),
  const PlaceCirclePage(),
  const MapPickerExample(),
  const MapWithSearchBarPage(),
  const MapDirectionsPage(),
  const AnnotationOrderPage(),
  const ClickAnnotationPage()
];

class MapsDemo extends StatefulWidget {
  const MapsDemo({super.key});

  @override
  State<MapsDemo> createState() => _MapsDemoState();
}

class _MapsDemoState extends State<MapsDemo> {

  void _pushPage(BuildContext context, ExamplePage page) async {
    if (page.needsLocationPermission) {
      final location = Location();
      final hasPermissions = await location.hasPermission();
      if (hasPermissions != PermissionStatus.granted) {
        await location.requestPermission();
      }
    }
    if (!mounted) return;

    Navigator.of(context).push(MaterialPageRoute<void>(
        builder: (_) => Scaffold(
              appBar: AppBar(title: Text(page.title)),
              body: page,
            )));
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Latlong Plugin Demo')),
      body: ListView.builder(
        itemCount: _allPages.length,
        itemBuilder: (_, int index) => index == _allPages.length
            ? const AboutListTile(
                applicationName: "",
              )
            : ListTile(
          leading: _allPages[index].leading,
          title: Text(_allPages[index].title),
          onTap: () => _pushPage(context, _allPages[index]),
        ),
      ),
    );
  }
}

void main() {
  runApp(const MaterialApp(home: MapsDemo()));
}
1
likes
130
pub points
13%
popularity

Publisher

unverified uploader

The LatLongMaps Flutter plugin: Effortlessly integrate interactive maps, handle geospatial data with ease. Visualize locations, perform geocoding, reverse geocoding, and customize map styles. Empowers dynamic and engaging Flutter projects.

Homepage

Documentation

API reference

License

unknown (license)

Dependencies

dart_json_mapper, flutter, flutter_latlong_map_interface, flutter_latlong_test, http, plugin_platform_interface

More

Packages that depend on latlong_maps