FilesystemPicker class
FileSystem file or folder picker dialog/bottom sheet.
Allows the user to browse the file system and pick a folder or file.
Be sure to specify either the rootDirectory
or a non-empty list of shortcuts
, but not both.
See also:
- FilesystemPicker.open, which allows you to open a fullscreen FileSystemPicker dialog.
- FilesystemPicker.openDialog, which allows you to open a modal FileSystemPicker dialog above the current contents of the app.
- FilesystemPicker.openBottomSheet, which allows you to open a modal FileSystemPicker bottom sheet above the current contents of the app.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- FilesystemPicker
Constructors
-
FilesystemPicker({Key? key, String? rootName, Directory? rootDirectory, Directory? directory, FilesystemType? fsType = FilesystemType.all, String? pickText, String? permissionText, String? title, Color? folderIconColor, List<
String> ? allowedExtensions, bool? caseSensitiveFileExtensionComparison, required ValueSelected onSelect, FileTileSelectMode? fileTileSelectMode, FilesystemListFilter? itemFilter, RequestPermission? requestPermission, FilesystemPickerThemeBase? theme, bool? showGoUp, ScrollController? scrollController, List<FilesystemPickerContextAction> contextActions = const [], List<FilesystemPickerShortcut> shortcuts = const [], Widget? closeButton, bool automaticallyImplyLeading = true}) - Creates a file system item selection widget.
Properties
-
allowedExtensions
→ List<
String> ? -
Specifies a list of file extensions that will be displayed for selection, if empty - files with any extension are displayed. Example:
['.jpg', '.jpeg']
final - automaticallyImplyLeading → bool
-
Controls whether we should try to imply the leading widget if closeButton is null.
final
- caseSensitiveFileExtensionComparison → bool?
-
Specifies the mode of comparing extensions with the
allowedExtensions
list, case-sensitive or case-insensitive; the default is false (case-insensitive).final - closeButton → Widget?
-
Picker close button.
final
-
contextActions
→ List<
FilesystemPickerContextAction> -
A list of actions, such as "Create Folder", which are placed in the upper right corner of the picker.
final
- directory → Directory?
-
Specifies the current directory of the filesystem view.
final
- fileTileSelectMode → FileTileSelectMode?
-
Specifies how to files can be selected (either tapping on the whole tile or only on trailing button). (default depends on fsType)
final
- folderIconColor → Color?
-
Specifies the color of the icon for the folder.
final
- fsType → FilesystemType?
-
Specifies the type of filesystem view (folder and files, folder only or files only), by default
FilesystemType.all
.final - hashCode → int
-
The hash code for this object.
no setterinherited
- itemFilter → FilesystemListFilter?
-
Specifies a callback to filter the displayed files in the filesystem view (not set by default); the path to the file/directory and its name are passed to the callback, the callback should return a boolean value - to display the file/directory or not.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onSelect → ValueSelected
-
Called when a file system item is selected.
final
- permissionText → String?
-
Specifies the text of the message that there is no permission to access the storage, by default: "Access to the storage was not granted.".
final
- pickText → String?
-
Specifies the text for the folder selection button (only for fsType = FilesystemType.folder).
final
- requestPermission → RequestPermission?
-
If specified will be called on initialization to request storage permission. callers can use e.g. permission_handler.
final
- rootDirectory → Directory?
-
Specifies the root of the filesystem view.
final
- rootName → String?
-
Specifies the name of the filesystem view root in breadcrumbs.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollController → ScrollController?
-
An object that can be used to control the position to which this scroll view is scrolled.
final
-
shortcuts
→ List<
FilesystemPickerShortcut> -
A list of shortcuts that allow you to specify multiple root drives (for example, in Windows) or favorite paths (as in Linux/MacOS).
final
- showGoUp → bool?
-
Specifies the option to display the go to the previous level of the file system in the filesystem view; the default is true.
final
- theme → FilesystemPickerThemeBase?
-
Specifies a picker theme in which colors, fonts, icons, etc. can be customized; if not specified, takes values from
FilesystemPickerDefaultOptions
, if it is defined higher in the widget tree.final - title → String?
-
Specifies the text of the dialog title.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → FilesystemPickerState -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of
DiagnosticsNode
objects describing this node's children.inherited -
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
open(
{required BuildContext context, Directory? rootDirectory, String? rootName, Directory? directory, FilesystemType? fsType, String? pickText, String? permissionText, String? title, Color? folderIconColor, bool? showGoUp, List< String> ? allowedExtensions, bool? caseSensitiveFileExtensionComparison, FileTileSelectMode? fileTileSelectMode, RequestPermission? requestPermission, FilesystemListFilter? itemFilter, FilesystemPickerThemeBase? theme, List<FilesystemPickerContextAction> contextActions = const [], List<FilesystemPickerShortcut> shortcuts = const []}) → Future<String?> - Open fullscreen FileSystemPicker dialog.
-
openBottomSheet(
{required BuildContext context, Directory? rootDirectory, String? rootName, Directory? directory, FilesystemType? fsType, String? pickText, String? permissionText, String? title, Color? folderIconColor, bool? showGoUp, List< String> ? allowedExtensions, bool? caseSensitiveFileExtensionComparison, FileTileSelectMode? fileTileSelectMode, RequestPermission? requestPermission, FilesystemListFilter? itemFilter, FilesystemPickerThemeBase? theme, List<FilesystemPickerContextAction> contextActions = const [], List<FilesystemPickerShortcut> shortcuts = const [], BoxConstraints? constraints, Color? barrierColor, ShapeBorder? shape, double? elevation, double? initialChildSize, double? minChildSize, double? maxChildSize}) → Future<String?> - Open a modal FileSystemPicker bottom sheet above the current contents of the app.
-
openDialog(
{required BuildContext context, Directory? rootDirectory, String? rootName, Directory? directory, FilesystemType? fsType, String? pickText, String? permissionText, String? title, Color? folderIconColor, bool? showGoUp, List< String> ? allowedExtensions, bool? caseSensitiveFileExtensionComparison, FileTileSelectMode? fileTileSelectMode, RequestPermission? requestPermission, FilesystemListFilter? itemFilter, FilesystemPickerThemeBase? theme, List<FilesystemPickerContextAction> contextActions = const [], List<FilesystemPickerShortcut> shortcuts = const [], BoxConstraints? constraints}) → Future<String?> - Open a modal FileSystemPicker dialog above the current contents of the app.