पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

flutter_share कवर
पैकेज विवरणv2.0.0

flutter_share

Android और iOS के लिए अपने Flutter ऐप से संदेश, लिंक या फ़ाइलों को साझा करने का सरल तरीका (एंटर दबाकर कुछ गिफ़ देखें)।

AndroidiOS
30-दिन डाउनलोड
2.8 हज़ार
लाइक
306
Pub अंक
150

पैकेज इंस्टॉल करें

flutter pub add flutter_share

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

Flutter Share एक हल्का Flutter पैकेज है जो Android और iOS ऐप्स से संदेश, लिंक और फ़ाइलों को बेहतरीन तरीके से साझा करने में सक्षम बनाता है। यह मूल शेयरिंग इंटेंट को एकीकृत करने के लिए एक सरल API प्रदान करता है, जिससे उपयोगकर्ता सिस्टम डायलॉग के माध्यम से सामग्री साझा कर सकते हैं। पैकेज दोनों टेक्स्ट और फ़ाइल साझाकरण को समर्थन देता है, जिससे त्वरित साझाकरण कार्यक्षमता की आवश्यकता वाले ऐप्स के लिए आदर्श है। pub add के माध्यम से न्यूनतम सेटअप के साथ, यह प्लेटफॉर्म के बिना काम करता है और प्लेटफॉर्म-विशिष्ट कोड की आवश्यकता नहीं होती है। स्रोत कोड GitHub पर खुला है, जिससे पारदर्शिता और समुदाय योगदान को बढ़ावा मिलता है।

उपयोग

  • सोशल मीडिया में लिंक साझा करना
  • संदेश ऐप्स में टेक्स्ट स्निपेट भेजना
  • चित्र या दस्तावेज़ जैसे फ़ाइलों का निर्यात करना
  • उपयोगकर्ता-उत्पादित सामग्री साझाकरण सक्षम करें
  • ऐप के सोशल फीचर्स के साथ एकीकरण

मुख्य विशेषताएँ

  • क्रॉस-प्लेटफॉर्म समर्थन (Android और iOS)
  • पाठ और फ़ाइलों के साझा करने के लिए सरल API
  • मूल साझा डायलॉग
  • ओपन-सोर्स, गिटहब रिपॉजिटरी के साथ
  • आवश्यक न्यूनतम कॉन्फ़िगरेशन

इनके लिए उपयुक्त

  • मूल शेयरिंग कार्यक्षमता की आवश्यकता वाले ऐप्स
  • सोशल या सामग्री साझा करने वाले ऐप्स
  • फ़ाइल प्रबंधन या उत्पादकता टूल्स
  • आसान एकीकरण की तलाश में विकासकर्ता
  • सरलता और विश्वसनीयता पर ध्यान केंद्रित परियोजनाएँ

विचार योग्य बातें

  • Android और iOS प्लेटफॉर्म के लिए सीमित
  • शेयर करने के लिए उपयोगकर्ता इंटरैक्शन की आवश्यकता होती है
  • कोई उन्नत कस्टमाइजेशन विकल्प नहीं हैं
  • मूल ओएस साझाकरण तंत्र पर निर्भर करता है
  • विशिष्ट एप्स में साझा करने का समर्थन नहीं करता है

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

Share Plugin

pub package

** This plugin was discontinued after the flutter official one add support to files **

A Flutter plugin for IOS and Android providing a simple way to share a message, link or local files.

Features:

  • Share messages and/or link urls.
  • Share local files.

android         ios

Installation

First, add flutter_share as a dependency in your pubspec.yaml file.

iOS

Add if not exists one row to the ios/podfile after target runner:

...

target 'Runner' do
    use_frameworks!

...
Android

If you pretends to use the file share, you need to configure the file provider, this will give access to the files turning possible to share with other applications.

Add to AndroidManifest.xml:

<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/provider_paths"/>
</provider>
</application>

Obs: You can change the android:name if you have an extension of file provider.

Add res/xml/provider_paths.xml:

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

If you want to learn more about file provider you can access:

  • https://developer.android.com/reference/android/support/v4/content/FileProvider
Example

Here is an example flutter app displaying the two shares methods. (I'm using documents_picker just to get a local file you don't need to use.)

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:flutter_share/flutter_share.dart';
import 'package:documents_picker/documents_picker.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  Future<void> share() async {
    await FlutterShare.share(
      title: 'Example share',
      text: 'Example share text',
      linkUrl: 'https://flutter.dev/',
      chooserTitle: 'Example Chooser Title'
    );
  }

  Future<void> shareFile() async {
    List<dynamic> docs = await DocumentsPicker.pickDocuments;
    if (docs == null || docs.isEmpty) return null;

    await FlutterShare.shareFile(
      title: 'Example share',
      text: 'Example share text',
      filePath: docs[0] as String,
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              FlatButton(
                child: Text('Share text and link'),
                onPressed: share,
              ),
              FlatButton(
                child: Text('Share local file'),
                onPressed: shareFile,
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Feedback welcome and Pull Requests are most welcome!

श्रेणियाँ

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट