Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

file explorer

configurable file explorer widget for flutter.

usage

simple:

import 'package:filex/filex.dart';
import 'package:path_provider/path_provider.dart';

dir = await getapplicationdocumentsdirectory();
final controller = filexcontroller(path: dir.path);
filex(controller: controller);

with leading and trailing builders:

import 'package:filex/filex.dart';

filex(
  compact: true,
  directory: directory("some_dir_path"),
  directorytrailingbuilder: (context, item) {
    return gesturedetector(
      child: padding(
        padding: const edgeinsets.fromltrb(0, 0, 3.0, 0),
        child: icon(icons.file_download,
          color: colors.grey, size: 20.0)),
        ontap: () => dosomething(item));
})

trailing and leading options are: filetrailingbuilder, directoryleadingbuilder and directorytrailingbuilder

controller

include dialogs to add and delete directories:

class fileexplorer extends statelesswidget {
@override
widget build(buildcontext context) {
   final controller = filexcontroller(path: dir.path);
   return scaffold(
      appbar: appbar(
        title: const text("files"),
        actions: <widget>[
          iconbutton(
            icon: icon(icons.add),
            onpressed: () => controller.adddirectory(context),
          )
        ],
      ),
      body: filex(
        controller: controller,
        actions: <predefinedaction>[predefinedaction.delete],
      ),
    );
  }
}

available controller actions:

controller.delete(directoryitem item) : delete a file or directory

controller.createdirectory(string name) : create a directory

controller.ls() : list the current directory

controller.dispose() : dispose the bloc when finished using

custom actions

it is possible to add custom actions in the slidable menu:

filex(
    controller: controller,
    actions: <predefinedaction>[predefinedaction.delete],
    extraactions: <filexslidableaction>[
    filexslidableaction(
        name: "my action",
        icondata: icons.file_upload,
        color: colors.blue,
        ontap: customaction,
    )
    ],
)

void customaction(buildcontext context, directoryitem item) {
    // action here
}

changefeed

a stream with directory listing items is available to implement
on change callbacks:

streamsubscription<list<directoryitem>> _sub;
_sub = controller.changefeed.listen((items) {
  // do something
});

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.