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. Color? searchBarTextColor = Colors.black87,
  7. String? searchBarHintText = 'Search location',
  8. String? currentPositionButtonText = 'Use current location',
  9. Color? searchBarHintColor = Colors.black87,
  10. bool? lightAdress = false,
  11. Color? iconColor = Colors.grey,
  12. Widget? loadingWidget,
  13. Mode mode = Mode.fullscreen,
  14. int historyMaxLength = 5,
})

Implementation

static Future<LocationData?> show({
  required BuildContext context,
  void Function(Exception e)? onError,
  String? language = 'en',
  List<String>? countryCodes,
  Color? searchBarBackgroundColor,
  Color? searchBarTextColor = Colors.black87,
  String? searchBarHintText = 'Search location',
  String? currentPositionButtonText = 'Use current location',
  Color? searchBarHintColor = Colors.black87,
  bool? lightAdress = false,
  Color? iconColor = Colors.grey,
  Widget? loadingWidget,
  Mode mode = Mode.fullscreen,
  int historyMaxLength = 5,
}) {
  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,
        lightAdress: lightAdress,
        iconColor: iconColor,
        loadingWidget: loadingWidget,
        mode: mode,
        historyMaxLength: historyMaxLength,
      );

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