location_picker_plus 3.1.0 copy "location_picker_plus: ^3.1.0" to clipboard
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 enableLocationPicker parameter to CustomStreetAddressField
  • ๐ŸŒ One-click GPS location detection with automatic reverse geocoding
  • ๐Ÿ“ฑ Uses device GPS + geocoding package (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, CityModel exports
  • Added LocationService export for accessing local database
  • Added all dropdown and individual field widgets to public API
  • Added enableLocationPicker parameter to CustomStreetAddressField
  • Added onLocationSelected callback 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 withOpacity calls (now using withValues)
  • 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 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 to initialValue 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 services
  • geocoding: ^4.0.0 - Address geocoding services
  • permission_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 customization
  • AutocompleteDropdown: Real-time suggestions as you type
  • CustomDropdown: Traditional dropdown with search
  • LocationPickerTheme: Comprehensive theming system
  • LocationService: 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),
)
3
likes
120
points
197
downloads

Publisher

verified publisherbrewnbeer.com

Weekly Downloads

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 multiple input options.

Repository (GitHub)
View/report issues

Topics

#location #picker #geocoding #flutter #google-places

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

flutter, flutter_web_plugins, geocoding, geolocator, http, permission_handler, plugin_platform_interface, web

More

Packages that depend on location_picker_plus

Packages that implement location_picker_plus