address_search_text_field 0.1.0 copy "address_search_text_field: ^0.1.0" to clipboard
address_search_text_field: ^0.1.0 copied to clipboard

discontinuedreplaced by: address_search_field
outdated

A textfield displays an address search bar that gets nearby addresses by a reference. Selecting can get an object with the latitude, longitude, and full address of a place.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:address_search_text_field/address_search_text_field.dart';
import 'package:toast/toast.dart';

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

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

class MyHomePage extends StatelessWidget {
  final SearchAddressTextField searchAddress = SearchAddressTextField();

  @override
  Widget build(BuildContext context) {
    Size size = MediaQuery.of(context).size;
    return Scaffold(
      appBar: AppBar(),
      body: Center(
        child: Container(
          width: size.width * 0.80,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              SearchAddressTextField.widget(
                context: context,
                country: "Ecuador",
                exceptions: [
                  "Esmeraldas, Ecuador",
                  "Esmeraldas Province, Ecuador",
                  "Ecuador"
                ],
              ),
              SizedBox(
                height: 15.0,
              ),
              FlatButton(
                child: Text("get data"),
                color: Colors.blue,
                onPressed: () {
                  // I use toast dependency to better show the result
                  AddressPoint point = searchAddress.result;
                  Toast.show(
                    point.toString(),
                    context,
                    duration: Toast.LENGTH_LONG,
                    gravity: Toast.BOTTOM,
                  );
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}
4
likes
0
pub points
17%
popularity

Publisher

unverified uploader

A textfield displays an address search bar that gets nearby addresses by a reference. Selecting can get an object with the latitude, longitude, and full address of a place.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, geocoder, geolocator, location

More

Packages that depend on address_search_text_field