disable desktop_drop for now

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-05-05 20:47:42 -07:00
parent a054c9520e
commit 72b19a27d3
2 changed files with 42 additions and 30 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,7 +62,8 @@ class _FileManagerPageState extends State<FileManagerPage>
with AutomaticKeepAliveClientMixin {
final _mouseFocusScope = Rx<MouseFocusScope>(MouseFocusScope.none);
final _dropMaskVisible = false.obs; // TODO impl drop mask
// Disable desktop_drop for now
// final _dropMaskVisible = false.obs; // TODO impl drop mask
final _overlayKeyState = OverlayKeyState();
late FFI _ffi;
@ -129,16 +130,21 @@ class _FileManagerPageState extends State<FileManagerPage>
}
Widget dropArea(FileManagerView fileView) {
return DropTarget(
onDragDone: (detail) =>
handleDragDone(detail, fileView.controller.isLocal),
onDragEntered: (enter) {
_dropMaskVisible.value = true;
},
onDragExited: (exit) {
_dropMaskVisible.value = false;
},
child: 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);
}
Widget generateCard(Widget child) {
@ -316,22 +322,24 @@ class _FileManagerPageState extends State<FileManagerPage>
);
}
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);
}
// 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);
// }
}
class FileManagerView extends StatefulWidget {

View File

@ -38,7 +38,7 @@ dependencies:
wakelock: ^0.6.2
device_info_plus: ^4.1.2
#firebase_analytics: ^9.1.5
package_info_plus: ^1.4.2
package_info_plus: ^3.1.0
url_launcher: ^6.0.9
toggle_switch: ^1.4.0
dash_chat_2: ^0.0.14
@ -70,7 +70,8 @@ dependencies:
get: ^4.6.5
visibility_detector: ^0.3.3
contextmenu: ^3.0.0
desktop_drop: ^0.3.3
# Disable desktop_drop for now, because it may cause crash on Win11 when destructing.
# desktop_drop: ^0.4.1
scroll_pos: ^0.3.0
debounce_throttle: ^2.0.0
file_picker: ^5.1.0
@ -109,6 +110,9 @@ dev_dependencies:
flutter_lints: ^2.0.0
ffigen: ^7.2.4
dependency_overrides:
intl: ^0.17.0-nullsafety.2
# rerun: flutter pub run flutter_launcher_icons
flutter_icons:
image_path: "../res/icon.png"