Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It is not saved as transparent on the iPhone #217

Open
hichkas9 opened this issue Jan 12, 2024 · 0 comments
Open

It is not saved as transparent on the iPhone #217

hichkas9 opened this issue Jan 12, 2024 · 0 comments

Comments

@hichkas9
Copy link

hi.

Recently, photos on the iPhone are getting a white background? What problem has occurred?

The codes for converting a widget to an image are as follows:

   RenderRepaintBoundary? boundary =
          key1.currentContext?.findRenderObject() as RenderRepaintBoundary?;
      ui.Image image = await boundary!.toImage(pixelRatio: 3.0);
      ByteData? byteData =
          await image.toByteData(format: ui.ImageByteFormat.png);
      pngBytes = byteData!.buffer.asUint8List();
      imageInMemory = pngBytes;
      inside.value = false;

      final String dir;
      if (Platform.isAndroid) {
        dir = (await getExternalStorageDirectory())?.path ?? "";
      } else {
        dir = (await getApplicationDocumentsDirectory()).path;
      }
      final String fileName = "${DateTime.now().millisecondsSinceEpoch}";
      final String fullPath = '$dir/$fileName.png';
      File capturedFile = File(fullPath);
      await capturedFile.writeAsBytes(pngBytes!);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant