Skip to content

Commit 980e714

Browse files
fix(cat-voices): Fix tests in main (#963)
* fix: Fix tests in main * fix: Fix tests in main --------- Co-authored-by: Dominik Toton <[email protected]>
1 parent fca1d62 commit 980e714

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

catalyst_voices/lib/widgets/modals/voices_upload_file_dialog.dart

+12-12
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import 'package:catalyst_voices_models/catalyst_voices_models.dart';
1010
import 'package:catalyst_voices_shared/catalyst_voices_shared.dart';
1111
import 'package:dotted_border/dotted_border.dart';
1212
import 'package:file_picker/file_picker.dart';
13+
import 'package:flutter/foundation.dart';
1314
import 'package:flutter/material.dart';
1415
import 'package:flutter_dropzone/flutter_dropzone.dart';
15-
import 'package:web/web.dart' as web;
1616

1717
class VoicesUploadFileDialog extends StatefulWidget {
1818
final String title;
@@ -253,14 +253,15 @@ class _UploadContainerState extends State<_UploadContainer> {
253253
color: Theme.of(context).colors.iconsPrimary!,
254254
child: Stack(
255255
children: [
256-
DropzoneView(
257-
operation: DragOperation.copy,
258-
cursor: CursorType.grab,
259-
onCreated: (DropzoneViewController ctrl) => setState(() {
260-
_dropzoneController = ctrl;
261-
}),
262-
onDrop: (ev) async {
263-
if (ev is web.File) {
256+
// We allow drag&drop only on web
257+
if (kIsWeb)
258+
DropzoneView(
259+
operation: DragOperation.copy,
260+
cursor: CursorType.grab,
261+
onCreated: (DropzoneViewController ctrl) => setState(() {
262+
_dropzoneController = ctrl;
263+
}),
264+
onDrop: (ev) async {
264265
final bytes = await _dropzoneController.getFileData(ev);
265266
final name = await _dropzoneController.getFilename(ev);
266267
widget.onFileSelected?.call(
@@ -269,9 +270,8 @@ class _UploadContainerState extends State<_UploadContainer> {
269270
bytes: bytes,
270271
),
271272
);
272-
}
273-
},
274-
),
273+
},
274+
),
275275
InkWell(
276276
onTap: () async {
277277
final result = await FilePicker.platform.pickFiles(

catalyst_voices/pubspec.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ dependencies:
5353
sentry_flutter: ^8.8.0
5454
url_launcher: ^6.2.2
5555
url_strategy: ^0.3.0
56-
web: ^1.1.0
5756
# TODO(dtscalac): win32 dependency is just a transitive dependency and shouldn't be imported
5857
# but here we import it explicitly to make sure the latest version is used which addresses
5958
# the problem from here: https://github.com/jonataslaw/get_cli/issues/263

0 commit comments

Comments
 (0)