filePickerOptions static method
dynamic
filePickerOptions({
- required BuildContext context,
- required FileData fileData,
- required FileMode fileMode,
- required dynamic onSelected(
- FileData fileData
- dynamic onCancel()?,
- bool crop = false,
- int? maxFileSizeInMB,
- bool cropOnlySquare = false,
- String cropperToolbarTitle = Files.cropperToolbarTitle,
- Color cropperToolbarColor = Files.cropperToolbarColor,
- Color cropperToolbarWidgetsColor = Files.cropperToolbarWidgetsColor,
- List<
String> ? allowedExtensions,
function file picker options
Implementation
static filePickerOptions(
{required BuildContext context,
required FileData fileData,
required FileMode fileMode,
required Function(FileData fileData) onSelected,
Function(String message, int messageCode)? onCancel,
bool crop = false,
int? maxFileSizeInMB,
bool cropOnlySquare = false,
String cropperToolbarTitle = Files.cropperToolbarTitle,
Color cropperToolbarColor = Files.cropperToolbarColor,
Color cropperToolbarWidgetsColor = Files.cropperToolbarWidgetsColor,
List<String>? allowedExtensions}) async {
fileMode == FileMode.camera
? await Files.cameraPicker(
fileData: fileData,
crop: crop,
maxFileSizeInMb: maxFileSizeInMB,
cropOnlySquare: cropOnlySquare,
cropperToolbarTitle: cropperToolbarTitle,
cropperToolbarColor: cropperToolbarColor,
cropperToolbarWidgetsColor: cropperToolbarWidgetsColor,
onSelected: (fileData) {
onSelected(fileData);
},
onCancel: (message, messageCode) {
if (onCancel != null) {
onCancel(message, messageCode);
}
})
: fileMode == FileMode.gallery
? await Files.imagePicker(
fileData: fileData,
crop: crop,
maxFileSizeInMb: maxFileSizeInMB,
cropOnlySquare: cropOnlySquare,
cropperToolbarTitle: cropperToolbarTitle,
cropperToolbarColor: cropperToolbarColor,
cropperToolbarWidgetsColor: cropperToolbarWidgetsColor,
onSelected: (fileData) {
onSelected(fileData);
},
onCancel: (message, messageCode) {
if (onCancel != null) {
onCancel(message, messageCode);
}
})
: await Files.filePicker(
fileData: fileData,
maxFileSizeInMb: maxFileSizeInMB,
allowedExtensions: allowedExtensions,
onSelected: (fileData) {
onSelected(fileData);
},
onCancel: (message, messageCode) {
if (onCancel != null) {
onCancel(message, messageCode);
}
});
}