GithubHelp home page GithubHelp logo

isabella232 / wc_flutter_share Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 52inc/wc_flutter_share

0.0 0.0 0.0 195 KB

A Flutter plugin for sharing files & text with other applications.

License: Apache License 2.0

Kotlin 23.48% Ruby 22.78% Swift 20.89% Objective-C 4.06% Dart 28.79%

wc_flutter_share's Introduction

wc_flutter_share

A Flutter plugin for sharing file, text and subject at the same time with other applications on Android, iOS (iPhone, iPad).

Build Status Author

Note for iOS

Your flutter's iOS code needs to be in swift. Otherwise you will get error:

=== BUILD TARGET flutter_inappbrowser OF PROJECT Pods WITH CONFIGURATION Debug === The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 3.0, 4.0, 4.2. This setting can be set in the build settings editor.

Instead, if you have already a non-swift project, you can check this issue to solve the problem: Friction adding swift plugin to objective-c project.

Note for Android

Your android support libraries needs to be of androidx. If you want to migrate your android project to androidx, you can take help from Migrating to AndroidX

Usage

Import:

import 'package:wc_flutter_share/wc_flutter_share.dart';

Share text:

WcFlutterShare.share(  
    sharePopupTitle: 'Share',  
    subject: 'This is subject',  
    text: 'This is text',  
    mimeType: 'text/plain');

Share file only:

final ByteData bytes = await rootBundle.load('assets/wisecrab.png');  
await WcFlutterShare.share(
	sharePopupTitle: 'share',  
    fileName: 'share.png',  
    mimeType: 'image/png',  
    bytesOfFile: bytes.buffer.asUint8List());

Share file, text and subject:

final ByteData bytes = await rootBundle.load('assets/wisecrab.png');  
await WcFlutterShare.share(  
    sharePopupTitle: 'share',  
    subject: 'This is subject',  
    text: 'This is text',  
    fileName: 'share.png',  
    mimeType: 'image/png',  
    bytesOfFile: bytes.buffer.asUint8List());

Share on iPad:

      WcFlutterShare.share(
        sharePopupTitle: 'Share',
        subject: 'This is subject',
        text: 'This is text',
        mimeType: 'text/plain',
        iPadConfig: IPadConfig(
          originX: 0,
          originY: 0,
          originHeight: 0,
          originWidth: 0,
        ));

NOTE: You won't be able to share image and text simultaneously on some applications. It is not a bug of this plugin. Some applications don't support this. I have tested this on Skype, on which is working fine.

Check out the example app in the Repository for further information.

More from Wisecrab:

  • Form Validators: A plugin which provides utility functions to make form validation easy.

wc_flutter_share's People

Contributors

aarajput avatar grappetite-ali avatar katekko avatar r0adkll avatar stonega avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.