location_picker_plus 2.1.0
location_picker_plus: ^2.1.0 copied to clipboard
A comprehensive Flutter plugin for location selection with dropdown/autocomplete modes AND live GPS location detection with geocoding support.
2.1.0 #
๐ Smart Field Management & Country Restrictions #
New Features
- โ Smart Field Locking: Automatically lock city/state/country fields when address is selected from Google Places dropdown
- โ Country Restrictions: Restrict countries in dropdown using country names or ISO codes
- โ Address Source Tracking: Track whether address came from Google Places, manual entry, or GPS
- โ Conditional Editing: Manual entries remain fully editable while Google Places selections are protected
- โ Visual Indicators: Clear UI feedback showing when fields are locked for accuracy
Enhanced Components
- ๐ LocationResult Model: Now includes
AddressSourceenum tracking address origin - ๐ ManualAddressEntryWidget: Smart field locking and country restriction support
- ๐ LocationPickerPlusUnifiedWidget: New parameters for country control and field locking
- ๐ AddressSource Enum:
googlePlaces,manualEntry,gpsLocationtracking
New Parameters
LocationPickerPlusUnifiedWidget(
allowedCountries: ['India', 'United States'], // or ['IN', 'US']
lockFieldsForGooglePlaces: true, // default: true
onLocationSelected: (location) {
print('Source: ${location?.addressSource}');
// AddressSource.googlePlaces, manualEntry, or gpsLocation
},
)
Smart Behavior
- Google Places Selection โ Fields automatically lock (city/state/country/postal code)
- Manual Entry โ All fields remain fully editable
- GPS Location โ All fields remain editable
- Country Filtering โ Only allowed countries appear in dropdown
- Visual Feedback โ Blue info box shows when fields are locked
Technical Improvements
- ๐ง Fixed all Flutter deprecation warnings (
withOpacityโwithValues) - ๐งน Removed unused methods and improved code quality
- ๐ Updated deprecated
valueparameter toinitialValuein form fields - ๐ฏ Enhanced type safety and null handling
Breaking Changes
- None - fully backward compatible
- All existing code continues to work unchanged
Migration Guide
- No migration needed for existing implementations
- New features are opt-in via new parameters
AddressSourcetracking is automatically handled
2.0.0 #
๐ Major New Features - Live Location Detection #
New Components
- โ LocationDetectorWidget: Live GPS location detection with geocoding
- โ LocationDetectorService: Comprehensive location services
- โ LocationModel: Enhanced location data with full address breakdown
- โ Flexible Detection Modes: GPS detection, address search, or both
Live Location Features
- ๐ GPS Location Detection: Get current location with one tap
- ๐ Address Geocoding: Search any address and get coordinates
- ๐ Reverse Geocoding: Convert coordinates to readable addresses
- ๐ Forward Geocoding: Convert addresses to coordinates
- ๐ Auto Permission Handling: Handles all location permissions automatically
- โก High Accuracy GPS: Configurable accuracy levels
- ๐ Multi-locale Support: Address detection in multiple languages
- ๐ฑ Cross-platform: Full Android and iOS support
New Dependencies
geolocator: ^14.0.2- GPS location servicesgeocoding: ^4.0.0- Address geocoding servicespermission_handler: ^12.0.1- Location permission management
Enhanced API
// Live location detection
LocationDetectorWidget(
mode: LocationDetectorMode.both,
showCoordinates: true,
onLocationChanged: (location) {
print('Lat: ${location?.latitude}, Lng: ${location?.longitude}');
print('Address: ${location?.fullAddress}');
},
)
// Service usage
LocationModel? location = await LocationDetectorService.instance
.getCurrentLocationWithAddress();
Breaking Changes
- Minimum Flutter version remains
>=3.3.0 - New permissions required for location features
- Added new dependencies (geolocator, geocoding, permission_handler)
Migration Guide
- Existing
LocationPickerWidgetusage unchanged - New
LocationDetectorWidgetis separate - no migration needed - Add location permissions to your app if using location detection
Platform Support
- Android: Requires location permissions in AndroidManifest.xml
- iOS: Requires NSLocationWhenInUseUsageDescription in Info.plist
- Web: Limited location support (browser-dependent)
- Desktop: Windows, macOS, Linux supported
1.0.1 #
Documentation Update #
- Updated repository URLs to point to new GitHub repository
- Fixed package name references in README documentation
1.0.0 #
Initial Release #
Features
- โ Two Input Modes: Dropdown with search OR Real-time autocomplete
- โ Instant Suggestions: See suggestions as you type (no Enter key needed)
- โ Debounced Performance: Optimized for smooth typing experience (50ms debounce)
- โ Smart Search: Built-in search with relevance sorting (exact matches first)
- โ Customizable Themes: Multiple pre-built themes and full customization support
- โ Flag Emojis & Phone Codes: Display country flags and phone codes
- โ Flexible Layouts: Horizontal/vertical layouts with responsive design
- โ Asset-based Data: Load location data from JSON assets
- โ Enhanced Models: Rich data models with additional properties (lat/lng, state codes, capitals)
- โ Animation Support: Smooth transitions and animations
- โ Accessibility: Screen reader support and keyboard navigation
Components Included
LocationPickerWidget: Main widget with full customizationAutocompleteDropdown: Real-time suggestions as you typeCustomDropdown: Traditional dropdown with searchLocationPickerTheme: Comprehensive theming systemLocationService: Efficient data loading and caching- Enhanced models:
CountryModel,StateModel,CityModel
Customization Options
- 25+ theme properties for complete UI control
- 3 pre-built themes: Default, Material, Cupertino
- Individual component control: Show/hide country, state, city
- Custom hints and labels for each field
- Flexible positioning and spacing options
- Custom asset paths for your own location data
Technical Features
- Efficient caching with singleton pattern
- Optimized filtering with smart relevance sorting
- Debounced input for better performance
- Overlay positioning with screen edge detection
- Memory efficient list handling
- Error handling with user-friendly messages
Assets Included
- Complete country list with flags and phone codes
- State/province data for major countries
- City data with geographic information
- JSON format for easy customization
Example Usage #
// Autocomplete mode
LocationPickerWidget(
useAutocomplete: true,
onCountryChanged: (country) => print(country?.name),
)
// Dropdown mode
LocationPickerWidget(
useAutocomplete: false,
theme: LocationPickerTheme.materialTheme(),
onCountryChanged: (country) => print(country?.name),
)