-
Notifications
You must be signed in to change notification settings - Fork 144
Wrong Share modal position on tablet (iPad OS) #40
Description
Describe the bug
When I click on the button that triggers share action, on iPad OS (and, perhaps, on Android tablets?) the Share modal window appears, but it's located far from the actual button, and there is no way to specify position.
To Reproduce
Create Scaffold with action button that triggers Share action with this plugin. Run on iPad. Click on the button (which is on the top right side), and observe Share modal window appear in the top left corner.
Expected behavior
Share modal window appears close to the button that triggered the action.
Additional context
In the official Share plugin they have parameter for specifying the origin. It worked fine for me, when I was using that plugin: https://github.com/flutter/plugins/blob/master/packages/share/example/lib/main.dart#L69
Builder(
builder: (BuildContext context) {
return RaisedButton(
child: const Text('Share'),
onPressed: text.isEmpty
? null
: () {
// A builder is used to retrieve the context immediately
// surrounding the RaisedButton.
//
// The context's `findRenderObject` returns the first
// RenderObject in its descendent tree when it's not
// a RenderObjectWidget. The RaisedButton's RenderObject
// has its position and size after it's built.
final RenderBox box = context.findRenderObject();
Share.share(text,
subject: subject,
sharePositionOrigin:
box.localToGlobal(Offset.zero) &
box.size);
},
);
},