Revert "disable desktop_drop for now"

This commit is contained in:
RustDesk 2023-05-12 13:22:49 +08:00 committed by GitHub
parent ea802ff74f
commit 3b0788be56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 38 deletions

View File

@ -4,7 +4,7 @@ import 'dart:math';
import 'package:flutter_hbb/desktop/widgets/dragable_divider.dart';
import 'package:percent_indicator/percent_indicator.dart';
// import 'package:desktop_drop/desktop_drop.dart';
import 'package:desktop_drop/desktop_drop.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -62,8 +62,7 @@ class _FileManagerPageState extends State<FileManagerPage>
with AutomaticKeepAliveClientMixin {
final _mouseFocusScope = Rx<MouseFocusScope>(MouseFocusScope.none);
// Disable desktop_drop for now
// final _dropMaskVisible = false.obs; // TODO impl drop mask
final _dropMaskVisible = false.obs; // TODO impl drop mask
final _overlayKeyState = OverlayKeyState();
late FFI _ffi;
@ -130,21 +129,16 @@ class _FileManagerPageState extends State<FileManagerPage>
}
Widget dropArea(FileManagerView fileView) {
return Container(
child: fileView,
);
// Disable desktop_drop for now
//
// return DropTarget(
// onDragDone: (detail) =>
// handleDragDone(detail, fileView.controller.isLocal),
// onDragEntered: (enter) {
// _dropMaskVisible.value = true;
// },
// onDragExited: (exit) {
// _dropMaskVisible.value = false;
// },
// child: fileView);
return DropTarget(
onDragDone: (detail) =>
handleDragDone(detail, fileView.controller.isLocal),
onDragEntered: (enter) {
_dropMaskVisible.value = true;
},
onDragExited: (exit) {
_dropMaskVisible.value = false;
},
child: fileView);
}
Widget generateCard(Widget child) {
@ -322,24 +316,22 @@ class _FileManagerPageState extends State<FileManagerPage>
);
}
// Disable desktop_drop for now
//
// void handleDragDone(DropDoneDetails details, bool isLocal) {
// if (isLocal) {
// // ignore local
// return;
// }
// final items = SelectedItems(isLocal: false);
// for (var file in details.files) {
// final f = File(file.path);
// items.add(Entry()
// ..path = file.path
// ..name = file.name
// ..size = FileSystemEntity.isDirectorySync(f.path) ? 0 : f.lengthSync());
// }
// final otherSideData = model.localController.directoryData();
// model.remoteController.sendFiles(items, otherSideData);
// }
void handleDragDone(DropDoneDetails details, bool isLocal) {
if (isLocal) {
// ignore local
return;
}
final items = SelectedItems(isLocal: false);
for (var file in details.files) {
final f = File(file.path);
items.add(Entry()
..path = file.path
..name = file.name
..size = FileSystemEntity.isDirectorySync(f.path) ? 0 : f.lengthSync());
}
final otherSideData = model.localController.directoryData();
model.remoteController.sendFiles(items, otherSideData);
}
}
class FileManagerView extends StatefulWidget {

View File

@ -70,8 +70,7 @@ dependencies:
get: ^4.6.5
visibility_detector: ^0.3.3
contextmenu: ^3.0.0
# Disable desktop_drop for now, because it may cause crash on Win11 when destructing.
# desktop_drop: ^0.4.1
desktop_drop: ^0.3.3
scroll_pos: ^0.3.0
debounce_throttle: ^2.0.0
file_picker: ^5.1.0