Skip to content

Commit 7245060

Browse files
authored
WASM fix (#398)
1 parent 80f5ae9 commit 7245060

File tree

7 files changed

+166
-185
lines changed

7 files changed

+166
-185
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"workbench.editor.scrollToSwitchTabs": true,
3+
"workbench.editor.limit.enabled": true,
4+
"dart.closingLabels": false,
5+
// copied from: https://dartcode.org/docs/recommended-settings/
6+
// Causes the debug view to automatically appear when a breakpoint is hit. This
7+
// setting is global and not configurable per-language.
8+
"debug.openDebug": "openOnDebugBreak",
9+
"[yaml]": {
10+
"editor.formatOnSave": true
11+
},
12+
"editor.bracketPairColorization.enabled": true,
13+
"editor.codeActionsOnSave": {
14+
"source.fixAll": "explicit",
15+
"source.organizeImports": "explicit",
16+
"quickfix.insertSemicolon": "explicit"
17+
// "source.fixAll.eslint": "explicit" NOTE: causing hangs on save?
18+
},
19+
"editor.formatOnSave": true,
20+
"prettier.singleQuote": true,
21+
"prettier.trailingComma": "all",
22+
"dart.runPubGetOnPubspecChanges": "never",
23+
"xmlTools.splitXmlnsOnFormat": false,
24+
"xmlTools.splitAttributesOnFormat": true,
25+
"arb-editor.suppressedWarnings": "all",
26+
"editor.inlayHints.enabled": "off",
27+
"github.copilot.nextEditSuggestions.enabled": true,
28+
"editor.dragAndDrop": false
29+
}

packages/desktop_drop/example/lib/main.dart

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import 'dart:convert';
22
import 'dart:io';
33

4+
import 'package:cross_file/cross_file.dart';
45
import 'package:desktop_drop/desktop_drop.dart';
56
import 'package:flutter/foundation.dart';
67
import 'package:flutter/material.dart';
7-
import 'package:cross_file/cross_file.dart';
88
import 'package:shared_preferences/shared_preferences.dart';
99

1010
void main() {
@@ -38,7 +38,7 @@ class MyApp extends StatelessWidget {
3838
)));
3939
}
4040

41-
var file = File('$path');
41+
var file = File(path);
4242

4343
var contents = await file.readAsBytes();
4444
var fileSize = contents.length;
@@ -69,25 +69,25 @@ class MyApp extends StatelessWidget {
6969
runSpacing: 8,
7070
spacing: 8,
7171
children: [
72-
ExampleDragTarget(),
73-
ExampleDragTarget(),
74-
ExampleDragTarget(),
75-
ExampleDragTarget(),
76-
ExampleDragTarget(),
77-
ExampleDragTarget(),
72+
const ExampleDragTarget(),
73+
const ExampleDragTarget(),
74+
const ExampleDragTarget(),
75+
const ExampleDragTarget(),
76+
const ExampleDragTarget(),
77+
const ExampleDragTarget(),
7878
if (Platform.isMacOS)
7979
StatefulBuilder(builder: (context, setState) {
8080
return Column(
8181
children: [
82-
Text(
82+
const Text(
8383
"Test Apple Bookmark\n1 drag file \n2 save the bookmark,\n3 restart app\n4 choice test button",
8484
),
8585
TextButton(
8686
onPressed: () async {
8787
loadFile(context, true);
8888
return;
8989
},
90-
child: Text(
90+
child: const Text(
9191
"with applemark, suc",
9292
),
9393
),
@@ -96,7 +96,7 @@ class MyApp extends StatelessWidget {
9696
loadFile(context, false);
9797
return;
9898
},
99-
child: Text(
99+
child: const Text(
100100
"without applemark, err",
101101
),
102102
),
@@ -175,7 +175,7 @@ class _ExampleDragTargetState extends State<ExampleDragTarget> {
175175
child: Stack(
176176
children: [
177177
if (_list.isEmpty)
178-
Center(child: Text("Drop here"))
178+
const Center(child: Text("Drop here"))
179179
else
180180
Text(_list.map((e) => e.path).join("\n")),
181181
if (offset != null)
@@ -186,12 +186,12 @@ class _ExampleDragTargetState extends State<ExampleDragTarget> {
186186
style: Theme.of(context).textTheme.bodySmall,
187187
),
188188
),
189-
if (!_list.isEmpty && Platform.isMacOS)
189+
if (_list.isNotEmpty && Platform.isMacOS)
190190
Align(
191191
alignment: Alignment.bottomRight,
192192
child: TextButton(
193193
onPressed: () async {
194-
Map<String, String> data = Map();
194+
Map<String, String> data = {};
195195
data["path"] = drop_files[0].path;
196196

197197
String bookmark =
@@ -204,11 +204,11 @@ class _ExampleDragTargetState extends State<ExampleDragTarget> {
204204
await SharedPreferences.getInstance();
205205
prefs.setString("apple-bookmark", jsonStr);
206206

207-
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
207+
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
208208
content: Text(
209209
'Save Suc, restart app, and Test Apple Bookmark')));
210210
},
211-
child: Text(
211+
child: const Text(
212212
'save bookmark',
213213
style: TextStyle(fontSize: 14),
214214
),

0 commit comments

Comments
 (0)