fluttercommunity / plus_plugins

Flutter Community Plus Plugins
BSD 3-Clause "New" or "Revised" License
1.55k stars 937 forks source link

[Bug]: Share.shareXFiles in Windows 11 return ShareResultStatus.unavailable #3177

Open zhahouming opened 1 month ago

zhahouming commented 1 month ago

Platform

Windows

Plugin

share_plus

Version

10.0.1

Flutter SDK

3.22.1

Steps to reproduce

I called Share.shareXFiles in Windows 11, but the result returned ShareResultStatus.unavailable.

Code Sample

No response

Logs

--

Flutter Doctor

[√] Flutter (Channel stable, 3.22.1, on Microsoft Windows [版本 10.0.22631.3958], locale zh-CN)
    • Flutter version 3.22.1 on channel stable at C:\dev\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a14f74ff3a (3 months ago), 2024-05-22 11:08:21 -0500
    • Engine revision 55eae6864b
    • Dart version 3.4.1
    • DevTools version 2.34.3
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[√] Windows Version (Installed version of Windows is version 10 or higher)

[X] Android toolchain - develop for Android devices
    • Android SDK at C:\Users\Administrator\AppData\Local\Android\sdk
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.3)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.7.34024.191
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2022.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)

[√] VS Code (version 1.80.0)
    • VS Code at C:\Users\Administrator\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.94.0

[√] Connected device (1 available)
    • Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.22631.3958]

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Checklist before submitting a bug

embroor commented 3 weeks ago

I am facing the same problem on windows

miquelbeltran commented 3 weeks ago

ShareResultStatus.unavailable is an expected result, it means that the share result cannot be determined.

Is there any other issue you are facing? Otherwise, I will close this ticket.

embroor commented 3 weeks ago

I am using the exact same code to share an image that I generated. shareXfiles is working perfectly on IOS Mac And Android. Only Windows gets me this message: ShareResultStatus.unavailable .

is there any explanation or can I do anything to fix it, please?

miquelbeltran commented 3 weeks ago

As explained, ShareResultStatus.unavailable is an expected output. Can you provide logs and explain exactly what happens?

embroor commented 3 weeks ago

First I am taking a screenshot through the package: ScreenShot :

final image = await _screenshotController.captureFromLongWidget( context: context, InheritedTheme.captureAll( context, FileMatchingContent( ), to: context, ), pixelRatio: 2, );

after that: iam using share_plus to share this image :

final Size size = MediaQuery.of(context).size; final results = await Share.shareXFiles( sharePositionOrigin: Rect.fromLTWH( 0, 0, size.width, size.height / 2, ), [ XFile.fromData( image, mimeType: "image/png", ), ], );

after that :

print(results.status);

===============================

I don't have any log except the print statement: ShareResultStatus.unavailable

Screenshot 2024-08-19 at 6 38 21 PM

this code works on every platform except windows.