explorer 2.3.1 copy "explorer: ^2.3.1" to clipboard
explorer: ^2.3.1 copied to clipboard

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

example/lib/main.dart

import 'dart:io';

import 'package:explorer/explorer_io.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:path_provider/path_provider.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  final Directory appDocDir = await getApplicationDocumentsDirectory();
  runApp(MyApp(appDocDir: appDocDir));
}

class MyApp extends StatefulWidget {
  const MyApp({
    required this.appDocDir,
    super.key,
  });

  final Directory appDocDir;

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late ExplorerController _controller;

  @override
  void initState() {
    _controller = ExplorerController(
      provider: IoExplorerProvider(
        entryPath: widget.appDocDir.path,
      ),
    );

    super.initState();
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  void filePressed(ExplorerFile file) {
    if ((file.size ?? 0) > 200000) {
      const 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;
    }
  }

  @override
  Widget build(BuildContext context) => MaterialApp(
        localizationsDelegates: const [
          ExplorerLocalizationsDelegate(),
          GlobalMaterialLocalizations.delegate,
          GlobalWidgetsLocalizations.delegate,
        ],
        supportedLocales: const [
          Locale('en', ''),
          Locale('ru', ''),
          Locale('fr', ''),
        ],
        home: Scaffold(
          body: Explorer(
            controller: _controller,
            builder: (_) => [
              const ExplorerToolbar(),
              const ExplorerActionView(),
              const ExplorerFilesGridView(),
            ],
            filePressed: filePressed,
          ),
        ),
      );
}
44
likes
160
points
132
downloads

Documentation

API reference

Publisher

verified publisherserge.software

Weekly Downloads

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

Repository (GitHub)
View/report issues

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