From 12fa41cda0e6b6f774e1c91315979eb823c3892b Mon Sep 17 00:00:00 2001 From: fang yuan Date: Wed, 16 Dec 2020 22:54:17 +0800 Subject: [PATCH] fix bug --- lib/pages/node_page.dart | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/lib/pages/node_page.dart b/lib/pages/node_page.dart index edb21ed..d8a39da 100644 --- a/lib/pages/node_page.dart +++ b/lib/pages/node_page.dart @@ -62,10 +62,8 @@ class _NodePageState extends State with TickerProviderStateMixin { final whiteTextstyle = TextStyle(color: Colors.white, fontSize: 25); final edgeTexts = EdgeInsets.only(left: 30, right: 30); final dateTime = DateTime.now(); - Directory current = Directory.current; - time = current.path; - //time = formatDate(dateTime, [yyyy, '/', mm, '/', dd, ' ', HH, ':', nn]); - //freshTime(); + time = formatDate(dateTime, [yyyy, '/', mm, '/', dd, ' ', HH, ':', nn]); + freshTime(); final boxDecoration = new BoxDecoration( //设置四周圆角 角度 borderRadius: BorderRadius.all(Radius.circular(10.0)), @@ -76,18 +74,18 @@ class _NodePageState extends State with TickerProviderStateMixin { if (!startRequest) { onclick = () async { // 用Directory.current 也不对 - var command =""; - if (Platform.isMacOS){ + var command = ""; + if (Platform.isMacOS) { final current = await DirectoryService.getCurrentDirectory(); final dir = Directory.fromUri(Uri.parse(current)).parent; - command = join(dir.path, 'starcoin/starcoin'); + command = join(dir.path, 'starcoin/starcoin'); } - if (Platform.isWindows){ + if (Platform.isWindows) { Directory current = Directory.current; - command= join(current.path,'starcoin/starcoin'); + command = join(current.path, 'starcoin/starcoin'); } - final process = await Process.start(command - , + final process = await Process.start( + command, [ "-n", "dev", @@ -380,17 +378,16 @@ class _NodePageState extends State with TickerProviderStateMixin { int fileName = DateTime.now().microsecondsSinceEpoch; var dir; - if (Platform.isMacOS){ - final current = await DirectoryService.getCurrentDirectory(); - dir = Directory.fromUri(Uri.parse(current)).parent.path; - + if (Platform.isMacOS) { + final current = await DirectoryService.getCurrentDirectory(); + dir = Directory.fromUri(Uri.parse(current)).parent.path; } - if (Platform.isWindows){ - Directory current = Directory.current; - dir = current.path; + if (Platform.isWindows) { + Directory current = Directory.current; + dir = current.path; } - var path =join(dir,'$fileName.png'); + var path = join(dir, '$fileName.png'); // //final file = File(path); // //await file.writeAsBytes(wmImage); File(path)..writeAsBytesSync(img.encodePng(background));