thai_address_picker 1.0.2
thai_address_picker: ^1.0.2 copied to clipboard
High-performance Thai address picker with Province, District, Subdistrict, Zip Code. Features auto-completion and reverse lookup.
Changelog #
All notable changes to this project will be documented in this file.
1.0.2 - 2025-01-08 #
Added #
- โจ New Feature:
showZipCodeAutocompleteparameter inThaiAddressForm- Can now disable zip code autocomplete to show a simple TextField instead
- Default:
true(autocomplete enabled) - When
false: Shows basic TextField without suggestions
- ๐ New Examples:
disable_zipcode_autocomplete_example.dart- Basic example with disabled autocompletecompare_zipcode_modes_example.dart- Side-by-side comparison of both modes
- ๐
clearZipCode()method inThaiAddressNotifierfor better state management
Changed #
- ๐ Updated README.md with:
- Documentation for disabling zip code autocomplete
- Comparison table of features (Autocomplete vs Simple)
- Links to new example files
- Complete Example Files section
Why This Update? #
- Some users don't need autocomplete suggestions
- Simpler UI for cases where users already know their zip code
- Better performance for basic input scenarios
- More flexibility and customization options
1.0.1 - 2025-01-08 #
Added #
- ๐ Enhanced documentation with usage examples
- โ ๏ธ Helpful error messages and warnings for optional dependencies (GetX, Provider)
- ๐ก๏ธ Better error handling in example files
Fixed #
- ๐ Fixed example code that called non-existent
getZipCodesBySubDistrict()method- Changed to use
subDistrict.zipCodedirectly for accurate zip code retrieval - Applied fixes to:
repository_only_example.dart,standalone_usage_example.dart
- Changed to use
- ๐ง Resolved null type issues in cascading selection logic
- Fixed
firstWhere()callbacks to properly handle null returns - Applied to Province, District, and SubDistrict lookups
- Fixed
- ๐ Fixed dangling doc comments in example files
- โ All dart analyze issues resolved - zero issues found
Changed #
- ๐ฆ Updated example files to properly handle optional dependencies
- GetX and Provider examples now clearly indicate they require additional setup
- Added helpful error messages in main menu when dependencies are missing
- ๐งน Improved code organization in example implementations
Documentation #
- ๐ Updated README.md with version 1.0.1
- ๐ฏ Clarified optional dependency requirements for integration examples
1.0.0 - 2025-01-08 #
Added #
- ๐งช comprehensive tests for Thai address picker functionality
- Implement unit tests for ThaiAddressNotifier to validate state management and selection logic for provinces, districts, sub-districts, and zip codes.
- Create widget tests for ThaiAddressForm to ensure proper rendering, interaction, and state updates based on user input.
- Develop tests for various components including village and zip code autocomplete to verify suggestion handling and selection callbacks.
- Enhance coverage for picker dialogs and bottom sheets to confirm correct display and interaction behavior.
- Ensure all tests utilize a fake asset bundle for consistent and isolated testing environments.
Changed #
- ๐ฆ Bumped package version to 1.0.0
- ๐ Updated documentation to reflect new version and testing features
Fixed #
- ๐ Resolved minor bugs identified during testing phase
Performance #
- โก Optimized test execution time and reliability
Documentation #
- ๐ Added test documentation and usage examples
0.3.0 - 2025-01-08 #
Added #
- ๐๏ธ Village Autocomplete Widget - Real-time village (เธซเธกเธนเนเธเนเธฒเธ) search
- Substring matching for flexible Thai text search
- Shows full address hierarchy: Village โข เธซเธกเธนเนเธเธตเน โข SubDistrict โข District โข Province
- Displays Moo number (เธซเธกเธนเนเธเธตเน) for accurate identification
- Auto-fills all address fields when selected
- High-performance O(k) algorithm with early exit optimization
- Real-time updates from first character typed
- ๐
searchVillages()method in repository with smart filtering - ๐๏ธ
VillageSuggestionclass for village autocomplete data - ๐ New example:
village_autocomplete_example.dartwith full feature showcase - ๐ Village data integration (~70,000+ villages)
- ๐ Spec file:
assets/data/spec/village.jsonfor data structure
Changed #
- ๐ฆ Updated package description to include Village support
- ๐จ Enhanced repository to handle village search efficiently
- ๐ Improved data loading to include villages.json
Performance #
- โก O(k) complexity for village search with early exit (k = maxResults โค 20)
- ๐ Substring matching optimization for Thai text
- ๐พ Efficient HashMap-based filtering
- ๐ฏ No unnecessary state updates during search
Documentation #
- ๐ Updated README with Village Autocomplete usage
- ๐ Enhanced code comments for village-related features
- ๐ Added comprehensive example for village search
- ๐ Updated feature list and documentation
0.2.0 - 2025-01-07 #
Added #
- โจ Zip Code Autocomplete Widget - Real-time auto-suggestions while typing
- Prefix matching for accurate suggestions (เธฃเธซเธฑเธชเธเธตเนเนเธฃเธดเนเธกเธเนเธเธเนเธงเธข...)
- Shows full address hierarchy: ZipCode โ SubDistrict โ District โ Province
- Handles multiple areas with same zip code (e.g., 10200 has 3 areas)
- Auto-fills all fields when suggestion is selected
- High-performance O(k log k) algorithm with early exit optimization
- Real-time updates from first digit typed
- ๐
searchZipCodes()method in repository with smart filtering - ๐ฏ
selectZipCodeSuggestion()in provider for auto-fill cascade - ๐ New example:
zip_code_autocomplete_example.dartwith full feature showcase - ๐ Comprehensive documentation:
ZIP_CODE_AUTOCOMPLETE.md
Changed #
- ๐
ThaiAddressFormnow usesZipCodeAutocompleteinstead of plain TextField - โก Improved zip code input UX with real-time suggestions from first digit
- ๐จ Enhanced helper text: "เธฃเธฐเธเธเธเธฐเนเธเธฐเธเธณเธเธตเนเธญเธขเธนเนเธญเธฑเธเนเธเธกเธฑเธเธด"
- ๐ Optimized
setZipCode()to handle partial input (< 5 digits) without errors
Fixed #
- ๐ Fixed issue with multiple subdistricts having same zip code
- ๐ง Improved error state handling in zip code lookup
- โ Clear selections properly when zip code has multiple areas
- ๐ฏ Fixed autocomplete to show suggestions from first digit (not just 5 digits)
Performance #
- โก O(k) complexity for zip code search with early exit (k = maxResults โค 20)
- ๐ Prefix matching optimization for real-time responsiveness
- ๐พ Efficient HashMap-based unique filtering
- ๐ฏ No unnecessary state updates during partial input
Documentation #
- ๐ Updated README with Zip Code Autocomplete usage
- ๐ Added comprehensive technical documentation
- ๐ Enhanced code comments for better maintainability
- ๐ Added example showcasing all features
0.1.0 - 2025-10-15 #
0.0.1 - 2025-01-07 #
Added #
- ๐ Initial release of Thai Address Picker
- ๐ฆ Data models for Geography, Province, District, SubDistrict, and ThaiAddress using Freezed
- ๐๏ธ Repository pattern with isolate-based JSON parsing for high performance
- ๐พ In-memory caching with indexed lookups for O(1) search complexity
- ๐ Cascading selection logic (Province โ District โ SubDistrict โ Zip Code)
- ๐ Reverse lookup functionality (Zip Code โ Auto-fill address)
- ๐จ
ThaiAddressFormwidget - Complete inline form with 4 fields - ๐ฑ
ThaiAddressPicker.showBottomSheet()- Bottom sheet picker UI - ๐ฌ
ThaiAddressPicker.showDialog()- Dialog picker UI - ๐ Bilingual support (Thai and English)
- โก High-performance background JSON parsing using compute (Isolates)
- ๐ฏ State management using flutter_riverpod
- ๐ง Customizable styling and decoration for all form fields
- ๐ Latitude/longitude coordinates for sub-districts
- ๐ Search functionality for provinces, districts, and sub-districts
- ๐ Complete Thai address database with ~77 provinces, ~900+ districts, and 7,000+ sub-districts
Features #
- Clean Architecture with separation of concerns
- Singleton repository pattern for efficient data management
- Type-safe models with null safety
- Extensive documentation and examples
- Easy integration with existing Riverpod or non-Riverpod apps
- Handles edge cases (multiple sub-districts per zip code)
Developer Experience #
- Simple API with minimal boilerplate
- Comprehensive README with usage examples
- Example app demonstrating all features
- Clear error messages and state handling
- Flexible customization options