picker method
A widget that displays a file picker dialog for selecting a single file.
This widget displays a dialog that allows the user to pick a single file from their device's file system. The file picker dialog can be customized with various parameters, such as the allowed file types and the text styling of the dialog.
onPick
is a callback function that is invoked when the user selects a file.
The selected file is returned as a List<File?> object.
removeIcon
is an optional widget that is displayed next to each selected file,
allowing the user to remove the file from the list.
uploadIcon
is an optional widget that is displayed in the file picker dialog,
allowing the user to upload a file from their device.
fileType
is the type of file that the file picker dialog will display. This can
be set to FileType.image
, FileType.video
, FileType.audio
, or FileType.any
.
allowedExtensions
is a list of allowed file extensions for the file picker dialog.
Implementation
Widget picker({
Function(List<File?>)? onPick,
required Source source,
Widget? removeIcon,
Widget? uploadIcon,
Widget? title,
Widget? subtitle,
FileType fileType = FileType.any,
List<String>? allowedExtensions,
PickedItemDecoration? pickedItemDecoration,
}) {
return RhFilePicker.single(
onPick: onPick,
removeIcon: removeIcon,
pickedItemDecoration: pickedItemDecoration,
uploadIcon: uploadIcon,
fileType: fileType,
source: source,
title: title,
subtitle: subtitle,
allowedExtensions: allowedExtensions,
);
}