diff --git a/lib/pages/node_page.dart b/lib/pages/node_page.dart index e5d6c34..b96b1df 100644 --- a/lib/pages/node_page.dart +++ b/lib/pages/node_page.dart @@ -160,7 +160,6 @@ class _NodePageState extends State with TickerProviderStateMixin { onPressed: onStop, ), ); - final node = Node(LOCALURL); return RepaintBoundary( key: previewContainer, child: Scaffold( @@ -355,27 +354,23 @@ class _NodePageState extends State with TickerProviderStateMixin { var pngBytes = byteData.buffer.asUint8List(); img.Image background = img.decodeImage(pngBytes); - final qrFile = File("assets/images/starcoin-qr.png"); + var filePath; + if (Platform.isMacOS) { + final current = await DirectoryService.getCurrentDirectory(); + final dir = Directory.fromUri(Uri.parse(current)).path; + filePath = join(dir, 'Contents/Resources/starcoin-qr.png'); + } + if (Platform.isWindows) { + Directory current = Directory.current; + final dir = current.path; + filePath = join(dir, 'starcoin/starcoin-qr.png'); + } + final qrFile = File(filePath); + img.Image qr = img.decodeImage(qrFile.readAsBytesSync()); img.drawImage(background, qr, dstX: 40, dstY: 450, dstH: 120, dstW: 120); - // String fileName = DateTime.now().toIso8601String(); - // var path = - // '/Users/fanngyuan/Documents/workspace/starcoin_node_gui/$fileName.png'; - // //final file = File(path); - // //await file.writeAsBytes(wmImage); - // File(path)..writeAsBytesSync(ui.encodePng(Img)); - - //String fileName = DateTime.now().toIso8601String(); - //var path = - // '/Users/fanngyuan/Documents/workspace/starcoin_node_gui/$fileName.png'; - //final file = File(path); - //await file.writeAsBytes(pngBytes); - // final _originalImage = File("assets/images/starcoin-share-template.png"); - // ui.Image Img = ui.decodeImage(_originalImage.readAsBytesSync()); - // ui.drawString(Img, ui.arial_48, 800, 400, 'Add Text 123', - // color: 0xff00ffff); int fileName = DateTime.now().microsecondsSinceEpoch; var dir; diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index bbe53ea..8ef5656 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -33,6 +33,7 @@ D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; EF1C281E258B4C1200B00C59 /* starcoin in Resources */ = {isa = PBXBuildFile; fileRef = EFC5059D258B14F70049ECEE /* starcoin */; }; EFC505B0258B37760049ECEE /* starcoin in Copy Files */ = {isa = PBXBuildFile; fileRef = EFC5059D258B14F70049ECEE /* starcoin */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + EFEC56FE258BA4F900CD10C8 /* starcoin-qr.png in Resources */ = {isa = PBXBuildFile; fileRef = EFEC56FD258BA4F900CD10C8 /* starcoin-qr.png */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -96,6 +97,7 @@ D73912EF22F37F9E000D13A0 /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/ephemeral/App.framework; sourceTree = SOURCE_ROOT; }; EFC50599258B131D0049ECEE /* Runner copy-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Runner copy-Info.plist"; path = "/Users/fanngyuan/Documents/workspace/starcoin_node_gui/macos/Runner copy-Info.plist"; sourceTree = ""; }; EFC5059D258B14F70049ECEE /* starcoin */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = starcoin; sourceTree = ""; }; + EFEC56FD258BA4F900CD10C8 /* starcoin-qr.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "starcoin-qr.png"; path = "../assets/images/starcoin-qr.png"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -126,6 +128,7 @@ 33CC10E42044A3C60003C045 = { isa = PBXGroup; children = ( + EFEC56FD258BA4F900CD10C8 /* starcoin-qr.png */, EFC505A7258B31D00049ECEE /* starcoin */, 33FAB671232836740065AC1E /* Runner */, 33CEB47122A05771004F2AC0 /* Flutter */, @@ -286,6 +289,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + EFEC56FE258BA4F900CD10C8 /* starcoin-qr.png in Resources */, EF1C281E258B4C1200B00C59 /* starcoin in Resources */, 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */,