location_picker_plus 3.0.0
location_picker_plus: ^3.0.0 copied to clipboard
Advanced Flutter location picker with Google Places API, GPS detection, manual entry, smart field locking, and comprehensive theming. Perfect for address selection with fallback options.
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
AddressSource
enum tracking address origin - π ManualAddressEntryWidget: Smart field locking and country restriction support
- π LocationPickerPlusUnifiedWidget: New parameters for country control and field locking
- π AddressSource Enum:
googlePlaces
,manualEntry
,gpsLocation
tracking
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
value
parameter toinitialValue
in 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
AddressSource
tracking 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
LocationPickerWidget
usage unchanged - New
LocationDetectorWidget
is 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),
)