owlnext_dropzone 1.1.4
owlnext_dropzone: ^1.1.4 copied to clipboard
Olwnext dropzone widget
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 = 10000000
to10 * 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