hq_picker 0.0.7
hq_picker: ^0.0.7 copied to clipboard
A stateful widget that allows users to pick media files (images, videos, audio, files) from their device.
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.