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

패키지 상세v2.1.4

flutter_social_share_plugin

소셜 미디어에 콘텐츠를 공유하기 위한 플러터 플러그인입니다. Facebook, WhatsApp, Twitter, SMS, 메일 및 시스템 공유 UI로 공유할 수 있습니다. URL과 텍스트를 지원합니다.

AndroidiOS
30일 다운로드
967
좋아요
16
Pub 점수
140

패키지 설치

flutter pub add flutter_social_share_plugin

패키지 개요

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

텍스트와 URL을 Facebook, WhatsApp, Twitter, SMS, 이메일 및 시스템 공유 UI와 같은 소셜 미디어 플랫폼에 쉽게 공유할 수 있는 Flutter 플러그인입니다. 안드로이드 및 iOS용으로 설계되어 네이티브 공유 기능과의 통합을 간소화합니다. 플러그인은 다양한 플랫폼 간 일관된 인터페이스를 제공하여 개발자가 최소한의 코드로 공유 기능을 구현할 수 있도록 합니다. 주요 채널을 통해 빠르게 콘텐츠를 배포해야 하는 앱에 적합합니다.

사용 사례

  • 기사에서 링크 공유하기
  • 소셜 미디어에서 콘텐츠 홍보하기
  • WhatsApp를 통해 메시지 보내기
  • 사용자에게 이메일 콘텐츠 보내기
  • 시스템 공유 대화 상자 사용

주요 기능

  • 여러 플랫폼을 지원합니다
  • 텍스트 및 URL 공유
  • 내장 공유 기능과 통합됩니다
  • 공유용 간단한 API
  • 크로스 플랫폼 호환성

적합한 대상

  • 콘텐츠 앱
  • 뉴스 리더
  • 전자상거래 앱
  • 소셜 미디어 도구
  • 사용자 참여 기능

고려 사항

  • 플랫폼별 설정이 필요합니다
  • 공유 대화 상자의 사용자 정의가 제한적
  • 대상 플랫폼용 앱 설치에 따라 다름
  • 이미지 공유 지원 없음
  • 일부 기기에서는 사용자 권한이 필요할 수 있습니다

원본 README

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

flutter_social_share_plugin

pub package style: lint

Flutter Plugin for sharing contents to social media.

You can use it share to Facebook , Instagram , WhatsApp(WhatsAppBusiness) , Twitter, Telegram,Sms,Mails And System Share UI. Support Url and Text.

support:

  • Android & iOS : Facebook,WhatsApp(WhatsAppBusiness),Twitter,Instagram,System Share,Sms,Mails

Note: This plugin is still under development, and some APIs might not be available yet.
Feedback and Pull Requests are most welcome!

Getting Started

add flutter_social_share_plugin as a dependency in your pubspec.yaml file.

Please check the latest version before installation.

dependencies:
  flutter:
    sdk: flutter
  # add flutter_social_share_plugin
  flutter_social_share_plugin: ^2.1.3

Setup

Android
Setup Whatsapp

Make sure you add whatsapp in AndroidManifest.xml.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
...
    <queries>
        <package android:name="com.whatsapp" />
    </queries>
...
</manifest>
Setup SMS

Make sure you add SMS in AndroidManifest.xml.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
...
    <uses-permission android:name="android.permission.SEND_SMS" />
...
</manifest>
Setup Instagram

Make sure you add SMS in AndroidManifest.xml.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
...
    <application>
...
   <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths" />
        </provider>
...
    </application>
...
</manifest>
IOS
setup facebook

Add below value in url scheme(Refer to example).

<key>LSApplicationQueriesSchemes</key>
	<array>
		<string>fbauth2</string>
		<string>fb</string>
		<string>fbapi</string>
		<string>fbapi20130214</string>
		<string>fbapi20130410</string>
		<string>fbapi20130702</string>
		<string>fbapi20131010</string>
		<string>fbapi20131219</string>
		<string>fbapi20140410</string>
		<string>fbapi20140116</string>
		<string>fbapi20150313</string>
		<string>fbapi20150629</string>
		<string>fbapi20160328</string>
		<string>fbauth</string>
		<string>fb-messenger-share-api</string>
		<string>fbauth2</string>
		<string>fbshareextension</string>
		<string>tg</string>
	</array>
Setup Whatsapp

Make sure you add whatsapp in plist.

<key>LSApplicationQueriesSchemes</key>
        <array>
            <string>whatsapp</string>
        </array>
Setup Twiter
<key>LSApplicationQueriesSchemes</key>
        <array>
            <string>twitter</string>
        </array>
Setup SMS
<key>LSApplicationQueriesSchemes</key>
        <array>
            <string>sms</string>
        </array>

Usage

Add the following imports to your Dart code:
import 'package:flutter_social_share_plugin/flutter_social_share_plugin.dart';

Methods

facebook
shareToFacebook({String msg, String imagePath})
Instagram
shareToInstagram({String filePath})
twitter
shareToTwitter({String msg, String url})
whatsapp
shareToWhatsApp({String msg,String imagePath})
shareToWhatsApp4Biz({String msg,String imagePath}) (only android)
telegram
shareToTelegram({String msg})
Sms
shareToSms({String msg})
mail
shareToMail({required String mailBody,String mailSubject,List mailRecipients})
system
shareToSystem({String msg}) use system share ui

These methods will return "success" if they successfully jump to the corresponding app.

Parameter Description
String msg Text message
String url Url url
String imagePath The local path of the image
String mailBody Text mail Body
String mailSubject Text Mail subject
List mailRecipients List of string for mail recipients

Example

   Container(
          width: double.infinity,
          child: Column(
            children: <Widget>[
              const SizedBox(height: 30),
              ElevatedButton(onPressed: pickImage, child: Text('Pick Image')),
              ElevatedButton(onPressed: pickVideo, child: Text('Pick Video')),
              ElevatedButton(
                  onPressed: () => onButtonTap(Share.twitter),
                  child: const Text('share to twitter')),
              ElevatedButton(
                onPressed: () => onButtonTap(Share.whatsapp),
                child: const Text('share to WhatsApp'),
              ),
              ElevatedButton(
                onPressed: () => onButtonTap(Share.whatsapp_business),
                child: const Text('share to WhatsApp Business'),
              ),
              ElevatedButton(
                onPressed: () => onButtonTap(Share.facebook),
                child: const Text('share to  FaceBook'),
              ),
              ElevatedButton(
                onPressed: () => onButtonTap(Share.share_instagram),
                child: const Text('share to Instagram'),
              ),
              ElevatedButton(
                onPressed: () => onButtonTap(Share.share_telegram),
                child: const Text('share to Telegram'),
              ),
              ElevatedButton(
                onPressed: () => onButtonTap(Share.share_system),
                child: const Text('share to System'),
              ),
              ElevatedButton(
                onPressed: () => onButtonTap(Share.share_sms),
                child: const Text('share to sms'),
              ),
              ElevatedButton(
                onPressed: () => onButtonTap(Share.share_mail),
                child: const Text('share to mail'),
              ),
            ],
          ),
        ),

Contributor

Checkout the full example here

카테고리

소스 저장소

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

아직 데이터가 없습니다.