hq_picker 1.1.1
hq_picker: ^1.1.1 copied to clipboard
A stateful widget that allows users to pick media files (images, videos, audio, files) from their device.
1.1.1 #
Storage & Memory Optimization #
- Automatic Temp File Cache Purging: Added
PhotoManager.clearFileCache()insideHQPickerProcessor.processAssets()to automatically wipe obsolete temporary media file copies before processing new selections. Prevents temporary video files (500MB+) from accumulating indefinitely in app cache storage. - Explicit Cache Purge API: Added
HQPicker.clearCache()static API method allowing applications to manually purge picker media file caches on-demand (e.g. when clearing file selections).
1.1.0 #
Universal Native iOS Design & Aesthetic #
- Universal Native iOS Aesthetic: Standardized Apple Human Interface Guidelines (HIG) design,
CupertinoIcons,CupertinoAlertDialog,BouncingScrollPhysics, and translucent frosted glass blur (BackdropFilter) across both iOS and Android. - Cupertino Iconography: Standardized default
HQPickerIconsto useCupertinoIcons(camera_fill,videocam_fill,arrow_up_circle_fill,checkmark_alt,play_fill,doc_fill,chevron_down,xmark_circle_fill,chevron_back) across all platforms. - iOS Cupertino Dialogs: Permission alerts, error popups, and media detail dialogs now utilize
CupertinoAlertDialogandCupertinoDialogActionnatively.
Ultra-Fast Performance & 0ms Instant Response #
- 0ms Instant Selection Response: Isolated tile rebuilds via
BlocSelectorso tapping an item updates only that specific tile instantly (0ms), skipping re-evaluations across all other visible tiles. - CustomScrollView & SliverGrid Viewport: Upgraded media asset grid from
GridView.buildertoCustomScrollView+SliverGridwithSliverChildBuilderDelegatefor silky-smooth 120fps scrolling. - Instant Album & Asset Loading: Optimized BLoC initialization to emit primary album assets immediately (~60ms) while fetching album cover thumbnails and counts asynchronously in the background.
Customization & Localization Features #
- BoxFit Customization: Added
previewFitandgridItemFitparameters toHQPickerConfigto control image fitting for top preview and grid tiles. - Interactive Aspect-Ratio Fit Toggle: Added an interactive aspect ratio fit button to the preview panel allowing end-users to toggle between
BoxFit.coverandBoxFit.contain. - Custom Loading Widget Override: Made all progress indicators seamlessly fallback to custom user-supplied
loadingWidgetacross all components. - Localization Enhancements: All UI strings are retrieved from
HQPickerLocalizations(includingHQPickerLocalizations.ar()Arabic preset).
1.0.1 #
Performance & Improvements #
- Optimized File Icon Lookups: Moved file icon and color lookup maps in
getIconForFile()to module-levelconstmaps, preventing them from being recreated for every file item. - Immutable Extension Lists: Converted Telegram picker extension lists to
constcollections to prevent accidental mutation and reduce unnecessary allocations. - Optimized Selected Asset Lookups: Added cached
selectedAssetIdsSetandselectedAssetIndexByIdto provide O(1) selection and index lookups instead of repeatedly rebuilding sets or callingindexOf(). - Parallel Album Loading: Updated album loading in
HQPickerBlocto load albums concurrently usingFuture.wait()instead of sequential processing. - Shared Asset Visual Helpers: Added
hq_picker_asset_visuals.dartto centralize GIF detection, duration formatting, and selection badge alignment logic shared across asset tiles. - Reduced Instagram Picker Rebuilds: Added
buildWhenfiltering to prevent unnecessary rebuilds caused by unrelated picker state changes. - Stable Grid Item Keys: Added stable keys to Instagram picker grid items for more predictable widget reuse during rebuilds and scrolling.
- Selection Badge Animation Fix: Fixed the
AnimatedScaleselection badge so its animation state actually changes instead of receiving the same value in both states. - Telegram ScrollController Cleanup: Fixed
ScrollControllerlifecycle handling in the Telegram album selector to prevent resource leaks. - Removed Picker File Cache Cleanup: Removed
PhotoManager.clearFileCache()calls from picker disposal to avoid unnecessary file-cache clearing during picker lifecycle.
Fixes #
- File Extension Fix: Corrected the
wbsextension to.wbsin the Telegram file extension list. - Removed Unnecessary Async: Removed the unnecessary
asyncmodifier fromgetPublicDirectories(). - Added
HQPickerConfig.copyWith(): AddedcopyWith()toHQPickerConfigfor consistent and easier configuration updates without recreating the entire configuration object.
1.0.0 #
Added & Redesigned #
- Redesigned Media Preview Dialog (
HQMediaPreviewDialog): Overhauled full-screen image and video preview on long press with a modern glassmorphic top header, asset details chips (media type, resolution, duration), pinch-to-zoom interactive viewer, double-tap zoom gestures, and video indicator badge. - Custom Preview Dialog Builder (
previewDialogBuilder): AddedHQAssetPreviewBuildersignature andpreviewDialogBuilderparameter toHQPickerConfigallowing complete customization of media asset preview dialogs. - Custom Confirm Button Builder (
confirmButtonBuilder): AddedHQConfirmButtonBuildersignature andconfirmButtonBuilderparameter toHQPickerConfigfor full control over confirm/send button widgets. - Custom Instagram AppBar Builder (
appBarBuilder): AddedHQAppBarBuildersignature andappBarBuilderparameter toHQPickerConfigfor customizing the AppBar in Instagram shape. - Interactive Instagram Album Dropdown Title: Updated Instagram shape AppBar title to display an interactive album selector dropdown menu button.
- Example App Updates: Updated example application to demonstrate custom preview, confirm button, and Instagram AppBar builders.
0.0.11 #
Added & Customizable #
- Grid Layout Customization: Added
gridCrossAxisCount,gridCrossAxisSpacing,gridMainAxisSpacing,gridChildAspectRatio, andgridItemBorderRadius. - Selection Badge Visuals & Position: Added
selectionStyle(number,checkMark,borderOnly),badgePosition(topRight,topLeft,bottomRight,bottomLeft), andenableSelectionAnimation. - Video & File Constraints: Added
minVideoDuration,maxVideoDuration, andminFileSizevalidation checks with automatic error notification. - Full-Screen Preview & Video Behavior: Added
enableFullScreenPreviewmodal dialog on long press,autoPlayVideoPreview, andmuteVideoPreview. - In-App Camera Settings: Added
preferredCameraLens(back/front),cameraCaptureMode(all/photoOnly/videoOnly), andcameraOverlayBuilder. - File & Document Views: Added
fileViewMode(listvsgrid),enableDocumentPreview, andcustomFileTypeIconsmap. - Gestures & Actions: Added
doubleTapActionandlongPressAction(none,select,preview,showInfo) with built-in asset information modal dialog. - Custom Send Bar & FAB Animation: Added
bottomSendBarBuilderandsendButtonAnimationtoggle for send action floating action button. - Custom Permission Dialog: Added
permissionDialogBuilderto override default system permission dialogs. - Album Filtering & Headers: Added
albumFilterpredicate, customheaderBuilder, and callbacks (onMaxCountReached,onAssetTap,onAlbumChanged). - Interactive Customization Showcase: Added interactive settings sheet in example app and showcase web page.
0.0.10 #
Removed & Fixed #
- Removed Image Cropping Dependency: Completely removed
image_cropperpackage andenableCroppingconfiguration to eliminate native cropping activity bloat and boost overall picking performance. - Fixed Parent Route Exit Bug: Fixed
showDialogdismiss logic inHQPickerProcessor.processAssetsby passing explicitdialogContext, preventing unintended popping of parent screen navigation routes. - Main Thread Asset Resolution: Streamlined
AssetEntityfile resolution on main thread to avoid raw isolate platform channel exceptions.
0.0.9 #
Added & Improved #
- iOS Platform Support & Permissions: Added explicit platform declarations (
androidandios) topubspec.yaml. - iOS Photo Library Save Permission: Added
NSPhotoLibraryAddUsageDescriptionto exampleInfo.plistto prevent app crash when saving captured camera photos on iOS. - iOS Permission Optimization: Optimized
HQPickerMediaServices.requestPermissionsto directly check and requestPermission.photoson iOS. - iOS Setup Documentation: Added comprehensive iOS configuration guide to
README.mddetailing requiredInfo.plistkeys (NSPhotoLibraryUsageDescription,NSPhotoLibraryAddUsageDescription,NSCameraUsageDescription,NSMicrophoneUsageDescription) and Podfile deployment target instructions.
0.0.8 #
Changed & Improved #
- Showcase & Visual Assets: Updated showcase page, README preview screenshots, and demo video assets.
- Monochrome Dark Theme: Aligned default example and showcase color scheme to Material 3 Monochrome Dark.
- Instagram Picker Toolbar Layout: Positioned album selector dropdown alongside camera action controls on the toolbar row below the preview image.
- Telegram Sheet Refinements: Refined DraggableScrollableSheet snap points, media-only grid mode, and folder navigation popup overlay.
0.0.7 #
Fixed #
- Large File OOM Crash Prevention: Updated
HQPickerProcessor._resolveAssetFileto prioritizeasset.originFilebefore fallback toasset.file. This resolves original file paths directly on disk without duplicating large media files (500MB - 1GB+) into cache memory, eliminating Out-Of-Memory (OOM) process crashes. - Exception Guards: Added safe
try/catchexception wrappers aroundopenFileandgetDirectoryPathinHQPickerProcessor.pickDocumentandpickDirectory.
0.0.6 #
Fixed & Improved #
- Offloaded media asset file resolution (
AssetEntity.file) to background isolates usingIsolateServices.runinHQPickerProcessor. This eliminates UI thread freezing when picking large video files (up to 1GB+) or high-resolution images. - Added
getFile()asynchronous helper method toHQPickerResultto safely resolve files in a background isolate without blocking the UI main thread. - Offloaded image compression (
FlutterImageCompress) inHQPickerMediaEditorto background isolates. - Offloaded recursive file system scanning in
HQPickerMediaServices.fetchFilesByExtensionsto background isolates. - Ultra-Smooth 60/120fps Grid Scrolling: Added
buildWhenstate filtering to prevent fullGridViewrebuilds on scroll drag events, and configuredscrollCacheExtent: const ScrollCacheExtent.pixels(1500.0)for stutter-free thumbnail rendering. - Telegram Bottom Sheet Drag-to-Close: Configured
DraggableScrollableSheetwithminChildSize: 0.0,shouldCloseOnMinExtent: true,snap: true,snapSizes: [0.55, 1.0], andDraggableScrollableNotificationlistener for fluid swipe-down dismissal. - Telegram Sheet Header Layout: Fixed top row asset overlap under the album selector app bar by adding dynamic top padding reacting to scroll position.
- Instant Selection Response (0ms delay): Single state emission per tap combined with O(1) set lookup (
selectedAssetIdsSet.contains(id)). - System Back Gesture Support: Wrapped Telegram sheet overlay in
PopScope(canPop: false)so pressing system back closes the bottom sheet first. - Tactile Haptic Feedback: Integrated
HapticFeedback.selectionClick(),lightImpact(), andvibrate()for media selection, album toggles, and max-count limits. - Interactive Zoom Preview: Wrapped large top preview image in Instagram picker in
InteractiveViewerfor 1.0x to 4.0x pinch-to-zoom inspection. - Auto Memory Cleanup: Added
PhotoManager.clearFileCache()call on picker disposal to automatically delete temporary thumbnail files. - Custom Empty Widget: Added
emptyWidgetfield toHQPickerConfigfor custom empty state placeholders. - GIF Asset Badges: Display "GIF" label badges on animated GIF media items in grid cells.
- Customizable Scroll Physics: Added
scrollPhysicsfield toHQPickerConfigallowing custom grid scroll physics (BouncingScrollPhysics,ClampingScrollPhysics, etc.). - Selected Items Counter: Floating send button in Telegram sheet dynamically displays selected item count.
- Maximum File Size Limit: Added
maxFileSizeproperty toHQPickerConfigto set file size limits with automatic haptic warning feedback. - Gallery Asset Sort Order: Added
sortOrder(HQPickerSortOrder.newestFirstoroldestFirst) toHQPickerConfig. - Custom Grid Item Tile Builder: Added
assetItemBuildercallback (HQAssetItemBuilder) toHQPickerConfigto fully customize asset cell overlays.
0.0.5 #
Fixed #
- Telegram-style picker (
HQPicker.telegram): selected media no longer gets cleared when switching albums. Users can now select items across multiple albums and have them all included when confirming, matching Telegram's native picker behavior.
0.0.4 #
✨ New Features #
Full Text-Style Theming via HQPickerTheme
- Every
Textwidget in the picker now reads its style fromHQPickerTheme— no more hardcoded inlineTextStyle. - New named style properties:
albumNameTextStyle,albumCountTextStyle,confirmButtonTextStyle,badgeTextStyle,videoDurationTextStyle,emptyListTextStyle,dialogTitleTextStyle,dialogContentTextStyle,dialogCancelTextStyle,dialogConfirmTextStyle,snackBarTextStyle. - Each property has a
resolved*getter that falls back to a sensible colour-based default if not provided.
Localization — permissionRequired string
- Added
permissionRequiredfield toHQPickerLocalizations(default:'Permission Required', Arabic:'مطلوب إذن'). - The permission dialog title now reads from
config.localizations.permissionRequiredinstead of a hardcoded string.
Custom Loading Widget
- Added
loadingWidgettoHQPickerConfig— shown as an overlay while assets are being processed (cropped / compressed). - Defaults to
Center(child: CircularProgressIndicator()).
Conditional Camera Buttons in Instagram Picker
- The Instagram picker toolbar now shows camera buttons only for the active
requestType:image→ photo camera button only.video→ video camera button only.all→ both buttons.
- Added
cameraVideoicon toHQPickerIcons(default:Icons.videocam) for the video camera button. - Multi-select toggle icon changed from
add_a_photo(looked like a camera) tocheck_box/check_box_outline_blank.
🏗️ Architecture #
File Split — hq_picker.dart is now a clean facade
- Extracted
HQInstagramPickerwidget +_HQInstagramPickerState→src/instagram/hq_instagram_picker.dart. - Extracted grid-cell widget →
src/instagram/hq_instagram_asset_item.dart(HQAssetItem). - Extracted
processAssets,pickDocument,pickDirectory→src/core/hq_picker_processor.dart(HQPickerProcessor). hq_picker.dartis now a pure static-API facade (~220 lines) — no widget code, no inline logic.- Removed
src/file_picker_service.dart— logic inlined intoHQPickerProcessor.
🔧 Fixes & Improvements #
HQPicker.titleis nowWidget?(nullable); whennull, defaults toconfig.localizations.gallerystyled withresolvedAlbumNameTextStyle.- Album selector bottom-sheet background uses
config.theme.backgroundDropDownColorinstead of a hardcoded colour.
0.0.3 #
🔧 Android Build Compatibility #
- Gradle wrapper upgraded from
8.12→8.14.1(satisfies Flutter's upcoming minimum requirement). - Android Gradle Plugin (AGP) upgraded from
8.7.3→8.11.1— resolvescheckDebugAarMetadatabuild failures caused byandroidx.activity,androidx.core, andandroidx.navigationeventdependencies requiring AGP ≥ 8.9.1. - Kotlin Gradle Plugin (KGP) upgraded from
2.1.0→2.2.20. - JVM target mismatch fix: Added a targeted
subprojectsblock in rootbuild.gradle.ktsthat enforces consistent Java/Kotlin JVM target (17) forphoto_manager, resolvingInconsistent JVM Target Compatibilitybuild errors. - App JVM target updated from
VERSION_11→VERSION_17inapp/build.gradle.kts. UCropActivitydeclaration added toAndroidManifest.xml— fixes crash when usingimage_cropper(ActivityNotFoundException: UCropActivity).android:enableOnBackInvokedCallback="true"added toAndroidManifest.xml— suppresses predictive back gesture warning.
🗂️ Example App Overhaul #
- Replaced the single-screen example with a comprehensive 3-tab showcase:
- Tab 1 — Shapes: Cards for all 8
HQPickerShapevariants (instagram,custom,bottomSheet,scaffoldBottomSheet,bottomSheetImageSelector,telegram,document,directory). - Tab 2 — Types: Cards demonstrating
pickImage,pickVideo,pickDocument,pickDirectory, andpickwith allHQPickerRequestTypevalues and config combinations (crop, compress). - Tab 3 — Telegram Inline: Inline
HQPickerTelegramMediaPickerswidget with toggle button, displaying picked assets and files.
- Tab 1 — Shapes: Cards for all 8
- Results panel shown inline under the grid with thumbnail previews and type icons.
0.0.2 #
- Unified
HQPickerShapeAPI: AddedHQPickerShapeenum unifying all 8 picker UI shapes (instagram,custom,bottomSheet,scaffoldBottomSheet,bottomSheetImageSelector,telegram,document,directory). - Shape-Centric Launchers: Added
HQPicker.pick(...),HQPickerFilePicker.pick(...),pickImage,pickVideo,pickDocument, andpickDirectorystatic methods acrossHQPickerandHQPickerFilePicker. - Telegram Modal Launcher: Added static
HQPicker.telegram(...)modal presenter returningFuture<List<HQPickerResult>>. - Flexible Results: Updated
HQPickerResultto support raw files without requiring anAssetEntity.
0.0.1 #
- Initial Release of
hq_pickerpackage! - BLoC Architecture: Entire package built with
flutter_blocandequatableensuring high performance, 60fps scrolling, and zerosetStatesluggishness. - Pagination (Lazy-Loading): Seamlessly loads large galleries (images/videos) in batches to prevent memory leaks and freezing.
- Telegram-Style Picker: Draggable bottom sheet with tabs for Gallery, Audio, and Files with smooth UI transitions.
- Instagram-Style Picker: Full-page preview with grid selection and a built-in camera functionality.
- Custom Pickers:
HQPickerCustomPicker,HQPickerBottomSheets, andHQPickerScaffoldBottomSheetfor varied project requirements. - File System Access: Natively fetches and filters Audio (
.mp3,.wav, etc.) and general Device Files natively for both Android and iOS. - Cropping & Compression: Built-in support for editing images with adjustable quality settings.
- Localization: Full support for Multiple Languages (English, Arabic, etc.) via Dependency Injection.