mapbox_map_gl 0.0.2 copy "mapbox_map_gl: ^0.0.2" to clipboard
mapbox_map_gl: ^0.0.2 copied to clipboard

outdated

A flutter plugin for mapbox map.

example/lib/main.dart

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:mapbox_map_gl/mapbox_map_gl.dart';

void main() {
  runApp(const MyApp());
}

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: MapboxMap(
          initialCameraPosition: CameraPosition(
            center: LatLng(27.837785, 82.538961),
            zoom: 15.0,
            // anchor: ScreenCoordinate(120.0, 200.0),
            animationOptions: AnimationOptions.mapAnimationOptions(
              startDelay: 300,
              duration: const Duration(milliseconds: 750),
            ),
          ),
          onMapCreated: (controller) {
            if (kDebugMode) {
              print("[Method Call -> onMapCreated] ---> From _MyAppState");
            }
          },
          onStyleLoaded: () {
            if (kDebugMode) {
              print("[Method Call -> onStyleLoaded] ---> From _MyAppState");
            }
          },
          onStyleLoadError: (err) {
            if (kDebugMode) {
              print(
                  "[Method Call -> onStyleLoadError] ---> From _MyAppState -> $err");
            }
          },
          onMapClick: (latLng, screenCoordinate) {
            if (kDebugMode) {
              print("[Method Call -> onMapClick] ---> ${latLng.toJson()}, ${screenCoordinate.toJson()}");
            }
          },
          onMapLongClick: (latLng, screenCoordinate) {
            if (kDebugMode) {
              print("[Method Call -> onMapLongClick] ---> ${latLng.toJson()}, ${screenCoordinate.toJson()}");
            }
          },
          onFeatureClick: (latLng, screenCoordinate, feature, source) {
            if (kDebugMode) {
              print("[Method Call -> onFeatureClick] ---> $source, ${feature.toString()}");
            }
          },
          onFeatureLongClick: (latLng, screenCoordinate, feature, source) {
            if (kDebugMode) {
              print("[Method Call -> onFeatureClick] ---> $source, ${feature.toString()}");
            }
          },
        ),
      ),
    );
  }
}
7
likes
0
pub points
67%
popularity

Publisher

unverified uploader

A flutter plugin for mapbox map.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on mapbox_map_gl