From 749824604db398fb52b857e778bf5b583fa6a139 Mon Sep 17 00:00:00 2001 From: Amr Elsaadny Date: Thu, 15 Aug 2024 14:03:57 +0300 Subject: [PATCH 1/2] Update form_builder_file_picker.dart --- lib/src/form_builder_file_picker.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/src/form_builder_file_picker.dart b/lib/src/form_builder_file_picker.dart index 6b4d1f1..edcb3b8 100644 --- a/lib/src/form_builder_file_picker.dart +++ b/lib/src/form_builder_file_picker.dart @@ -58,6 +58,8 @@ class FormBuilderFilePicker /// Whether to allow file compression final bool allowCompression; + final int? compressionQuality; + /// If [withData] is set, picked files will have its byte data immediately available on memory as [Uint8List] /// which can be useful if you are picking it for server upload or similar. final bool withData; @@ -101,6 +103,7 @@ class FormBuilderFilePicker this.allowedExtensions, this.onFileLoading, this.allowCompression = true, + this.compressionQuality, this.customFileViewerBuilder, this.customTypeViewerBuilder}) : super( @@ -180,6 +183,7 @@ class _FormBuilderFilePickerState extends FormBuilderFieldDecorationState< type: fileType, allowedExtensions: widget.allowedExtensions, allowCompression: widget.allowCompression, + compressionQuality: widget.compressionQuality ?? 30, onFileLoading: widget.onFileLoading, allowMultiple: widget.allowMultiple, withData: widget.withData, From 756efb6e868fb2c970a2745a66798fc3aff2dc40 Mon Sep 17 00:00:00 2001 From: Amr Elsaadny Date: Sun, 18 Aug 2024 07:23:07 +0000 Subject: [PATCH 2/2] reformat code --- lib/src/form_builder_file_picker.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/form_builder_file_picker.dart b/lib/src/form_builder_file_picker.dart index edcb3b8..ba338af 100644 --- a/lib/src/form_builder_file_picker.dart +++ b/lib/src/form_builder_file_picker.dart @@ -58,7 +58,7 @@ class FormBuilderFilePicker /// Whether to allow file compression final bool allowCompression; - final int? compressionQuality; + final int compressionQuality; /// If [withData] is set, picked files will have its byte data immediately available on memory as [Uint8List] /// which can be useful if you are picking it for server upload or similar. @@ -103,7 +103,7 @@ class FormBuilderFilePicker this.allowedExtensions, this.onFileLoading, this.allowCompression = true, - this.compressionQuality, + this.compressionQuality = 30, this.customFileViewerBuilder, this.customTypeViewerBuilder}) : super( @@ -183,7 +183,7 @@ class _FormBuilderFilePickerState extends FormBuilderFieldDecorationState< type: fileType, allowedExtensions: widget.allowedExtensions, allowCompression: widget.allowCompression, - compressionQuality: widget.compressionQuality ?? 30, + compressionQuality: widget.compressionQuality, onFileLoading: widget.onFileLoading, allowMultiple: widget.allowMultiple, withData: widget.withData,