Skip to content

lmis-frontend/flutter-plugins

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

desktop_drop

Pub

A plugin which allows user dragging files to your flutter desktop applications.

Windows ✅
Linux ✅
macOS ✅
Android ✅(preview)
Web ✅

Getting Started

  1. Add desktop_drop to your pubspec.yaml.
  desktop_drop: $latest_version
  1. Then you can use DropTarget to receive file drop events.
class ExmapleDragTarget extends StatefulWidget {
  const ExmapleDragTarget({Key? key}) : super(key: key);

  @override
  _ExmapleDragTargetState createState() => _ExmapleDragTargetState();
}

class _ExmapleDragTargetState extends State<ExmapleDragTarget> {
  final List<XFile> _list = [];

  bool _dragging = false;

  @override
  Widget build(BuildContext context) {
    return DropTarget(
      onDragDone: (detail) {
        setState(() {
          _list.addAll(detail.files);
        });
      },
      onDragEntered: (detail) {
        setState(() {
          _dragging = true;
        });
      },
      onDragExited: (detail) {
        setState(() {
          _dragging = false;
        });
      },
      child: Container(
        height: 200,
        width: 200,
        color: _dragging ? Colors.blue.withOpacity(0.4) : Colors.black26,
        child: _list.isEmpty
            ? const Center(child: Text("Drop here"))
            : Text(_list.join("\n")),
      ),
    );
  }
}

LICENSE

see LICENSE file

About

🧱 Flutter plugins used in Mixin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 38.8%
  • Dart 21.7%
  • CMake 19.7%
  • Swift 5.5%
  • HTML 4.6%
  • Kotlin 4.2%
  • Other 5.5%