plus_plugins icon indicating copy to clipboard operation
plus_plugins copied to clipboard

Share not working on iPAD

Open pratikbaid3 opened this issue 3 years ago • 7 comments

Share is working on iphone but not on ipad. I don't see a specific configuration that needs to be added to the iPad build so does the plugin not support ipad?

pratikbaid3 avatar Apr 04 '22 11:04 pratikbaid3

Hi my friend!

It must be positioned via the "sharePositionOrigin" parameter.

Example: sharePositionOrigin: Rect.fromLTWH(10, 10, 10, 10),

example/lib/main.dart#L123

xpolter avatar Apr 04 '22 13:04 xpolter

  static shareLink(BuildContext context, String url,
      {String? message, String? subject}) async {
    final RenderBox? box = context.findRenderObject() as RenderBox?;

    await Share.share(message!,
        sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size);
  }

I am also facing this problem I have this code and it is not working in iPad

balaji101010 avatar Apr 05 '22 09:04 balaji101010

Finally I fixed it

  static shareLink(BuildContext context, {String? message}) async {
    Size size = MediaQuery.of(context).size;
    Share.share(
      message!,
      sharePositionOrigin: Rect.fromLTWH(0, 0, size.width, size.height / 2),
    );
  }

From this reference for ipad issue https://github.com/flutter/flutter/issues/47220#issuecomment-608453383

balaji101010 avatar Apr 05 '22 12:04 balaji101010

Наконец-то я это исправил

  static shareLink(BuildContext context, {String? message}) async {
    Size size = MediaQuery.of(context).size;
    Share.share(
      message!,
      sharePositionOrigin: Rect.fromLTWH(0, 0, size.width, size.height / 2),
    );
  }

Из этой ссылки для ipad выпуск flutter/flutter#47220 (комментарий)

Right It worked for me when explicitly specifying the location of the element.

Screenshot_1649160864

xpolter avatar Apr 05 '22 12:04 xpolter

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days

github-actions[bot] avatar Jun 05 '22 00:06 github-actions[bot]

documentation has been updated: https://github.com/fluttercommunity/plus_plugins/pull/898

miquelbeltran avatar Jun 06 '22 10:06 miquelbeltran

I'm faced same issue with layout - Xcode console, says that this is Constraints bug, so I've fixed it with this code

sharePositionOrigin: Rect.fromLTWH(
          box.size.width.toDouble(),
          box.size.height.toDouble() / 1.6,
          10,
          10,
        ),

eyale avatar Jul 26 '22 10:07 eyale

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days

github-actions[bot] avatar Dec 28 '22 00:12 github-actions[bot]