LocationField constructor
const
LocationField({
- Key? key,
- String? label,
- LocationData? value,
- ValueChanged<
LocationData?> ? onChanged, - FormFieldValidator<
LocationData> ? validator, - InputDecoration? decoration,
- MapProvider mapProvider = MapProvider.openStreetMap,
- String? apiKey,
- double? initialZoom = 15.0,
- LocationData? initialLocation,
- bool showCurrentLocationButton = true,
- bool enableLocationSearch = true,
- bool enableMapSelection = true,
- String? searchHintText,
- bool showSearchSuggestions = true,
- int maxSearchSuggestions = 5,
- Future<
List< customSearchProvider(LocationData> >- String query
- LocationType locationType = LocationType.all,
- List<
String> ? restrictToCountries, - double? searchRadius,
- DistanceUnit searchRadiusUnit = DistanceUnit.kilometers,
- LocationData? searchBias,
- double mapHeight = 200.0,
- BorderRadius? mapBorderRadius,
- bool showFullScreenMapButton = true,
- Widget? mapLoadingWidget,
- Widget? locationIcon,
- Color? markerColor,
- bool enableZoomControls = true,
- bool enableMapTypeSelector = false,
- bool showFullAddress = true,
- List<
String> addressComponents = const ['address', 'city', 'state', 'country'], - String customAddressFormatter()?,
- bool showCoordinates = false,
- bool showDistance = false,
- LocationData? distanceReference,
- DistanceUnit distanceUnit = DistanceUnit.kilometers,
- bool requestLocationPermission = true,
- String? locationPermissionMessage,
- LocationData? fallbackLocation,
- LocationAccuracy locationAccuracy = LocationAccuracy.high,
- Duration? locationTimeout,
- bool enableNearbyPlaces = false,
- double nearbyRadius = 1.0,
- List<
String> ? nearbyPlaceTypes, - bool enableAutocomplete = true,
- bool enableReverseGeocoding = true,
- bool enableLocationHistory = false,
- int maxLocationHistory = 10,
- bool enableFavoriteLocations = false,
- List<
LocationData> ? favoriteLocations, - ValueChanged<
List< ? onFavoriteLocationsChanged,LocationData> > - bool enableOfflineSupport = false,
- Duration? cacheExpiration,
- bool preloadNearbyTiles = false,
- bool enableMultiSelection = false,
- List<
LocationData> ? selectedLocations, - ValueChanged<
List< ? onMultiSelectionChanged,LocationData> > - int? maxSelectedLocations,
- LocationBounds? allowedBounds,
- double? minAccuracy,
- List<
String> ? excludedPlaceTypes, - bool requireAddress = false,
- VoidCallback? onLocationLoading,
- VoidCallback? onLocationLoadingComplete,
- dynamic onLocationError(
- String error
- dynamic onLocationSelected(
- LocationData location
- dynamic onLocationFavorited(
- 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);