패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.4.2+2

social_share_plugin

Facebook 및 Instagram으로 소셜 공유를 위한 Flutter 플러그인.

AndroidiOS
30일 다운로드
10
좋아요
48
Pub 점수
150

패키지 설치

flutter pub add social_share_plugin

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

social_share_plugin은 Android 및 iOS 앱에서 Facebook과 Instagram으로 콘텐츠를 직접 공유할 수 있도록 해주는 Flutter 패키지입니다. 소셜 미디어 공유 기능의 통합을 단순화하여 사용자가 최소한의 코드로 텍스트, 이미지 또는 링크를 공유할 수 있게 합니다. 플러그인은 네이티브 플랫폼 기능을 활용하여 호환성과 원활한 사용자 경험을 보장합니다. 복잡한 설정 없이 간단한 소셜 공유를 원하는 개발자를 위한 것입니다. 이 패키지는 오픈소스이며 GitHub에서 유지 관리되며 주요 두 가지 모바일 플랫폼을 지원합니다.

사용 사례

  • Instagram에 이미지 공유하기
  • Facebook에 링크 게시하기
  • 사진 앱에 소셜 공유 통합
  • 빠른 콘텐츠 배포 활성화
  • 모바일 앱에 공유 버튼 추가하기

주요 기능

  • 네이티브 안드로이드 및 iOS 지원
  • 텍스트와 이미지를 공유하기 위한 간단한 API
  • 페이스북 및 인스타그램과의 직접 통합
  • 오픈소스이며 커뮤니티가 유지 관리함
  • 가볍고 통합하기 쉬움

적합한 대상

  • 모바일 앱 개발자
  • 소셜 미디어 통합기
  • 콘텐츠 공유 기능
  • Android 및 iOS를 대상으로 하는 크로스 플랫폼 앱
  • 최소한의 제3자 종속성을 필요로 하는 앱

고려 사항

  • Facebook 및 Instagram의 네이티브 SDK가 필요합니다
  • 안드로이드 및 iOS 플랫폼에 제한됨
  • 이미지 접근을 위해 추가 권한이 필요할 수 있습니다
  • 외부 앱의 사용 가능 여부에 따라 달라집니다 (예: Instagram 설치됨)
  • Facebook 및 Instagram 외 다른 소셜 플랫폼에 대한 지원 없음

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Social Share Flutter Plugin

Puff Puff Dev Puff Puff Dev

Developed with 💙 by

Pub coverage style: very good analysis License: MIT

Social Share to Facebook and Instagram and Twitter.

Getting Started

To get things up and running, you'll have to declare a pubspec dependency in your Flutter project. Also some minimal Android & iOS specific configuration must be done, otherise your app will crash.

Open or Create your Flutte Project

See the installation instructions on pub.

Android

In addition, you need to do the following:

For details on these requirements, see Android - Getting Started.

After you've done that, find out what your Facebook App ID is. You can find your Facebook App ID in your Facebook App's dashboard in the Facebook developer console.

Once you've got the Facebook App ID, you'll have to do couple of preparation moves.

Add permission to allow package manager query if app is installed, should be added to the manifest root tag

<uses-permission android:name="android.permission.GET_PACKAGE_SIZE"/>

Add queries as childs of manifest root tag also

<queries>
   <package android:name="com.twitter.android" />
   <package android:name="com.facebook.katana" />
   <package android:name="com.instagram.android" />
</queries>

I prefer to pass this ID to manifest throght gradle manifestPlaceholders. You can choose any way you like, just to be sure put the ID in correct places, like in example below. Put all these inside the application tag and your Facebook App ID instead of ${facebookAppId} variable

<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="${facebookAppId}"/>

<meta-data android:name="com.facebook.sdk.ApplicationName" android:value="${applicationName}"/>

<activity android:name="com.facebook.FacebookActivity" android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="${applicationName}" />

<provider android:authorities="com.facebook.app.FacebookContentProvider${facebookAppId}" android:name="com.facebook.FacebookContentProvider" android:exported="true"/>

<provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.social.share.fileprovider" android:grantUriPermissions="true" android:exported="false">
    <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths"/>
</provider>

Need to add these variables to string resources as well, i've added them from gradle with resValue.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">Example</string>
    <!-- Replace "000000000000" with your Facebook App ID here. Same to the secret -->
    <string name="facebook_app_id">000000000000</string>
    <string name="facebook_client_token">00000000000000000000000000000000</string>
</resources>

And the last one is our provider paths:

<your project root>/android/app/src/main/res/xml/provider_paths.xml

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    
    <cache-path
        name="cache_files"
        path="/"/>
</paths>

iOS

Before you add sharing to your app you need to:

  • Add the Facebook SDK for iOS to your mobile development environment
  • Configure and link your Facebook app ID
  • Add your app ID, display name, and human-readable reason for photo access to your app's .plist file.

After you've done that, find out what your Facebook App ID is. You can find it out in your Facebook App's dashboard in the Facebook developer console.

Once you've got the ID, then you'll just have to copy-paste the following to your Info.plist file, before the ending </dict></plist> tags.

<your project root>/ios/Runner/Info.plist

<key>CFBundleURLTypes</key>
<array>
   <dict>
       <key>CFBundleURLSchemes</key>
       <array>
           <!--
           Replace "000000000000" with your Facebook App ID here.
           **NOTE**: The scheme needs to start with `fb` and then your ID.
           -->
           <string>fb000000000000</string>
       </array>
   </dict>
</array>

<key>FacebookAppID</key>

<!-- Replace "000000000000" with your Facebook App ID here. -->
<string>000000000000</string>
<key>FacebookDisplayName</key>

<!-- Replace "YOUR_APP_NAME" with your Facebook App name. -->
<string>YOUR_APP_NAME</string>

<key>LSApplicationQueriesSchemes</key>
<array>
   <string>instagram</string>
   <string>fbapi</string>
   <string>fb-messenger-share-api</string>
   <string>fbauth2</string>
   <string>fbshareextension</string>
   <string>twitter</string>
</array>

Congratulations! We've just finished setup!!

How do I use it?

Instagram
import 'package:social_share_plugin/social_share_plugin.dart';
File file = await imagePicker.pickImage(source: ImageSource.gallery);
await shareToFeedInstagram(path: file.path);
Facebook
import 'package:social_share_plugin/social_share_plugin.dart';
final file = await imagePicker.pickImage(source: ImageSource.gallery);
await shareToFeedFacebook(path: file.path);
await shareToFeedFacebookLink(quote: 'quote', url: 'https://flutter.dev');
Twitter
import 'package:social_share_plugin/social_share_plugin.dart';
await shareToTwitterLink(text: 'text', url: 'https://flutter.dev');

That's it, thank you for paying attention!

Generated by the Very Good CLI 🤖

카테고리

의존성

의존성 목록 3 개

  • social_share_plugin_android^0.1.0+1
  • social_share_plugin_ios^0.1.0+1
  • social_share_plugin_platform_interface^0.1.0+1

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.