Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[desktop_drop] Exporting 'events.dart' request #386

Open
13thdeus opened this issue Jan 20, 2025 · 0 comments
Open

[desktop_drop] Exporting 'events.dart' request #386

13thdeus opened this issue Jan 20, 2025 · 0 comments

Comments

@13thdeus
Copy link

I was working on drop zone highlighting. I used a raw drop event listener to change the widget state when the user starts dragging a file over the application. I had to import a file from the src directory to complete my task.

//Linter message: Import of a library in the 'lib/src' directory of another package. (Documentation)
import 'package:desktop_drop/src/events.dart';
...
  @override
  void initState() {
    DesktopDrop.instance.addRawDropEventListener(_onDropEvent);
    ...
    super.initState();
  }

  @override
  void dispose() {
    DesktopDrop.instance.removeRawDropEventListener(_onDropEvent);
    ...
    super.dispose();
  }

  void _onDropEvent(DropEvent event) {
    if (_dropSubject.value && (event is DropDoneEvent || event is DropExitEvent)) {
      _dropSubject.add(false);
    } else if (!_dropSubject.value && event is DropEnterEvent) {
      _dropSubject.add(true);
    }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant