Fix custom filter String creation
This commit is contained in:
parent
3d12c5ece8
commit
506cf55516
|
@ -1,3 +1,7 @@
|
||||||
|
## 1.0.2+1
|
||||||
|
|
||||||
|
Fix custom filter String creation.
|
||||||
|
|
||||||
## 1.0.2
|
## 1.0.2
|
||||||
|
|
||||||
Addresses an issue that would cause dot being required on filters for web (#343)
|
Addresses an issue that would cause dot being required on filters for web (#343)
|
||||||
|
|
|
@ -17,10 +17,8 @@ class FilePicker extends FilePickerPlatform {
|
||||||
/// [allowedExtensions] can be used (eg. `[.jpg, .pdf]`) to restrict picking types
|
/// [allowedExtensions] can be used (eg. `[.jpg, .pdf]`) to restrict picking types
|
||||||
///
|
///
|
||||||
/// Returns a `List<html.File>`
|
/// Returns a `List<html.File>`
|
||||||
static Future<List<html.File>> getMultiFile(
|
static Future<List<html.File>> getMultiFile({FileType type = FileType.any, List<String> allowedExtensions}) async {
|
||||||
{FileType type = FileType.any, List<String> allowedExtensions}) async {
|
return await _instance.getFiles(type: type, allowMultiple: true, allowedExtensions: allowedExtensions);
|
||||||
return await _instance.getFiles(
|
|
||||||
type: type, allowMultiple: true, allowedExtensions: allowedExtensions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Opens browser file picker window to select a single file.
|
/// Opens browser file picker window to select a single file.
|
||||||
|
@ -28,11 +26,8 @@ class FilePicker extends FilePickerPlatform {
|
||||||
/// [allowedExtensions] can be used (eg. `[.jpg, .pdf]`) to restrict picking types
|
/// [allowedExtensions] can be used (eg. `[.jpg, .pdf]`) to restrict picking types
|
||||||
///
|
///
|
||||||
/// Returns a `html.File`
|
/// Returns a `html.File`
|
||||||
static Future<html.File> getFile(
|
static Future<html.File> getFile({FileType type = FileType.any, List<String> allowedExtensions}) async {
|
||||||
{FileType type = FileType.any, List<String> allowedExtensions}) async {
|
return (await _instance.getFiles(type: type, allowedExtensions: allowedExtensions)).first;
|
||||||
return (await _instance.getFiles(
|
|
||||||
type: type, allowedExtensions: allowedExtensions))
|
|
||||||
.first;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -46,8 +41,7 @@ class FilePicker extends FilePickerPlatform {
|
||||||
html.InputElement uploadInput = html.FileUploadInputElement();
|
html.InputElement uploadInput = html.FileUploadInputElement();
|
||||||
uploadInput.multiple = allowMultiple;
|
uploadInput.multiple = allowMultiple;
|
||||||
uploadInput.accept = _fileType(type, allowedExtensions);
|
uploadInput.accept = _fileType(type, allowedExtensions);
|
||||||
uploadInput.onChange
|
uploadInput.onChange.listen((event) => pickedFiles.complete(uploadInput.files));
|
||||||
.listen((event) => pickedFiles.complete(uploadInput.files));
|
|
||||||
uploadInput.click();
|
uploadInput.click();
|
||||||
return await pickedFiles.future;
|
return await pickedFiles.future;
|
||||||
}
|
}
|
||||||
|
@ -70,8 +64,7 @@ class FilePicker extends FilePickerPlatform {
|
||||||
return 'video/*|image/*';
|
return 'video/*|image/*';
|
||||||
|
|
||||||
case FileType.custom:
|
case FileType.custom:
|
||||||
return allowedExtensions
|
return allowedExtensions.fold('', (prev, next) => '${prev.isEmpty ? '' : '$prev,'} .$next');
|
||||||
.reduce((value, element) => '.$value,.$element');
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
name: file_picker_web
|
name: file_picker_web
|
||||||
description: Web platform implementation of file_picker. Provides a way to pick files with filter support for Web.
|
description: Web platform implementation of file_picker. Provides a way to pick files with filter support for Web.
|
||||||
homepage: https://github.com/miguelpruivo/flutter_file_picker/tree/master/file_picker_web
|
homepage: https://github.com/miguelpruivo/flutter_file_picker/tree/master/file_picker_web
|
||||||
version: 1.0.2
|
version: 1.0.2+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: ">=2.7.0 <3.0.0"
|
||||||
|
|
Loading…
Reference in New Issue