owlnext_dropzone 2.0.4
owlnext_dropzone: ^2.0.4 copied to clipboard
Olwnext dropzone widget
2.0.4 #
- unified dropFile and pickFile handling.
It fixes drop target flow as maxAllowedWeight and forcedImageSize was not passed to dropFile using dropTarget method. Default params where used instead of top widget params declaration.
2.0.3 #
- added exceptions details and error details in [OwlnextDropzoneBuilderStateModel] for better external styling of dropzone
- exposed OwlnextDropzone Exceptions
2.0.2 #
- Fixed [getImageDimensions] method
2.0.1 #
- Forward MIME package
2.0.0 #
- added custom dropzoneBuilder & fileItemsBuilder on [OwlnextDropzone] for creating customizable dropzone while continue to use OwlnextDropzone logic model
- fixed onDropFile that was triggering an uncatched error when dropping wrong files types, or any custom exceptions on file drop
- mapped filePicker allowMultiple attribute onto fileUtils.isMultiUpload for better UX while file picking
- reworked demo page
1.5.0 #
- more precise and user friendly edit of BytesCalculation.formatBytesToString
- reworked [DocumentIconResolver] to be more resilient
- mapped override onto [OwlnextDropzone]
- added new utilities [FileExtensionStyling] & [FileExtensionStylingUtils]
- removed maxDropzoneWidth & isExpanded attributes from OwlnextDropzone (they were not used)
- corrected validation rule for disabled [OwlnextDropzone] which was trigger even if disabled
1.4.0 #
-
Reworked Dropzone contextual menu (removed nirrti fork) if clipboard is empty, user will not be able to paste
-
better handling of overlapping event on dropzone
NB: tried to implement pasteboard package for pasting file instead of injecting superclip_board from tha app using owlnext_dropzone, but encounterred problem with mime type when creating file
1.3.0 #
- More solid FileExtension method (now return String instead of nullable String, throw Exception if format not matched)
- Added U8intList extension [BytesToFormatExtension] to already
[BCBREAK] -> if you use FileExtension().getFileExtensionFromUint8List, you must remove () as fucntion changed to static
1.2.2 #
- hot fix on _getClipboardFilesFromInjectedDependency() of [OwlnextDropzone], removed !
1.2.1+1 #
- Added [mime] package depency
- Added the [FileExtension] class, which uses Mime type lookup for getting a [Uint8List] extension
1.2.0+1 #
- removed dependency to super_clipboard (caused ANDROID build issue, anyway super_clipboard has a lot of bad dependencies)
- to be able to use paste fonctionnality ATM, see README to inject super_clipboard from your app
1.1.4 #
- Fixed throw errors and finished AspectRatio errors implementation
1.1.3+1 #
- Exposed [BytesCalculation] class for calculate file weight
1.1.3 #
- Exposed [DocumentIconResolver] widget
1.1.2 #
- Exposed [PlatformFile] class
1.1.1 #
- Added image dimensions and ratio requirements for file validation
1.1.0 #
- Added [OwlnextFileSize] enum to declare fileSize (maxAllowedWeight: OwlnextFileSize.mo10.inBytes)
- Added unit test for format parsing and FileSize enum
- fixed
this.maxAllowedWeight = 10000000to10 * 1024 * 1024(corrected bytes value to fit to 10Mo)
1.0.2 #
- [OwlnextDropzone] KeyboardListener also request focus on hovering drop area to ensure a consistent Keyboard listening flow
1.0.1 #
- Fixed CTRL + V paste [BCBREAK] -> removed allowCtrlVPaste (replaced by original allowCopyPaste attribute)
0.1.4 #
- fixed duplicate file on paste (happened after deleting file from the list): it was caused by a pointer issue using removeWhere directly on a platform file causing inconsistant clear of the desired file to delete. so we moved to a deletion by index instead of memory hash comparaison
- [OwlnextDropzone] now uses fileUtils.fileList to display selected file instead of a local state mirroring it (that local fileList was named currentFileList)
0.1.3 #
- check file exceptions (allowedFormats, allowedSize) on copy/paste flow
- added allowCtrlVPaste attribute, default to false
- added FileTooLargeException
- added FileNotAllowedException
- added visual display of those exceptions
0.1.2 #
-
remapped default dotted border wrapper to Colors.grey instead of primary
-
removed currentFilesToUpload.clear() from dispose which was causing state issues on re-instantiating [OwlnextDropzone] after a fast unmounting
-
code cleaning (moved some public methods to private)
0.1.1 #
- better image extension parsing for document icon resolving now PNG and uppercase format are recognized
0.1.0 #
-
removed dependency to :
- universal_html
- url_launcher
- nirrti
- owlnext_utils
- dotted_border
-
fix paste on IOS, Windows
-
fix drag & drop on IOS, windows
⚠️⚠️⚠️ BC Break (web context only) onto FileUtils.downloadFile() ⚠️⚠️⚠️ #
if you want to use FileUtils.downloadFile() on web context, you will need to inject a specific behavior from your app. create a file in your app, loaded only in library.html context (web) and call
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:universal_html/html.dart';
import 'package:owlnext_dropzone/owlnext_dropzone.dart';
/// Utility to enable file downloads on Flutter Web when using `owlnext_dropzone`.
///
/// # Why
/// By default, `owlnext_dropzone` cannot handle web downloads without
/// depending on `universal_html`. This class injects a web-only implementation
/// so your app controls the download behavior.
///
/// # How
/// - Call [InitWebDownload.setup] in `main.dart`.
/// - On Web, it registers a custom download function that:
/// 1. Encodes file bytes to Base64
/// 2. Creates a temporary `<a>` element with a `data:` URI
/// 3. Triggers the browser’s native download
/// 4. Cleans up the element
///
/// # Example
/// ```dart
/// void main() {
/// InitWebDownload.setup();
/// runApp(MyApp());
/// }
/// ```
class InitWebDownload {
static void setup() {
if (kIsWeb) {
DownloadFileWebBypass().setDownloadFileWebFunction(_downloadFileWebImplementation);
}
}
Future<void> _downloadFileWebImplementation(Uint8List bytes, String fileName, String extension) async {
final base64 = base64Encode(bytes);
final anchor = AnchorElement(href: 'data:application/octet-stream;base64,$base64')
..target = 'blank'
..download = fileName;
document.body?.append(anchor);
anchor.click();
anchor.remove();
}
}
0.0.1 #
- Moving all file related widgets