-
Notifications
You must be signed in to change notification settings - Fork 226
Open
Description
class FileDropBox extends StatelessWidget {
FileDropBox({super.key});
final controller = Get.put(FileDropController());
@override
Widget build(BuildContext context) {
return DropTarget(
onDragDone: (details) {
final paths = details.files.map((file) => file.path).toList();
debugPrint("onDragDone!!!");
controller.onFilesDropped(paths);
},
child: const SizedBox.expand(),
);
}
}
For example, when the stateless widget FileDropBox
rebuild, DropTarget
will add a new onDragDone
listener.
Which Means when I drop file to this widget, it will run onDragDone
twice.
When FileDropBox
rebuild again, onDragDone
will run for three times.
Activity