explorer 2.3.0 copy "explorer: ^2.3.0" to clipboard
explorer: ^2.3.0 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,
    Key? key,
  }) : super(key: key);

  final Directory appDocDir;

  @override
  _MyAppState 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) {
      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;
    }
  }

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

Publisher

verified publisherserge.software

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

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