easy_folder_picker 0.0.2 copy "easy_folder_picker: ^0.0.2" to clipboard
easy_folder_picker: ^0.0.2 copied to clipboard

outdated

Easy directory picker for Flutter

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:easy_folder_picker/FolderPicker.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: HomePage(),
    );
  }
}
class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  Directory selectedDirectory;

  Future<void> _pickDirectory(BuildContext context) async {
    Directory directory = selectedDirectory;
    if (directory == null) {
      directory = Directory(FolderPicker.ROOTPATH);
    }

    Directory newDirectory = await FolderPicker.pick(
        allowFolderCreation: true,
        context: context,
        rootDirectory: directory,
        shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.all(Radius.circular(10))));
    setState(() {
      selectedDirectory = newDirectory;
      print(selectedDirectory);
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Folder"),
        centerTitle: true,
      ),
      body: Container(
        child:Column(children: [
          IconButton(
            icon: Icon(Icons.file_download),
            onPressed: () {
              _pickDirectory(context);
            },
          ),
          selectedDirectory!=null ? Text("Selected Path : ${selectedDirectory.path}"):Container(),
        ],),
      ),
    );
  }
}
32
likes
0
pub points
85%
popularity

Publisher

unverified uploader

Easy directory picker for Flutter

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, path, permission_handler

More

Packages that depend on easy_folder_picker