flutter_mapbox_autocomplete 2.0.0 copy "flutter_mapbox_autocomplete: ^2.0.0" to clipboard
flutter_mapbox_autocomplete: ^2.0.0 copied to clipboard

A Flutter Package for MapBox Places autocomplete which allows you use the MapBox API's to get autocomplete text of places

example/lib/main.dart

import 'package:flutter/material.dart';
import 'tokens.dart';
import 'package:flutter_mapbox_autocomplete/flutter_mapbox_autocomplete.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter MapBox AutoComplete',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      debugShowCheckedModeBanner: false,
      home: Home(),
    );
  }
}

class Home extends StatefulWidget {
  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
  final _startPointController = TextEditingController();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Flutter MapBox AutoComplete example"),
      ),
      body: SingleChildScrollView(
        padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15),
        child: CustomTextField(
          hintText: "Select starting point",
          textController: _startPointController,
          onTap: () {
            Navigator.push(
              context,
              MaterialPageRoute(
                builder: (context) => MapBoxAutoCompleteWidget(
                  apiKey: Tokens.MAPBOX_ACCESS_TOKEN,
                  hint: "Select starting point",
                  onSelect: (place) {
                    _startPointController.text = place.placeName;
                  },
                  limit: 10,
                  country: "NG",
                ),
              ),
            );
          },
          enabled: true,
        ),
      ),
    );
  }
}
19
likes
110
pub points
84%
popularity

Publisher

verified publisherlhamy.codes

A Flutter Package for MapBox Places autocomplete which allows you use the MapBox API's to get autocomplete text of places

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, http

More

Packages that depend on flutter_mapbox_autocomplete