Skip to content

Commit

Permalink
fix b
Browse files Browse the repository at this point in the history
  • Loading branch information
fanngyuan committed Dec 17, 2020
1 parent ddf2b8e commit a88d91e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
31 changes: 13 additions & 18 deletions lib/pages/node_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ class _NodePageState extends State<NodePage> with TickerProviderStateMixin {
onPressed: onStop,
),
);
final node = Node(LOCALURL);
return RepaintBoundary(
key: previewContainer,
child: Scaffold(
Expand Down Expand Up @@ -355,27 +354,23 @@ class _NodePageState extends State<NodePage> 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;
Expand Down
4 changes: 4 additions & 0 deletions macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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 = "<absolute>"; };
EFC5059D258B14F70049ECEE /* starcoin */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = starcoin; sourceTree = "<group>"; };
EFEC56FD258BA4F900CD10C8 /* starcoin-qr.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "starcoin-qr.png"; path = "../assets/images/starcoin-qr.png"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -126,6 +128,7 @@
33CC10E42044A3C60003C045 = {
isa = PBXGroup;
children = (
EFEC56FD258BA4F900CD10C8 /* starcoin-qr.png */,
EFC505A7258B31D00049ECEE /* starcoin */,
33FAB671232836740065AC1E /* Runner */,
33CEB47122A05771004F2AC0 /* Flutter */,
Expand Down Expand Up @@ -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 */,
Expand Down

0 comments on commit a88d91e

Please sign in to comment.