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

outdated

Easy directory picker for Flutter, you can choose directory or create directory for further action

example/lib/main.dart

import 'dart:io';

import 'package:easy_folder_picker/FolderPicker.dart';
import 'package:flutter/material.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: 'Easy Folder Picker',
      debugShowCheckedModeBanner: false,
      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
86%
popularity

Publisher

verified publisherkapil.info.np

Easy directory picker for Flutter, you can choose directory or create directory for further action

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, path, permission_handler

More

Packages that depend on easy_folder_picker