v1.0.2
drop_zone
為 Flutter Web 帶來拖曳功能的簡單方法。drop_zone 通常用於透過將一個或多個檔案拖曳到指定組件上來選擇檔案。使用者隨後可使用所拖曳的 HTML 檔案。
46喜歡 2000近 30 天下載120Pub 分數
Web
將拖放功能引入 Flutter Web 的一種簡單方法
{"sdk":"flutter"}{"sdk":"flutter"}以下為英文專案原文快照,最新內容請造訪 GitHub。
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
An example can be found in the example directory of this repository.
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,
)
)