-
-
Notifications
You must be signed in to change notification settings - Fork 992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: sharePositionOrigin crash although a valid Rect is being used #3338
Comments
Not really, 701 + 92 > 768 so it is out of bounds according to the logs. If the See: plus_plugins/packages/share_plus/share_plus/ios/share_plus/Sources/share_plus/FPPSharePlusPlugin.m Lines 373 to 394 in d6a45b6
|
@miquelbeltran I was assuming the coordinates from the error log were the corners of the Rect. Any suggestion for a better way to get a valid sharePositionOrigin? I'd prefer not to give a static Rect in the middle of the screen but a Rect close to the widget that was clicked. |
I think wrapping the target widget with a builder and obtaining the coordinates from the inmediate render object, just like the example project. |
This is what I am currently doing (wrapping with a Builder) but I get the crash reports so it seems this approach does not work in all cases. |
1024 x 768 (which was is reported as the controller.view in the iOS obj-c code) look like iPad mini & 2nd Gen iPads. Can you try your app on a simulator for those smaller devices? edit: Do you have the device model from the error report? Also iPads can split-screen if I remember correctly. I'd try playing with that see if a specific resolution breaks the share functionality. |
@miquelbeltran I have managed to reproduce this by placing the share button in a scroll view at the edge of the screen. I've updated the code that computes the sharePositionOrigin to fall back to a rectangle in the middle of the screen if the computed rectangle does not fit the available screen.
|
Platform
iPadOS 17.6.1, macOS 18
Plugin
share_plus
Version
10.1.0
Flutter SDK
3.24.2
Steps to reproduce
I'm getting crash reports but I cannot reproduce it on my own. It works correctly on the iPad simulators. The sharePositionOrigin Rect that I am sending is within bounds (as you can see in the error messages) but the error happens nonetheless.
Here are some examples of errors:
MethodChannelShare.shareXFiles:
PlatformException(error, sharePositionOrigin: argument must be set, {{222, 739}, {300, 92}} must be non-zero and within coordinate space of source view: {{0, 0}, {1133, 744}}, null, null)
MethodChannelShare.shareFilesWithResult:
PlatformException(error, sharePositionOrigin: argument must be set, {{362, 701}, {300, 92}} must be non-zero and within coordinate space of source view: {{0, 0}, {1024, 768}}, null, null)
Code Sample
Logs
Flutter Doctor
Checklist before submitting a bug
flutter pub upgrade
flutter clean
The text was updated successfully, but these errors were encountered: