location_picker_plus 3.1.0
location_picker_plus: ^3.1.0 copied to clipboard
Advanced Flutter location picker with Google Places API, GPS detection, local database dropdowns, manual entry, smart field locking, and comprehensive theming. Perfect for address selection with multi [...]
3.1.0 2025-01-XX #
๐ New Features - GPS, Dropdowns & Individual Fields #
๐ GPS Location Detection (No Google API Required!)
- โจ Added
enableLocationPickerparameter toCustomStreetAddressField - ๐ One-click GPS location detection with automatic reverse geocoding
- ๐ฑ Uses device GPS +
geocodingpackage (works completely offline from Google Places API) - ๐ Automatic permission handling for Android & iOS
- โก Real-time address field population from GPS coordinates
- ๐ข Visual indicators (green badge) when address is from GPS
- ๐ Smart field locking when GPS data is used
๐๏ธ Local Database Dropdown Fields
- โจ NEW:
CountryDropdownField- Select from 250+ countries with flags ๐ฉ - โจ NEW:
StateDropdownField- Select states/provinces by country - โจ NEW:
CityDropdownField- Select cities by state - ๐ Searchable dropdowns with instant filtering
- ๐๏ธ Cascading selection (Country โ State โ City)
- ๐ Includes coordinates for cities
- โญ Shows capital cities
- ๐ฑ Works completely offline (bundled database)
- ๐ Optimized with search indices and caching
๐ Individual Text Field Widgets
- โจ NEW:
StreetAddressField- Street address with 2-line support - โจ NEW:
CityField- City text input - โจ NEW:
StateField- State/Province text input - โจ NEW:
CountryField- Country text input - โจ NEW:
PostalCodeField- Postal/ZIP code (numeric keyboard) - โจ NEW:
AddressTextField- Generic base widget for custom fields - ๐จ Consistent Material Design styling
- โ ๏ธ Built-in error display support
- ๐๏ธ Full TextEditingController integration
๐ฆ API Changes #
- Added
CountryModel,StateModel,CityModelexports - Added
LocationServiceexport for accessing local database - Added all dropdown and individual field widgets to public API
- Added
enableLocationPickerparameter toCustomStreetAddressField - Added
onLocationSelectedcallback for GPS detection events
๐จ UI Improvements #
- Enhanced field locking indicators with color coding:
- ๐ต Blue for Google Places data
- ๐ข Green for GPS data
- ๐ Orange for locked business addresses
- Improved visual feedback during GPS detection
- Better disabled state styling for all field types
๐ฑ Example App Enhancements #
- Added GPS Location Detection Demo - Shows GPS in action
- Added Dropdown Fields Demo - Shows local database dropdowns
- Added Individual Text Fields Demo - Shows modular field usage
- Main demo now has 3 comprehensive examples
๐ Bug Fixes #
- Fixed coordinate preservation in locked address mode
- Improved field state management when switching between input modes
- Fixed deprecated
withOpacitycalls (now usingwithValues) - Fixed icon references in example app
๐ Documentation #
- Comprehensive README updates with all new features
- Added GPS setup instructions for Android & iOS permissions
- Added dropdown widgets documentation with examples
- Added individual fields usage examples
- Updated API reference with new parameters and widgets
- Updated changelog section in README
๐ง Technical Improvements #
- Better state management for GPS operations
- Improved error handling for location permissions
- Optimized dropdown search with lazy loading
- Enhanced memory efficiency for large location lists
3.0.0 #
๐ Major Release - Enhanced Google Places Integration & Unified Experience #
New Major Features
- โ LocationPickerPlusUnifiedWidget: All-in-one widget combining Google Places, GPS, and manual entry
- โ Google Places API Integration: Full Google Places Autocomplete API support
- โ Tabbed Interface: Clean tab-based navigation between input modes
- โ Enhanced Theming System: Comprehensive theming with pre-built Material and Cupertino themes
- โ LocationPickerScreen: Full-screen location picker with navigation support
- โ Advanced Demo App: Complete example app with all features demonstrated
Google Places Integration
- ๐ Places Autocomplete: Real-time search using Google Places API
- ๐ Global Coverage: Search addresses worldwide with Google's database
- ๐ Accurate Geocoding: Precise coordinates from Google Places
- ๐ข Business & POI Support: Find restaurants, hotels, landmarks, and more
- ๐ Smart Field Locking: Google Places selections lock fields to maintain accuracy
- ๐ฑ Mobile Optimized: Touch-friendly interface for mobile devices
Enhanced User Experience
- ๐ฏ Multiple Input Methods: Switch seamlessly between search, GPS, and manual entry
- ๐ Source Tracking: Know whether address came from Google Places, GPS, or manual entry
- ๐จ Visual Indicators: Clear UI feedback for locked fields and address sources
- ๐ Country Restrictions: Limit search results to specific countries
- ๐ฑ Responsive Design: Works perfectly on phones, tablets, and desktop
- โก Performance Optimized: Efficient API calls and caching
Breaking Changes
- ๐ Widget Lifecycle Fixes: Fixed dispose() method issues causing Flutter assertions
- ๐จ Theme System Overhaul: Enhanced theming with more granular control
- ๐ฑ Layout Overflow Fixes: All demo screens now properly handle different screen sizes
- ๐ง Flutter Compatibility: Updated for latest Flutter versions with proper deprecation fixes
New Widgets & Components
// Unified widget with all features
LocationPickerPlusUnifiedWidget(
mode: LocationPickerMode.all, // or googlePlaces, currentLocation, manualEntry
googlePlacesApiKey: 'YOUR_API_KEY',
allowedCountries: ['India', 'United States'],
lockFieldsForGooglePlaces: true,
onLocationSelected: (result) {
print('Address: ${result?.address}');
print('Source: ${result?.addressSource}');
print('Coordinates: ${result?.latitude}, ${result?.longitude}');
},
)
// Full-screen picker
Navigator.push(context, MaterialPageRoute(
builder: (context) => LocationPickerScreen(
googlePlacesApiKey: 'YOUR_API_KEY',
mode: LocationPickerMode.all,
title: 'Select Location',
),
));
Enhanced Models
- ๐ LocationResult: Comprehensive result with address, coordinates, and source tracking
- ๐ท๏ธ AddressSource: Enhanced enum with better source identification
- ๐ LocationPickerMode: Flexible modes for different use cases
- ๐ฏ Enhanced Models: Better data structure for all location types
Technical Improvements
- ๐ง Widget Lifecycle: Fixed setState() after dispose() issues
- ๐ฑ Layout Fixes: Resolved RenderFlex overflow in all demo screens
- ๐จ Theme Consistency: Unified theming across all components
- โก Performance: Optimized API calls and state management
- ๐งน Code Quality: Improved error handling and null safety
- ๐ Documentation: Comprehensive examples and API documentation
Demo App Enhancements
- ๐ช Complete Demo Suite: Four distinct demos showcasing all features
- ๐ฑ Mobile-Friendly: All screens properly handle different screen sizes
- ๐จ Visual Examples: Beautiful UI demonstrating theming capabilities
- ๐ Usage Examples: Real-world implementation patterns
Migration Guide
- From 2.x: Most existing code continues to work
- Google Places: Add API key to enable Google Places features
- Theming: New theme system with more options
- Layouts: All layouts now properly scroll on smaller screens
API Requirements
- Google Places API Key: Required for Google Places features
- Billing Enabled: Google Cloud project with billing enabled
- Places API: Enable Places API in Google Cloud Console
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),
)