Skip to content

It is not saved as transparent on the iPhone #217

@hichkas9

Description

@hichkas9

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!);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions