esysberlin / esys-flutter-share

A Flutter plugin for sharing files & text with other applications.
Apache License 2.0
130 stars 147 forks source link

Text is not shown when sharing image on facebook or instagram #80

Open ShamsFaraj opened 3 years ago

ShamsFaraj commented 3 years ago

Text is not shown when sharing image on facebook or instagram. But it's shown on messengers. How can I show text as text on facebook feed etc?

this is my method sample:

Future _shareImage(RenderRepaintBoundary imageObj) async { try { final image = await imageObj.toImage(pixelRatio: 5.0); final ByteData byteData = await image.toByteData(format: ImageByteFormat.png); final pngBytes = byteData.buffer.asUint8List(); await Share.file('REBUSTA', 'esys.png', pngBytes, 'image/png', text: 'www.rebusta.com'); } catch (e) { print('error: $e'); } }

hasnainelahi commented 3 years ago

i also have same problem

ShamsFaraj commented 3 years ago

In my case, the optional text was shown just fine on Android, but not in IOS. I used another plugin, result was also the same. So, I didn't used text for ios platform after all, like below:

if(Platform.isAndroid) {
  await Share.file('REBUSTA', 'esys.png', pngBytes, 'image/png', text: 'REBUSTA mobil oyununu pulsuz əldə et və Rebus Ustası adını qazan. \nwww.rebusta.az\n\n Kibrit.tech');
} else {
  await Share.file('REBUSTA', 'esys.png', pngBytes, 'image/png');
}
hasnainelahi commented 3 years ago

I am using this code but not working on android. Only image sharing not with text. anyone can help me?

Future _shareImageFromUrl() async { try { var request = await HttpClient() .getUrl(Uri.parse('https://media.sproutsocial.com/uploads/2017/02/10x-featured-social-media-image-size.png')); var response = await request.close(); Uint8List bytes = await consolidateHttpClientResponseBytes(response); await Share.file( 'ESYS AMLOG', 'amlog.png', bytes, 'image/png', text:'An MPG is a popular video format', ); } catch (e) { print('error: $e'); } }

kaushikgodhani commented 2 years ago

https://pub.dev/packages/vocsy_esys_flutter_share

Use this Package its working on latest version