openAddressPicker function

Future<Prediction?> openAddressPicker(
  1. BuildContext context, {
  2. Location? initialValue,
  3. Set<String>? locationTypes,
  4. PredictionCallback? onSelect,
})

Implementation

Future<Prediction?> openAddressPicker(BuildContext context,
    {Location? initialValue,

    /// The types of locations returned by the API
    Set<String>? locationTypes,
    PredictionCallback? onSelect}) async {
  final intl = SunnyIntl.of(context)!;

  return await PlacesAutocomplete.show(
      hint: intl.addressSearch,
      context: context,
      location: initialValue,
      logo: emptyBox,
      types: locationTypes?.toList(),
      apiKey: ThirdPartyCreds.googlePlaces.credentials,
      listTileBuilder: (p, onTap) {
        return PlatformListTile(
          onTap: (_) => onTap!(p),
          leading: Icon(context.icons.location),
          title: Text(p.structuredFormatting?.mainText ?? ''),
          subtitle: Text(p.structuredFormatting?.secondaryText ?? ''),
        );
      },
      language: "en",
      components: []);
}