Um plugin Flutter para compartilhar conteúdo, imagens e vídeos em plataformas de mídia social como Facebook, Twitter, LinkedIn, WhatsApp, Reddit e Telegram.
Orientação gerada a partir de informações públicas. Apenas para referência.
Um plugin Flutter que permite compartilhar textos, imagens e vídeos de forma transparente para plataformas sociais populares, incluindo Facebook, Twitter, LinkedIn, WhatsApp, Reddit e Telegram. Projetado para Android e iOS, simplifica a integração social multiplataforma com uma API consistente. O plugin gerencia intenções nativas de compartilhamento específicas da plataforma e fornece acesso confiável aos diálogos nativos de compartilhamento. Suporta tanto compartilhamentos simples quanto configurações avançadas, como mensagens personalizadas e links profundos.
Casos de uso
Compartilhando conteúdo do aplicativo em redes sociais
Incorporar compartilhamento social em conteúdo gerado pelo usuário
Integração com recursos de comunidade ou feedback
Habilitar a distribuição rápida de conteúdo dentro dos aplicativos
Apoio à divulgação social multiplataforma
Principais recursos
Suporte multiplataforma para Android e iOS
diálogos nativos de compartilhamento nas plataformas-alvo
Suporte para texto, imagens e vídeos
Integração fácil com configuração mínima
Gerencia comportamentos específicos da plataforma para compartilhamento
Extensível para adições futuras de mídias sociais
Indicado para
Aplicativos que precisam de funcionalidade de compartilhamento social
aplicações orientadas por conteúdo
Ferramentas de engajamento do usuário
Aplicativos móveis voltados para públicos globais
Desenvolvedores procurando soluções leves de compartilhamento
Considerações
Requer configuração específica da plataforma (por exemplo, entradas no manifesto do Android)
Limitado a plataformas e aplicativos compatíveis
Pode exigir permissão do usuário em alguns dispositivos
Depende de aplicativos externos estarem instalados
Sem análise integrada para eventos de compartilhamento
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
social_sharing_plus is a Flutter plugin that allows you to share content, images and videos to various social media platforms like Facebook, Twitter, LinkedIn, WhatsApp, Reddit, and Telegram. This package provides a simple and unified interface for sharing across different apps, handling the nuances and differences of each platform.
🚀 Exciting News! You can now share multiple images and videos with text(optional)! 📸🎥
social_sharing_plus is supported on Android and iOS platforms. On the Android side, queries are made with the package names of the respective apps. This requires the addition of some Android-specific code.
Android (click to expand)
Add queries for app packages
You need to add the following queries to your app's AndroidManifest.xml file to ensure proper redirection to the respective social media apps:
<manifestxmlns:android="http://schemas.android.com/apk/res/android"package="com.example.myapp"><queries><!-- Query for Facebook --><packageandroid:name="com.facebook.katana" /><!-- Query for Twitter --><packageandroid:name="com.twitter.android" /><!-- Query for LinkedIn --><packageandroid:name="com.linkedin.android" /><!-- Query for Reddit --><packageandroid:name="com.reddit.frontpage" /><!-- Query for WhatsApp --><packageandroid:name="com.whatsapp" /><!-- Query for Telegram --><packageandroid:name="org.telegram.messenger" /></queries><application><!-- ... --></application></manifest>
Media Sharing and Media Provider
This provides a specific file provider so that it can share files with other applications. To provide this functionality, you need to create an XML folder under the android>app>src>main>res folder and name it filepaths.xml. Then add the following code to the filepaths.xml file:
This <provider> tag specifies the authorization of your file provider and what file paths it provides. The android:authorities attribute specifies the identity of your file provider, and the ${applicationId}.fileprovider value uses your application's credentials. This ensures the security of your application while allowing other applications to access files.
iOS (click to expand)
No special configuration is needed for iOS.
dependencies:social_sharing_plus:^1.2.3
Usage
import'package:social_sharing_plus/social_sharing_plus.dart';
staticconstSocialPlatform platform = SocialPlatform.facebook;
String? _mediaPath; // add image or video pathList<String> _mediaPaths = []; // add image or video pathsbool isMultipleShare = true;
isMultipleShare
? awaitSocialSharingPlus.shareToSocialMediaWithMultipleMedia(
platform,
media: _mediaPaths,
content: content,
isOpenBrowser: false,
onAppNotInstalled: () {
ScaffoldMessenger.of(context)
..hideCurrentSnackBar()
..showSnackBar(SnackBar(
content: Text('${platform.name.capitalize} is not installed.'),
));
},
)
: awaitSocialSharingPlus.shareToSocialMedia(
platform,
content,
media: _mediaPath,
isOpenBrowser: true,
);
Properties
shareToSocialMedia:
Properties
Required
Default
Description
socialPlatform
true
Platform you want to share on
content
true
Any text you want to share
media
false
The image or video you want to share
isOpenBrowser
false
true
If the relevant application is not installed, it redirects to the link (browser) of the relevant application.
onAppNotInstalled
false
This method works if the application is not installed and the isOpenBrowser value is set to false. (For example: Showing a Snackbar like "The application is not installed on your device."...)
shareToSocialMediaWithMultipleMedia:
Properties
Required
Default
Description
socialPlatform
true
Platform you want to share on
content
false
Any text you want to share
media
true
The image or video you want to share
isOpenBrowser
false
true
If the relevant application is not installed, it redirects to the link (browser) of the relevant application.
onAppNotInstalled
false
This method works if the application is not installed and the isOpenBrowser value is set to false. (For example: Showing a Snackbar like "The application is not installed on your device."...)
Screenshots
Dart Version
sdk:'>=2.17.0 <4.0.0'
Issues
Please file any issues, bugs, or feature requests as an issue on our GitHub page.
Contribute
If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug, or adding a cool new feature), please carefully review our contribution guide and send us your pull request.
Author
This social_sharing_plus plugin for Flutter is developed by Bedirhan Sağlam. You can contact me at <bedirhansaglam270@gmail.com>