media_pro 3.0.3
media_pro: ^3.0.3 copied to clipboard
Flutter media widgets — image, video, audio and file pickers, voice recorder, audio message tiles, and network video with pluggable adapters.
3.0.3 - 2026-09-30 #
Fixed #
- The
GridImagePickerimage-action dialog now closes only itself. It used to close whatever route was on top of the grid's navigator: dismissing the dialog while a delete or set-main request was running closed the grid's page once the request finished, and a route pushed over the dialog was closed in its place. Inside a nested navigator, such as a go_routerShellRoute, Back and finished requests closed the page under the dialog and left the dialog open.
3.0.2 - 2026-09-30 #
Fixed #
GridImagePickerno longer throws asetState() called after dispose()error when it's closed while an upload, delete or set-main request is still running. Upload progress and thedefaultImagesrefresh that follows each request are now skipped once the widget has been disposed.
3.0.1 - 2026-09-13 #
Changed #
- Declared SDK constraints raised to Dart
>=3.12.0 <4.0.0and Flutter>=3.44.0(were>=3.5.0/>=3.24.0) to match what the 3.0.0 dependencies already require. No change in compatibility.
3.0.0 - 2026-09-13 #
First stable 3.x release. It includes everything in 3.0.0-beta.1 — if you're upgrading from 2.x, read that entry's Breaking section and migration quick reference first. Changes since 3.0.0-beta.1:
Added #
GridImagePicker.emptyTileBuilder— replace the default empty-slot tile, including its background, corner radius and shadow. Slots stay tappable to open the picker;placeholderis ignored when it's set.GridImagePicker.tileBorderRadius— corner radius for the built-in tiles (uploaded images, empty slots, pending uploads and the upload skeleton). Defaults to 8; widgets returned by the tile builders don't use it.borderRadiusparameter onUploadImageTile,PendingUploadTileandLoadingPlaceholderTile(defaults to 8).
Changed #
- Dependency upgrades:
cached_network_image^4.0.0 (was ^3.4.1),file_picker^12.3.0 (stable; was ^12.0.0-beta.4),nylo_support^7.29.0,dio^5.11.1,image^4.9.2,image_picker^1.2.3,mime^2.1.0. These raise the effective minimum to Dart 3.12 / Flutter 3.44. SingleAudioPicker,SingleFilePickerandGridVideoPickeruse the stablefile_picker12.3 API (FilePicker.pickFile/FilePicker.pickFiles).- Errors from
VoiceRecordercleanup (stop, cancel, preview pause/dispose, discarding the preview file) and fromGridImagePicker/GridVideoPickeritem-ID resolution are no longer silently swallowed — they're logged in debug builds whenMediaPro.instance.init(debugMode: true)is set.VoiceRecorderupload failures are now logged as well as shown in a toast.
Fixed #
GridImagePickernow follows the ambient theme on dark UIs: empty tiles use a dark surface instead of hardcoded white, the upload tile's camera icon and labels switch to a light foreground, the default drag placeholder dims, and the image-action dialog divider uses the theme divider color.
3.0.0-beta.1 - 2026-05-27 #
Breaking #
MediaApiServiceconstructor no longer acceptsBuildContext— instantiate asMediaApiService()(Nylo v7 alignment).MediaApiService.interceptorsis now a getter (Map<Type, Interceptor> get interceptors); subclasses must override the getter, not assign a field.GridImagePicker.canDeleteImagechanged frombooltobool Function(dynamic item)?. UseGridImagePicker.alwaysAllowDeletefor the previoustruebehavior; omit the param for the previousfalsebehavior.- Picker upload field renamed to
apiUploadacross allSingle*PickerandGrid*Pickerwidgets (wasapiUploadImagein 2.x). Single*Pickerstyle strings replaced by sealed style classes —ImagePickerStyle,VideoPickerStyle,AudioPickerStyle,FilePickerStyle. Use the named constructors (.compact()/.simple()) on each picker;switchover the style is exhaustive.- Minimum Dart SDK bumped to
>=3.5.0; Flutter>=3.24.0. pretty_dio_loggerdirect dependency removed. Toggle network logging viaMediaPro.instance.init(debugMode: true).
Added #
New picker families
SingleVideoPicker— pick + upload one video..compact()/.simple()styles, optionalthumbnailGenerator,VideoPickerOptionsformaxDuration/quality.SingleAudioPicker— pick + upload one audio file viafile_picker.AudioPickerOptionswithallowedExtensions,maxDuration, pluggabledurationResolver.SingleFilePicker— pick + upload one arbitrary file.MediaProFileTypeenum (.any/.document/.custom).GridVideoPicker— multi-video grid with poster + play overlay, drag-reorder, set-main, delete.
Playback widgets
AudioMessageTile— play/pause/scrub a single audio source. SharedAudioMessageControllercoordinates one-playing-at-a-time across tiles; exposesplaySource,pauseSource,toggleSource,seek, and per-sourceisActive/isPlayingSourcehelpers.NetworkVideo—CachedNetworkImage-style video tile. Renders the poster up-front, defers player init until the user taps play.
Recording
VoiceRecorder— WhatsApp/Telegram-style hold-to-record (with slide-to-cancel) or tap-to-record modes. Live waveform + timer, optionalpreviewBeforeSendflow with play/scrub/discard.
Adapter pattern
AudioPlayerAdapter,VideoPlayerAdapter,AudioRecorderAdapter— plug injust_audio/audioplayers/record/video_player/media_kit/ etc. via a small factory function, without forking the package.
Upload & compression
UploadModeenum (standard,sequential,gzip) and newGridImagePicker.uploadModeparameter (defaults tostandard— opt into gzip explicitly).ImageCompressionOptionsdata class with smart-tier compression and three factory presets:.disabled(),.aggressive(),.preserveQuality().CompressionTiervalue type for custom quality tiers.MediaApiService.uploadImagesGzip()— gzip-compressed batch upload withContent-Encoding: gzipheader and progress callback.MediaApiService.uploadImagesSequential()— one-image-per-request alternative.MediaApiService.uploadImagesWithMode()— unified upload dispatcher.MediaApiService.compressImage()— smart quality tiers + downscale to a configurable max dimension.MediaApiService.compressWithGzip()— isolate-based gzip viacompute().MediaApiService.uploadVideo(),uploadAudio(),uploadFile()— companion upload methods for the new picker families.
API surface
ApiRequest.onErrorcallback — fires on 4xx/5xx for every network method.ApiRequestper-type field keys —videoKey,audioKey,fileKeyjoinimageKeyso each upload type has its own multipart form-field name.PickedFileInfovalue type — uniform representation of a picked file across pickers.
GridImagePicker
GridImagePicker.itemIdResolver— abstracts away theitem['id']assumption (with a fallback chain that handlesMapand any object exposing anidgetter).GridImagePicker.compressionOptions— opt-in compression with full configurability.GridImagePicker.onUploadImages— bypassMediaApiServiceentirely for custom upload flows.GridImagePicker.onDragCompletion— fires after a drag-reorder with the new ID list.GridImagePicker.onImageLongPress— replace the default action dialog with custom long-press behavior.GridImagePicker.displayValidationHint— toggle the bottom validation text.GridImagePicker.placeholder— widget shown in empty grid slots.GridImagePicker.deleteConfirmationTitle— customize the delete confirmation dialog title.GridImagePicker.newItemAnimationBuilder,loadingPlaceholderBuilder,pendingTileBuilder,dragPlaceholderBuilder,dragFeedbackBuilder— replace the default tile widgets and drag visuals with custom builders.
Public exports
- New public widgets:
AnimatedImageTile,LoadingPlaceholderTile,PendingUploadTile,UploadImageTile,ImageUploader,MediaLoader. MediaApiServiceis now exported from the package entry point.
Changed #
GridImagePickernow wires drag-to-reorder properly (was visual-only in 2.x). Items are draggable when there are items to reorder.MediaApiServiceupload methods now parseapiRequest.urlper-request (Uri.parse), so query parameters and paths in the URL are honored without leaking state across calls.handleFailure: apiRequest.onErroris now passed on everyMediaApiServicenetwork call (was only ondeleteImagepreviously).- Pulse/animation tiles (
AnimatedImageTile,LoadingPlaceholderTile,PendingUploadTile) are now public and customizable via constructor params. VoiceRecorderwaveform now scrolls right-to-left within a fixed slot — newest amplitudes stay visible, older ones clip off the left, no flex overflow when placed in aRow.
Removed #
pretty_dio_loggerdirect dependency.BuildContextparameter fromMediaApiServiceconstructor.
Migration quick reference #
| 2.x | 3.0 |
|---|---|
MediaApiService(buildContext: context) |
MediaApiService() |
canDeleteImage: true |
canDeleteImage: GridImagePicker.alwaysAllowDelete |
canDeleteImage: false |
omit the parameter |
| Implicit logging | MediaPro.instance.init(debugMode: true) |
Items must be Map with id |
Any shape; supply itemIdResolver for custom |
final interceptors = {...} |
Map<Type, Interceptor> get interceptors => {...} |
style: 'compact' |
SingleImagePicker.compact(...) (or matching sealed style) |
apiUploadImage: ApiRequest(...) |
apiUpload: ApiRequest(...) |
2.0.3 - 2024-12-31 #
- Update copyright year
- pubspec.yaml dependency updates
2.0.2 - 2024-12-16 #
- pubspec.yaml dependency updates
2.0.1 - 2024-12-06 #
- pubspec.yaml dependency updates
2.0.0 - 2024-11-25 #
- Refactor project for Nylo v6
- pubspec.yaml dependency updates
1.1.1 - 2024-06-15 #
- pubspec.yaml dependency updates
1.1.0 - 2024-06-10 #
- Update docs and readme
- pubspec.yaml dependency updates
1.0.20 - 2024-06-06 #
- pubspec.yaml dependency updates
1.0.19 - 2024-05-14 #
- pubspec.yaml dependency updates
1.0.18 - 2024-05-14 #
- pubspec.yaml dependency updates
1.0.17 - 2024-05-12 #
- pubspec.yaml dependency updates
1.0.16 - 2024-05-05 #
- pubspec.yaml dependency updates
1.0.15 - 2024-05-02 #
- pubspec.yaml dependency updates
1.0.14 - 2024-05-01 #
- pubspec.yaml dependency updates
1.0.13 - 2024-04-27 #
- pubspec.yaml dependency updates
1.0.12 - 2024-04-26 #
- pubspec.yaml dependency updates
1.0.11 - 2024-04-23 #
- pubspec.yaml dependency updates
1.0.10 - 2024-04-08 #
- pubspec.yaml dependency updates
1.0.9 - 2024-04-01 #
- pubspec.yaml dependency updates
1.0.8 - 2024-03-28 #
- pubspec.yaml dependency updates
1.0.7 - 2024-03-21 #
- pubspec.yaml dependency updates
1.0.6 - 2024-03-11 #
- pubspec.yaml dependency updates
1.0.5 - 2024-03-06 #
- pubspec.yaml dependency updates
1.0.4 - 2024-03-04 #
- Remove 'v' from version number
- pubspec.yaml dependency updates
1.0.3 - 2024-02-28 #
- Fix workflow
1.0.2 - 2024-02-28 #
- pubspec.yaml dependency updates
1.0.1 - 2024-02-27 #
- Fix
GridImagePicker
1.0.0 - 2024-02-27 #
- Initial release.