esys-flutter-share icon indicating copy to clipboard operation
esys-flutter-share copied to clipboard

Screenshot is blackened

Open mnshaikna opened this issue 6 years ago • 9 comments

I am trying to share the image which is in Uint8List format. The image is basically a white container with a black text in it. But when the Image is shared, the background somehow becomes black and the image is not visible as the text is already black.

mnshaikna avatar Apr 30 '19 20:04 mnshaikna

@mnshaikna could you provide a small code sample which reproduces the issue? The description above is not enough to clear the things up.

d-wolf avatar Jul 30 '19 09:07 d-wolf

I face the same problem. When I use your example code:

final ByteData bytes = await rootBundle.load('assets/symbols/hand.png'); await WcFlutterShare.share( sharePopupTitle: 'share faver', fileName: 'share.png', mimeType: 'image/png', bytesOfFile: bytes.buffer.asUint8List());

and share that within an instagram message, all I get is a black image. Sharing the same image via Threema, the image is displayed perfectly fine. :)

gisinator avatar Nov 12 '19 10:11 gisinator

Even i am facing the same problem.

While sharing an image file with Uint8List format gives a blackened image.

I have already added the question to the Stack-Overflow

Can anyone suggest a workaround ?

@gisinator did your code is working now? Can you suggest a solution?

Thanks.

JayM96 avatar Dec 03 '19 13:12 JayM96

I solved the problem by wrapping my widget/Image which is to be shared with a Container and providing color to that container.

please find the answer with an example here https://stackoverflow.com/questions/59169393/flutter-image-share-using-flutter-plugin-giving-me-a-blackend-screen/59405251#59405251

kaxp avatar Dec 23 '19 08:12 kaxp

@kaxp thanks your tip worked for me. i also wrapped the container with a RepaintBoundary.

vaaniiaa avatar Apr 08 '20 11:04 vaaniiaa

you have to change your widget background color to white or any color not black

backgroundColor: Colors.white, it works for me

AmenAdem avatar Jan 22 '22 22:01 AmenAdem

My app implements both dark and light themes. In dark theme, screenshot image appears as expected without including the white background container; but in light theme, screenshot image appears blackened. If I include the container with white background, the blackened screenshot switches between the themes --> screenshot image now appears okay in light theme and becomes blackened in dark theme.

My work around is to check the current theme and use Colors.transparent for dark theme and Colors.white for light theme as below. This works in whatever theme mode.

Screenshot(
  controller: screenshotController,
  child: Container(
    color: isDarkModeEnabled
        ? Colors.transparent
        : Colors.white,
    child: WidgetToBeShared(),
  )
)

ebot64 avatar Jan 26 '22 18:01 ebot64

I am trying to share the image which is in Uint8List format. The image is basically a white container with a black text in it. But when the Image is shared, the background somehow becomes black and the image is not visible as the text is already black.

Any Suggestions

anshupoonam avatar Feb 18 '22 21:02 anshupoonam

you have to change your widget background color to white or any color not black

backgroundColor: Colors.white, it works for me

not working

anshupoonam avatar Feb 18 '22 21:02 anshupoonam