11import 'dart:convert' ;
22import 'dart:io' ;
33
4+ import 'package:cross_file/cross_file.dart' ;
45import 'package:desktop_drop/desktop_drop.dart' ;
56import 'package:flutter/foundation.dart' ;
67import 'package:flutter/material.dart' ;
7- import 'package:cross_file/cross_file.dart' ;
88import 'package:shared_preferences/shared_preferences.dart' ;
99
1010void 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\n 1 drag file \n 2 save the bookmark,\n 3 restart app\n 4 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