From 980e714050c6cf352449b7291fab55fa1cf2336d Mon Sep 17 00:00:00 2001 From: digitalheartxs Date: Fri, 4 Oct 2024 16:16:47 +0200 Subject: [PATCH] fix(cat-voices): Fix tests in main (#963) * fix: Fix tests in main * fix: Fix tests in main --------- Co-authored-by: Dominik Toton <166132265+dtscalac@users.noreply.github.com> --- .../modals/voices_upload_file_dialog.dart | 24 +++++++++---------- catalyst_voices/pubspec.yaml | 1 - 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/catalyst_voices/lib/widgets/modals/voices_upload_file_dialog.dart b/catalyst_voices/lib/widgets/modals/voices_upload_file_dialog.dart index 43bd6b2833..63811e2aae 100644 --- a/catalyst_voices/lib/widgets/modals/voices_upload_file_dialog.dart +++ b/catalyst_voices/lib/widgets/modals/voices_upload_file_dialog.dart @@ -10,9 +10,9 @@ import 'package:catalyst_voices_models/catalyst_voices_models.dart'; import 'package:catalyst_voices_shared/catalyst_voices_shared.dart'; import 'package:dotted_border/dotted_border.dart'; import 'package:file_picker/file_picker.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_dropzone/flutter_dropzone.dart'; -import 'package:web/web.dart' as web; class VoicesUploadFileDialog extends StatefulWidget { final String title; @@ -253,14 +253,15 @@ class _UploadContainerState extends State<_UploadContainer> { color: Theme.of(context).colors.iconsPrimary!, child: Stack( children: [ - DropzoneView( - operation: DragOperation.copy, - cursor: CursorType.grab, - onCreated: (DropzoneViewController ctrl) => setState(() { - _dropzoneController = ctrl; - }), - onDrop: (ev) async { - if (ev is web.File) { + // We allow drag&drop only on web + if (kIsWeb) + DropzoneView( + operation: DragOperation.copy, + cursor: CursorType.grab, + onCreated: (DropzoneViewController ctrl) => setState(() { + _dropzoneController = ctrl; + }), + onDrop: (ev) async { final bytes = await _dropzoneController.getFileData(ev); final name = await _dropzoneController.getFilename(ev); widget.onFileSelected?.call( @@ -269,9 +270,8 @@ class _UploadContainerState extends State<_UploadContainer> { bytes: bytes, ), ); - } - }, - ), + }, + ), InkWell( onTap: () async { final result = await FilePicker.platform.pickFiles( diff --git a/catalyst_voices/pubspec.yaml b/catalyst_voices/pubspec.yaml index 030901a3a1..327c8743ee 100644 --- a/catalyst_voices/pubspec.yaml +++ b/catalyst_voices/pubspec.yaml @@ -53,7 +53,6 @@ dependencies: sentry_flutter: ^8.8.0 url_launcher: ^6.2.2 url_strategy: ^0.3.0 - web: ^1.1.0 # TODO(dtscalac): win32 dependency is just a transitive dependency and shouldn't be imported # but here we import it explicitly to make sure the latest version is used which addresses # the problem from here: https://github.com/jonataslaw/get_cli/issues/263