explorer 2.0.0
explorer: ^2.0.0 copied to clipboard

Universal explorer UI for navigate files, ftp, etc. Support custom providers and any platforms c:

explorer #

Universal flexibility explorer UI for navigate files, ftp, etc.

Support custom providers and any platforms

Showcase #

Context menuActionsNew & Upload

Getting Started #

In your flutter project add the dependency:

pub package

dependencies:
  explorer: any

import

/// Main import
import 'package:explorer/explorer.dart';

/// Import for [IoExplorerProvider]. 
/// Does work only IO (NOT WORK ON WEB)
import 'package:explorer/explorer_io.dart';

Api overview #

ExplorerController #

ParameterDescriptionRequiredDefault
providerAn entity responsible for navigating the file structure of any type, ex. IoExplorerProvider for io[x]-

Explorer #

ParameterDescriptionRequiredDefault
controllerExplorerController initialized instance[x]-
builderBuilder callback for fully customize UI[x]-
bottomBarBuilderAdditional builder for bottom bar[ ]-
uploadFilesCallback called on tap upload files action, (action show only if callback exist!)[ ]-
filePressedCallback called file pressed[ ]-

ExplorerToolbar #

Top toolbar with breadcrumbs & actions

ExplorerActionView #

Action view with actual command (Copy / move here etc.)

ExplorerFilesGridView #

Show files as grid

Examples #

Simple example #

See full at example dir

/// Initialize controller in initState
_controller = ExplorerController(
  provider: IoExplorerProvider(
    entryPath: '/path/to/entry', // For IO explorer pass some entry path
  ),
)

Explorer(
  controller: _controller,

  // Customize UI by Explorer & you own widgets!
  builder: (_) => [
    ExplorerToolbar(),
    ExplorerActionView(),
    ExplorerFilesGridView(),
  ],
  // Callback called on file at explorer pressed
  filePressed: (file) {
    if (file.size > 200000) {
      final snackBar =
          SnackBar(content: Text('Can\'t open files with size > 200kb'));

      // Find the Scaffold in the widget tree and use it to show a SnackBar.
      ScaffoldMessenger.of(context).showSnackBar(snackBar);
      return;
    }
  }
)

Custom provider #

You need implement ExplorerProvider and pass result to ExplorerController as provider. You can make any provider: ftp, rest api, etc.

abstract class ExplorerProvider {
  /// Explorer starts path
  String get entryPath;

  /// Explorer actual path
  String get currentPath;

  /// Navigate to specific path
  Future<List<Entry>> go(String path);

  /// Create new directory at [currentPath]
  Future<ExplorerDirectory> newDirectory(String name);

  /// Create new file at [currentPath]
  Future<ExplorerFile> newFile(String name);

  /// Recursive remove file or dir at [currentPath]
  Future<void> remove(Entry name);

  /// Copy file or dir
  Future<void> copy(Entry from, Entry to);
}
4
likes
130
pub points
44%
popularity

Publisher

serge.software

Universal explorer UI for navigate files, ftp, etc. Support custom providers and any platforms c:

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

auto_animated, flutter, flutter_breadcrumb, flutter_localizations, intl, io, meta, path, sliver_tools, universal_platform

More

Packages that depend on explorer