LocationField constructor

const LocationField({
  1. Key? key,
  2. String? label,
  3. LocationData? value,
  4. ValueChanged<LocationData?>? onChanged,
  5. FormFieldValidator<LocationData>? validator,
  6. InputDecoration? decoration,
  7. MapProvider mapProvider = MapProvider.openStreetMap,
  8. String? apiKey,
  9. double? initialZoom = 15.0,
  10. LocationData? initialLocation,
  11. bool showCurrentLocationButton = true,
  12. bool enableLocationSearch = true,
  13. bool enableMapSelection = true,
  14. String? searchHintText,
  15. bool showSearchSuggestions = true,
  16. int maxSearchSuggestions = 5,
  17. Future<List<LocationData>> customSearchProvider(
    1. String query
    )?,
  18. LocationType locationType = LocationType.all,
  19. List<String>? restrictToCountries,
  20. double? searchRadius,
  21. DistanceUnit searchRadiusUnit = DistanceUnit.kilometers,
  22. LocationData? searchBias,
  23. double mapHeight = 200.0,
  24. BorderRadius? mapBorderRadius,
  25. bool showFullScreenMapButton = true,
  26. Widget? mapLoadingWidget,
  27. Widget? locationIcon,
  28. Color? markerColor,
  29. bool enableZoomControls = true,
  30. bool enableMapTypeSelector = false,
  31. bool showFullAddress = true,
  32. List<String> addressComponents = const ['address', 'city', 'state', 'country'],
  33. String customAddressFormatter(
    1. LocationData
    )?,
  34. bool showCoordinates = false,
  35. bool showDistance = false,
  36. LocationData? distanceReference,
  37. DistanceUnit distanceUnit = DistanceUnit.kilometers,
  38. bool requestLocationPermission = true,
  39. String? locationPermissionMessage,
  40. LocationData? fallbackLocation,
  41. LocationAccuracy locationAccuracy = LocationAccuracy.high,
  42. Duration? locationTimeout,
  43. bool enableNearbyPlaces = false,
  44. double nearbyRadius = 1.0,
  45. List<String>? nearbyPlaceTypes,
  46. bool enableAutocomplete = true,
  47. bool enableReverseGeocoding = true,
  48. bool enableLocationHistory = false,
  49. int maxLocationHistory = 10,
  50. bool enableFavoriteLocations = false,
  51. List<LocationData>? favoriteLocations,
  52. ValueChanged<List<LocationData>>? onFavoriteLocationsChanged,
  53. bool enableOfflineSupport = false,
  54. Duration? cacheExpiration,
  55. bool preloadNearbyTiles = false,
  56. bool enableMultiSelection = false,
  57. List<LocationData>? selectedLocations,
  58. ValueChanged<List<LocationData>>? onMultiSelectionChanged,
  59. int? maxSelectedLocations,
  60. LocationBounds? allowedBounds,
  61. double? minAccuracy,
  62. List<String>? excludedPlaceTypes,
  63. bool requireAddress = false,
  64. VoidCallback? onLocationLoading,
  65. VoidCallback? onLocationLoadingComplete,
  66. dynamic onLocationError(
    1. String error
    )?,
  67. dynamic onLocationSelected(
    1. LocationData location
    )?,
  68. dynamic onLocationFavorited(
    1. LocationData location
    )?,
})

Implementation

const LocationField({
  Key? key,
  // Basic Configuration
  this.label,
  this.value,
  this.onChanged,
  this.validator,
  this.decoration,

  // Map Configuration
  this.mapProvider = MapProvider.openStreetMap,
  this.apiKey,
  this.initialZoom = 15.0,
  this.initialLocation,
  this.showCurrentLocationButton = true,
  this.enableLocationSearch = true,
  this.enableMapSelection = true,

  // Enhanced Search Configuration
  this.searchHintText,
  this.showSearchSuggestions = true,
  this.maxSearchSuggestions = 5,
  this.customSearchProvider,
  this.locationType = LocationType.all,
  this.restrictToCountries,
  this.searchRadius,
  this.searchRadiusUnit = DistanceUnit.kilometers,
  this.searchBias,

  // UI Configuration
  this.mapHeight = 200.0,
  this.mapBorderRadius,
  this.showFullScreenMapButton = true,
  this.mapLoadingWidget,
  this.locationIcon,
  this.markerColor,
  this.enableZoomControls = true,
  this.enableMapTypeSelector = false,

  // Address Display & Formatting
  this.showFullAddress = true,
  this.addressComponents = const ['address', 'city', 'state', 'country'],
  this.customAddressFormatter,
  this.showCoordinates = false,
  this.showDistance = false,
  this.distanceReference,
  this.distanceUnit = DistanceUnit.kilometers,

  // Permissions & Geolocation
  this.requestLocationPermission = true,
  this.locationPermissionMessage,
  this.fallbackLocation,
  this.locationAccuracy = LocationAccuracy.high,
  this.locationTimeout,

  // Advanced Features
  this.enableNearbyPlaces = false,
  this.nearbyRadius = 1.0,
  this.nearbyPlaceTypes,
  this.enableAutocomplete = true,
  this.enableReverseGeocoding = true,
  this.enableLocationHistory = false,
  this.maxLocationHistory = 10,
  this.enableFavoriteLocations = false,
  this.favoriteLocations,
  this.onFavoriteLocationsChanged,

  // Offline & Caching
  this.enableOfflineSupport = false,
  this.cacheExpiration,
  this.preloadNearbyTiles = false,

  // Multi-location Support
  this.enableMultiSelection = false,
  this.selectedLocations,
  this.onMultiSelectionChanged,
  this.maxSelectedLocations,

  // Validation & Constraints
  this.allowedBounds,
  this.minAccuracy,
  this.excludedPlaceTypes,
  this.requireAddress = false,

  // Events & Callbacks
  this.onLocationLoading,
  this.onLocationLoadingComplete,
  this.onLocationError,
  this.onLocationSelected,
  this.onLocationFavorited,
}) : super(key: key);