{"id":32290459,"url":"https://github.com/josluna98/address_search_field","last_synced_at":"2025-10-23T02:51:57.430Z","repository":{"id":40388904,"uuid":"250671073","full_name":"JosLuna98/address_search_field","owner":"JosLuna98","description":"An address search field which helps to autocomplete an address by a reference. It can be used to get Directions beetwen two (or more) points.","archived":false,"fork":false,"pushed_at":"2024-04-22T13:37:21.000Z","size":119982,"stargazers_count":13,"open_issues_count":14,"forks_count":37,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-23T02:51:52.780Z","etag":null,"topics":["android","builder","flutter","ios","web","widgets"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JosLuna98.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-03-27T23:24:01.000Z","updated_at":"2022-08-14T02:55:00.000Z","dependencies_parsed_at":"2024-12-18T10:42:06.830Z","dependency_job_id":null,"html_url":"https://github.com/JosLuna98/address_search_field","commit_stats":{"total_commits":145,"total_committers":2,"mean_commits":72.5,"dds":0.4758620689655172,"last_synced_commit":"44fa3a94df6ba6e2d21d7854120407f37019a6a6"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/JosLuna98/address_search_field","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JosLuna98%2Faddress_search_field","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JosLuna98%2Faddress_search_field/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JosLuna98%2Faddress_search_field/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JosLuna98%2Faddress_search_field/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JosLuna98","download_url":"https://codeload.github.com/JosLuna98/address_search_field/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JosLuna98%2Faddress_search_field/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280551632,"owners_count":26349596,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-23T02:00:06.710Z","response_time":142,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","builder","flutter","ios","web","widgets"],"created_at":"2025-10-23T02:51:51.053Z","updated_at":"2025-10-23T02:51:57.423Z","avatar_url":"https://github.com/JosLuna98.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Address Search Field\nWidget builders to create 'address search widgets' which helps to autocomplete an address using a reference. They can be used to get Directions beetwen two places with optional waypoints. These widgets are made to be showed by `onTap` in a `TextField` with the `showDialog` function.\nIt uses [Dio](https://pub.dev/packages/dio/versions/4.0.6), [Google Maps for Flutter](https://pub.dev/packages/google_maps_flutter/versions/2.1.5), [Flutter Riverpod](https://pub.dev/packages/flutter_riverpod/versions/1.0.3) plugins. (This last plugin is to use extended objects that can be usable with `GoogleMap` Widget).  \n![](https://raw.githubusercontent.com/JosLuna98/address_search_field/master/screenshot/address_search_field.gif)\n## Getting Started\nTo use this plugin, add `address_search_field` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/). For example:\n```yaml\ndependencies:\n  address_search_field: ^5.0.3\n```\n## Permissions\n### Android\nOn Android you'll need to add the internet permission to your Android Manifest file (located under android/app/src/main). To do so add next lines as direct child of the `manifest\u003e` tag:\n``` xml\n\u003cuses-permission android:name=\"android.permission.INTERNET\"/\u003e\n```\n## Usage\nImport the package:\n```dart\nimport 'package:address_search_field/address_search_field.dart';\n```\n## GeoMethods\n```dart\nGeoMethods(\n  googleApiKey: String,\n  language: String,\n  countryCode: String?,\n  countryCodes: List\u003cString\u003e?,\n  country: String?,\n  city: String?,\n  mode: DirectionsMode?,\n  units: DirectionsUnits?,\n);\n```\n* This object makes calls to Google APIs using the parameters set. It can do requests to Google places, geocode and directions APIs [Get API key](https://developers.google.com/maps/documentation/embed/get-api-key).\n* Language support list [here](https://developers.google.com/maps/faq#languagesupport).\n* List of countries [here](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes).\nExample:\n```dart\nfinal geoMethods = GeoMethods(\n  googleApiKey: 'GOOGLE_API_KEY',\n  language: 'en',\n  countryCode: 'us',\n  countryCodes: ['us', 'es', 'co'],\n  country: 'United States',\n  city: 'New York',\n);\n\n// It will search in unite states, espain and colombia. It just can filter up to 5 countries.\ngeoMethods.autocompletePlace(query: 'place streets or reference');\n\ngeoMethods.geoLocatePlace(\n    coords: Coords(0.10, 0.10,)\n);\n\ngeoMethods.getPlaceGeometry(\n    reference: 'place streets',\n    placeId: 'ajFDN3662fNsa4hhs42FAjeb5n',\n);\n\n// It needs a specific region, it will search in unite states.\ngeoMethods.getDirections(\n    origin: Address(coords: Coords(0.10, 0.10)), \n    destination: Address(coords: Coords(0.10, 0.10))\n);\n```\n## AddressSearchBuilder\nThis widget can search addresses and permits you to work with them using an `Address` object.\n\nExample:\n```dart\nGeoMethods geoMethods;\nTextEditingController controller;\nAddress destinationAddress;\n\nTextField(\n  controller: controller,\n  onTap: () =\u003e showDialog(\n    context,\n    builder: (BuildContext context) =\u003e AddressSearchDialog(\n      geoMethods: geoMethods,\n      controller: controller,\n      onDone: (Address address) =\u003e destinationAddress = address,\n    )\n  ),\n);\n```\n\u003e`AddressSearchDialog.custom` provides you a widget builder with the parameters and methods to create your own `AddressSearchDialog` and work with the addresses information.\n\nExample:\n```dart\nGeoMethods geoMethods;\nTextEditingController controller;\nAddress destinationAddress;\n\nTextField(\n  controller: controller,\n  onTap: () =\u003e showDialog(\n    context,\n    builder: (BuildContext context) {\n      return AddressSearchDialog.custom(\n        geoMethods: geoMethods,\n        builder: (\n          BuildContext context,\n          AsyncSnapshot\u003cList\u003cAddress\u003e\u003e snapshot,\n          Future\u003cvoid\u003e Function() searchAddress,\n          Future\u003cAddress\u003e Function(Address address) getGeometry,\n          void Function() dismiss,\n        ) {\n          return MyCustomWidget(\n            snapshot: snapshot,\n            searchAddress: searchAddress,\n            getGeometry: getGeometry,\n            dismiss: dismiss,\n            controller: controller,\n            address: destinationAddress,\n          );\n        }\n      );\n    }\n  ),\n);\n```\n## AddressLocator\nThis widget is a simple way to get an address reference in a `TextEditingController` from coordinates when the `AddressSearchDialog` is not created into a `RouteSearchBox`.\n\nExample:\n```dart\nCoords coords;\nGeoMethods geoMethods;\nTextEditingController controller;\nAddress initialAddress;\n\n// using coordinates you can get an address reference to be predefined in the widget and save all the address data in a variable.\nAddressLocator(\n  coords: coords,\n  geoMethods: geoMethods,\n  controller: controller,\n  child: TextField(\n    controller: controller,\n    onTap: () =\u003e showDialog(\n      context: context,\n      builder: (BuildContext context) =\u003e AddressSearchDialog(\n        controller: controller,\n        geoMethods: geoMethods,\n        onDone: (Address address) =\u003e initialAddress = address;,\n      ),\n    ),\n  ),\n);\n```\n## RouteSearchBox\nThis widget helps you to works using a provider from `flutter_riverpod`. It permits you to work with `AddressSearchDialog` to search an origin `Address`, destination `Address` and optionally waypoints in a `List\u003cAddress\u003e`. This widget is used to get directions from the addresses gotten by an `AddressSearchDialog`. `provider.findRoute()` function permits to set an address as origin or destination from a coordinates parameter.\nA completed example of how to use this widget could be found [here](https://pub.dev/packages/address_search_field/example).\n\nExample:\n```dart\nfinal routeProvider =\n    ChangeNotifierProvider\u003cRouteNotifier\u003e((ref) =\u003e RouteNotifier());\n\nGeoMethods geoMethods;\nTextEditingController originCtrl;\nTextEditingController destCtrl;\nCoords initialCoords;\n\nRouteSearchBox(\n  provider: routeProvider,\n  geoMethods: geoMethods,\n  originController: originCtrl,\n  destinationController: destCtrl,\n  locationSetters: [\n    LocationSetter(\n      coords: initialCoords,\n      addressId: AddressId.origin,\n    ),\n  ],\n  child: Column(\n    children: [\n      TextField(\n        controller: originCtrl,\n        onTap: () =\u003e showDialog(\n          context: context,\n          builder:(context) =\u003e \n              AddressSearchDialog.withProvider(\n            provider: routeProvider,\n            addressId: AddressId.origin,\n          ),\n        ),\n      ),\n      TextField(\n        controller: destCtrl,\n        onTap: () =\u003e showDialog(\n          context: context,\n          builder:(context) =\u003e \n              AddressSearchDialog.withProvider(\n            provider: routeProvider,\n            addressId: AddressId.destination,\n          ),\n        ),\n      ),\n      Consumer(\n        builder: (BuildContext context, WidgetRef ref, Widget? _) {\n          return ElevatedButton(\n            child: const Text('Search'),\n            onPressed: () async {\n              final route = await ref.read(routeProvider).findRoute();\n            },\n          );\n        },\n      ),\n    ],\n  )\n);\n```\n##  License\nMIT License\n\n## Contact\nYou can contact me if you have problems or ideas. Hablo español e inglés.\n\njosluna1098@gmail.com","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosluna98%2Faddress_search_field","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosluna98%2Faddress_search_field","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosluna98%2Faddress_search_field/lists"}