-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22cf218
commit f61bc98
Showing
16 changed files
with
499 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
import 'package:desktop_drop/desktop_drop.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'indexedStackIsVisible.dart'; | ||
|
||
class DropTargetBuilder extends StatefulWidget { | ||
final void Function(List<String> paths) onDrop; | ||
final Widget Function(BuildContext context, bool isDropping) builder; | ||
|
||
const DropTargetBuilder({super.key, required this.onDrop, required this.builder}); | ||
|
||
@override | ||
State<DropTargetBuilder> createState() => _DropTargetBuilderState(); | ||
} | ||
|
||
class _DropTargetBuilderState extends State<DropTargetBuilder> { | ||
bool isDropping = false; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return DropTarget( | ||
enable: ModalRoute.of(context)!.isCurrent && IndexedStackIsVisible.of(context) != false, | ||
onDragEntered: (_) => setState(() => isDropping = true), | ||
onDragExited: (_) => setState(() => isDropping = false), | ||
onDragDone: (details) { | ||
widget.onDrop(details.files.map((f) => f.path).toList()); | ||
}, | ||
child: widget.builder(context, isDropping), | ||
); | ||
} | ||
} |
Oops, something went wrong.