• Stars
    star
    151
  • Rank 246,057 (Top 5 %)
  • Language
    Swift
  • License
    Apache License 2.0
  • Created almost 6 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Flutter Plugin for sharing contents to social media. You can use it share to Facebook , WhatsApp , Twitter And System Share UI. Support Url and Text.

flutter_share_me

pub package style: lint

Flutter Plugin for sharing contents to social media.

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

support:

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

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_share_me as a dependency in your pubspec.yaml file.

Please check the latest version before installation.

dependencies:
  flutter:
    sdk: flutter
  # add flutter_share_me
  flutter_share_me: ^0.11.0

Setup

Android

Add "facebook app id" to the application tag of AndroidManifest.xml

    <application>
       ...
       //add this 
        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />
            
        <provider
            android:name="com.facebook.FacebookContentProvider"
            android:authorities="com.facebook.app.FacebookContentProvider[facebook_app_id]"
            android:exported="false" />
    </application>

string.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Replace "343254889799245" with your Facebook App ID here. -->
    <string name="facebook_app_id">343254889799245</string>
</resources>

IOS

setup facebook

make sure you add below deatils in your plist file.

<key>FacebookAppID</key>
<string>fbid</string>
<key>CFBundleURLTypes</key>
	<array>
		<dict>
			<key>CFBundleURLSchemes</key>
			<array>
				<string>fb-your-fb-id</string>
			</array>
		</dict>
	</array>

Note-: Make sure you add fb in at start of your fb Id in CFBundleURLSchemes.

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

	<array>
		<string>fbauth2</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.

        <array>
            <string>whatsapp</string>
        </array>

Setup Twiter

        <array>
            <string>twitter</string>
        </array>

Usage

Add the following imports to your Dart code:

import 'package:flutter_share_me/flutter_share_me.dart';

Methods

facebook

shareToFacebook({String msg, String url})

twitter

shareToTwitter({String msg, String url})

whatsapp

shareToWhatsApp({String msg,String imagePath})

shareToWhatsApp4Biz({String msg,String imagePath}) (only android)

shareWhatsAppPersonalMessage(String message ,String phoneNumber)

instagram

shareToInstagram({String filePath, FileType fileType})

telegram

shareToTelegram({String msg})

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

Example

 Container(
          width: double.infinity,
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              SizedBox(height: 30),
              ElevatedButton(
                  onPressed: () => onButtonTap(Share.twitter),
                  child: Text('share to twitter')),
              ElevatedButton(
                onPressed: () => onButtonTap(Share.whatsapp),
                child: Text('share to WhatsApp'),
              ),
              ElevatedButton(
                onPressed: () => onButtonTap(Share.whatsapp_business),
                child: Text('share to WhatsApp  Business'),
              ),
              ElevatedButton(
                onPressed: () => onButtonTap(Share.facebook),
                child: Text('share to  FaceBook'),
              ),
              ElevatedButton(
                onPressed: () => onButtonTap(Share.share_system),
                child: Text('share to System'),
              ),
            ],
          ),
        )

Checkout the full example here

More Repositories

1

Flutter-Notebook

FlutterDemo合集,今天你fu了吗
Dart
7,138
star
2

flutter_screenutil

Flutter screen adaptation, font adaptation, get screen information
Dart
3,883
star
3

fluwx

Flutter版微信SDK.WeChat SDK for flutter.
Dart
3,059
star
4

tobias

AliPay For Flutter.支付宝Flutter插件
Objective-C
678
star
5

PullToRefresh

Flutter相关的项目QQ:277155832 Email:[email protected]
Dart
472
star
6

k_chart

Maybe it is the best k chart in Flutter.
Dart
459
star
7

flutter_oktoast

a pure flutter toast library
Dart
457
star
8

Pangolin

🐾 Flutter 广告SDK-字节跳动-穿山甲 集成
Java
332
star
9

OpenFlutter

Love flutter love life.QQ群:892398530
301
star
10

flutter_listview_loadmore

flutter loadmore demos
Dart
242
star
11

nautilus

阿里百川电商Flutter插件。
Objective-C
130
star
12

mini_calendar

Date component developed with Flutter, plans to support display, swipe left and right, add date mark, radio, display week, etc.
Dart
114
star
13

mmkv_flutter

get or set persistent storage value based on MMKV framework.
Dart
101
star
14

flutter_im_demo

📞 Flutter 使用 MQTT实现IM功能
Dart
82
star
15

flutter_gesture_password

flutter_gesture_password
Dart
78
star
16

rammus

Flutter Plugin for AliCloud Push.阿里云推送插件
Kotlin
77
star
17

neeko

Flutter video player widget based on video_player
Dart
70
star
18

FlutterInAction

Flutter In Action.Flutter实践。
46
star
19

flutter_ok_image

a flutter image widget to load image.
Dart
40
star
20

flutter_database_demo

🛠 Flutter 本地数据库存储 + 状态管理
Dart
35
star
21

sona

@Deprecated Not maintained. Developers who need Getui push please visit official plugins
Objective-C
35
star
22

tencent_cos

Flutter plugin for cos
Java
23
star
23

flutter_paging

Paging like android jetpack
Dart
11
star
24

flutter_navigation_bar

解决官方例子会不停销毁重建的问题
Dart
10
star
25

kart

A kotlin-style extension collection for dart.
Dart
7
star
26

flutter_ali_face_verify

Flutter plugin for Ali face verify
Dart
1
star