MellongLau / folder_picker

A directory picker for Flutter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Folder picker

pub package

A directory picker for Flutter

Screenshot

Usage

A picker page is available as well as a standalone widget.

import 'package:folder_picker/folder_picker.dart';

Navigator.of(context).push<FolderPickerPage>(
   MaterialPageRoute(
      builder: (BuildContext context) {
         return FolderPickerPage(
            rootDirectory: externalDirectory, /// a [Directory] object
            action: (BuildContext context, Directory folder) async {
              print("Picked folder $folder");
            });
}));

To allow directory creation:

final controller = FilexController(path: externalDirectory.path);
FolderPicker(
   rootDirectory: externalDirectory,
   controller: controller
   // ...
)

And then use the controller when you want to create a directory:

controller.createDirectory(name); // name is a String

To get just the widget and not a full page use FolderPicker

Parameters

  • rootDirectory Directory required: the top level directory to start from
  • action AfterPickedAction required: the action to perform after picking
  • compact: bool default false: use compact display
  • pickerIcon: Icon: the icon to use for the picker
  • controller: FilexController the file explorer controller used to create directories

Permissions

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

About

A directory picker for Flutter

License:MIT License


Languages

Language:Dart 73.0%Language:HTML 9.3%Language:Objective-C 7.1%Language:Kotlin 3.7%Language:Swift 3.6%Language:Java 3.3%