搜尋套件、儲存庫與 APP 分類

share_social_network 封面
套件詳情v1.2.9

share_social_network

一個即用型平台,提供多種分享方式,您需要直接為某些流行的應用程式提供存取權限,或僅使用內建的預設分享功能進行分享。

AndroidiOS
近 30 天下載
16
喜歡數
26
Pub 分數
105

安裝套件

flutter pub add share_social_network

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

share_social_network 套件提供了一種簡單的方式,將分享功能整合到 Flutter 應用中,讓使用者能夠跨主流社交平台分享內容,或使用系統的預設分享選項。它簡化了在 Android 與 iOS 上存取原生分享意圖的過程,減少重複程式碼。開發者可輕鬆觸發分享,設定極少,支援直接應用特定分享與一般系統層級分享。此套件非常適合需要快速、可靠分享功能卻無需複雜設定的應用。

適用情境

  • 在社交媒體應用內分享連結或文字
  • 啟用使用者產生內容分發
  • 整合預設系統分享對話方塊
  • 支援跨平台共享工作流程
  • 在應用介面中添加分享按鈕

主要特色

  • 與 Flutter 的簡單整合
  • 對 Android 和 iOS 的支援
  • 直接存取熱門社交應用
  • 回退到系統預設共享
  • 最小配置要求

適合對象

  • 需要基本共享功能的應用
  • 尋求快速共享實現的開發者
  • 跨平台移動應用
  • 社群媒體整合
  • 內容共享平台

使用建議

  • 共享介面的自訂功能有限
  • 取決於設備上安裝的社交應用
  • 分享無內建分析功能
  • 某些平台需要適當的權限
  • 可能不支援所有小眾社交網路

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Share Social Network

pub package

A ready-made platform that provides a wide range of ways to share, you will need to provide access directly to certain popular applications or just share using the built-in default sharing.

Platforms

Works on both platforms Android and iOS

Image Image Image
Video Photo Video

Initial settings

Android Configuration
Paste the following attribute in the AndroidManifest.xml tag in the android/app/src/main/AndroidManifest.xml:
 		`xmlns:tools="http://schemas.android.com/tools"`
For example:
        <manifest xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:tools="http://schemas.android.com/tools"
         package...
Create a xml file named filepaths.xml in the app/src/main/res/xml folder and paste this code in the file :
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <cache-path name="image" path="/"/>
</paths>
Add this code snippet to the very bottom manifest/application in the android/app/src/main/AndroidManifest.xml insert after meta-data:
 		     <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.com.weeidl.share_social_network"
            android:exported="false"
            android:grantUriPermissions="true"
            tools:replace="android:authorities">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/filepaths" />
        </provider>
iOS Configuration
Add this to your Info.plist to use share on instagram and facebook story
<key>LSApplicationQueriesSchemes</key>
	<array>
	<string>instagram-stories</string>
	<string>facebook-stories</string>
	<string>facebook</string>
	<string>instagram</string>
	<string>twitter</string>
	<string>whatsapp</string>
 <string>tg</string>
	</array>
Add this if you are using share on facebook. For this you have to create an app on https://developers.facebook.com/ and get the App ID
<key>FacebookAppID</key>
<string>xxxxxxxxxxxxxxx</string>

Getting Started

Add the package to your pubspec.yaml:

   share_social_network: ^1.2.9

In your dart file, import the library:

    import 'package:share_social_network/share_social_network.dart';

Instead of using a ShareSocialNetwork use ShareSocialNetwork.show Widget:

  ShareSocialNetwork.show(
    context: context,
    backgroundColor: Colors.white,
    pillColor: Colors.black12,
    transitionDuration: Duration(milliseconds: 300),
    screenshotController: screenshotController,
    copyToClipboard: "https://github.com/weeidl/share_social...",
    telegram: Telegram(
      content: "Hello World \n https://github.com/weeidl",
    ),
    instagram: Instagram(
      backgroundBottomColor: "#FF7391",
      backgroundTopColor: "#591E78",
      attributionURL: "https://deep-link-url",
      imagePath: imagePath,
    ),
    facebook: Facebook(
      backgroundTopColor: "#ffffff",
      attributionURL: "https://github.com/weeidl",
      backgroundBottomColor: "#000000",
      imagePath: imagePath,
      appId: "xxxxxxxxxxxxx",
    ),
    more: More(
      message: 'Hello World \n https://github.com/weeidl',
    ),
    twitter: Twitter(
      captionText: 'Share twitter',
      hashtags: ["hello", "world", "weeild", "artur"],
      url: 'https://github.com/weeidl',
      trailingText: " \nweeidl",
    ),
    whatsapp: Whatsapp(
      content: 'Hello World \n https://github.com/weeidl',
    ),
  );
 }
Example:

Example of how to send something to instagram:

ScreenshotController screenshotController = ScreenshotController();
void shareSocialNetwork(BuildContext context) async {
  String imagePath = await screenshotController.capture().then((image) async {
    final directory = await getApplicationDocumentsDirectory();
    final file = await File('${directory.path}/temp.png').create();
    await file.writeAsBytes(image!);
    return file.path;
  });
  ShareSocialNetwork.show(
    context: context,
    backgroundColor: Colors.white,
    pillColor: Colors.black12,
    transitionDuration: Duration(milliseconds: 300),
    screenshotController: screenshotController,
    copyToClipboard: "https://github.com/weeidl/share_social...",
    instagram: Instagram(
      backgroundBottomColor: "#FF7391",
      backgroundTopColor: "#591E78",
      attributionURL: "https://deep-link-url",
      imagePath: imagePath,
    ),
  );
}
Follow Me:

instagram Telegram LinkedIn GitHub

所屬分類

依賴

依賴清單 3 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。