FLUTTER ECOSYSTEM

derrick56007/dropzone

将拖放功能引入 Flutter Web 的一种简单方法

dropzone 项目封面
Stars
34
Forks
8
最近推送(UTC)
2023年7月12日
项目状态
未归档
Derrick GitHub avatar
GITHUB User

Derrick ↗

San Francisco
语言DartHTMLDockerfile

此仓库发布的插件

使用的依赖

依赖清单 2 项
  • flutter{"sdk":"flutter"}
  • flutter_test开发依赖{"sdk":"flutter"}

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

展开 / 收起项目 README

drop_zone

pub package License: MIT

A simple way to bring drag’n’drop to flutter web.

drop_zone is commonly used for file choosing by dragging and dropping a file(s) onto a designated widget. The user can then use the dropped html file(s).

https://raw.githubusercontent.com/derrick56007/dropzone/HEAD/demo.gif?raw=true

Example

An example can be found in the example directory of this repository.

How to use

Add drop_zone to pubspec.yaml of your project:

dependencies:
  drop_zone: ^1.0.2

Add necessary imports and wrap any widget with DropZone() to use it as a dropzone:

import 'package:drop_zone/drop_zone.dart';
import 'dart:html' as html;

DropZone(
    onDragEnter: () {
        print('drag enter');
    },
    onDragExit: () {
        print('drag exit');
    },
    onDrop: (List<html.File> files) {
        print('files dropped');
        print(files);
    },
    child: Container(
        width: 300,
        height: 300,
    )
)

License

MIT License.