show static method

Future<LocationData?> show({
  1. required BuildContext context,
  2. void onError(
    1. Exception e
    )?,
  3. String language = 'en',
  4. List<String>? countryCodes,
  5. Color? searchBarBackgroundColor,
  6. required UserAgent userAgent,
  7. Color searchBarTextColor = Colors.black87,
  8. String searchBarHintText = 'Search location',
  9. String currentPositionButtonText = 'Use current location',
  10. Color searchBarHintColor = Colors.black87,
  11. bool lightAddress = false,
  12. Color iconColor = Colors.grey,
  13. Widget? loadingWidget,
  14. Widget upperWidget(
    1. BuildContext context
    )?,
  15. String? googlePlacesSearchKey,
  16. Mode mode = Mode.fullscreen,
  17. int historyMaxLength = 5,
  18. bool showAddressNumberOption = true,
  19. String addressNumberButtonText = "Add number",
  20. IconData? addressNumberButtonIcon = Icons.add,
  21. Color? addressNumberButtonColor,
  22. Color? addressNumberButtonBackground,
  23. double addressNumberButtonTextSize = 12,
})

Implementation

static Future<LocationData?> show({
  required BuildContext context,
  void Function(Exception e)? onError,
  String language = 'en',
  List<String>? countryCodes,
  Color? searchBarBackgroundColor,
  required UserAgent userAgent,
  Color searchBarTextColor = Colors.black87,
  String searchBarHintText = 'Search location',
  String currentPositionButtonText = 'Use current location',
  Color searchBarHintColor = Colors.black87,
  bool lightAddress = false,
  Color iconColor = Colors.grey,
  Widget? loadingWidget,
  Widget Function(BuildContext context)? upperWidget,
  String? googlePlacesSearchKey,
  Mode mode = Mode.fullscreen,
  int historyMaxLength = 5,
  bool showAddressNumberOption = true,
  String addressNumberButtonText = "Add number",
  IconData? addressNumberButtonIcon = Icons.add,
  Color? addressNumberButtonColor,
  Color? addressNumberButtonBackground,
  double addressNumberButtonTextSize = 12,
}) {
  LocationSearchWidget builder(BuildContext ctx) => LocationSearchWidget(
        onPicked: (data) => Navigator.pop(context, data),
        onError: onError,
        language: language,
        countryCodes: countryCodes,
        searchBarBackgroundColor: searchBarBackgroundColor,
        searchBarTextColor: searchBarTextColor,
        searchBarHintText: searchBarHintText,
        currentPositionButtonText: currentPositionButtonText,
        searchBarHintColor: searchBarHintColor,
        lightAddress: lightAddress,
        iconColor: iconColor,
        upperWidget: upperWidget,
        googlePlacesSearchKey: googlePlacesSearchKey,
        loadingWidget: loadingWidget,
        mode: mode,
        historyMaxLength: historyMaxLength,
        userAgent: userAgent,
        showAddressNumberOption: showAddressNumberOption,
        addressNumberButtonText: addressNumberButtonText,
        addressNumberButtonIcon: addressNumberButtonIcon,
        addressNumberButtonColor: addressNumberButtonColor,
        addressNumberButtonBackground: addressNumberButtonBackground,
        addressNumberButtonTextSize: addressNumberButtonTextSize,
      );

  if (mode == Mode.overlay) {
    return showDialog(context: context, builder: builder);
  }
  return Navigator.push(context, MaterialPageRoute(builder: builder));
}