drag_and_drop_flutter 0.3.0 copy "drag_and_drop_flutter: ^0.3.0" to clipboard
drag_and_drop_flutter: ^0.3.0 copied to clipboard

Support native drag and drop of text, files and directories in Flutter.

drag_and_drop_flutter #

pub package

This plugin implements drag and drop functionality, along with some widgets to easily use drag and drop. Use DragDropArea to receive callbacks when data is dragged over or dropped on the widget, or to set data when users drag from the widget.

This is a federated plugin. It currently only has an endorsed implementation for web. For convenience, this plugin will work for any platform, but on platforms other than web it will do nothing.

Usage #

To use this plugin, add drag_and_drop_flutter as a dependency in your pubspec.yaml file.

Example #

import 'package:flutter/material.dart';
import 'package:drag_and_drop_flutter/drag_and_drop_flutter.dart';

void main() {
  runApp(MaterialApp(
    home: DragDropArea(
      onDrop: (data) {
        final text = data['text/plain']?.toString();
        if (text != null) {
          debugPrint('Dropped text: $text');
        }
      },
      child: const Center(
        child: Text('Drop stuff here'),
      ),
    ),
  ));
}