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

discontinued

Extended features for MapboxMap plugin, enabling users to cache locations and use custom markers

example/lib/main.dart

import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:mapbox_ext/mapbox_ext.dart';

void main() {
  runApp(App());
}

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    SystemChrome.setSystemUIOverlayStyle(
      SystemUiOverlayStyle(
        statusBarColor: Colors.transparent,
      ),
    );
    return MaterialApp(
      home: HomeScreen(),
    );
  }
}

class HomeScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: FutureBuilder(
        future: _loadConfigFile(),
        builder: (
          BuildContext cntx,
          AsyncSnapshot<Map<String, dynamic>> snapshot,
        ) {
          if (snapshot.hasData) {
            return MapboxExt(
              initialPoint: MapboxExt.INIT_LOCATION_EUROPE,
              accessToken: snapshot.data['mapbox_api_token'] as String,
              styleURL: snapshot.data['mapbox_style_url'] as String,
              markerResourceName: 'place',
              markerResourcePath: 'assets/place.png',
            );
          } else {
            return Center(
              child: CircularProgressIndicator(),
            );
          }
        },
      ),
    );
  }

  Future<Map<String, dynamic>> _loadConfigFile() async {
    String jsonString = await rootBundle.loadString('assets/config.json');
    return jsonDecode(jsonString) as Map<String, dynamic>;
  }
}
0
likes
40
points
12
downloads

Publisher

unverified uploader

Weekly Downloads

Extended features for MapboxMap plugin, enabling users to cache locations and use custom markers

Repository (GitHub)

License

MIT (license)

Dependencies

flutter, location, mapbox_gl, shared_preferences

More

Packages that depend on mapbox_ext