modified_share 0.0.1 modified_share: ^0.0.1 copied to clipboard
A Flutter plugin that allows sharing text, images via popular Social Networks such as Facebook, WhatsApp, Instagram etc.
import 'package:flutter/material.dart';
import 'package:modified_share/modified_share.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
void callModifiedShare(bool onlyWhatsApp) async {
String imageURL = '', content = '';
imageURL =
'https://movieassetsnew.komparify.com/original/9e07b90cdca0e71d8ab6d23c997cba99024018ad';
content =
"Petta\n\nMore details here at Flixjini: https://in.flixjini.com/movie/petta?search_keyword=Petta \n\nCheck out Flixjini App at: https://in.flixjini.com";
Map<String, String> shareMessageDetails = {
"imageURL": imageURL,
"content": content,
};
if (onlyWhatsApp) {
String returnedString =
await ModifiedShare.shareViaWhatsApp(shareMessageDetails);
print(
'\n\nreturned string after invoking the method shareViaWhatsApp is: $returnedString');
} else {
String returnedString = await ModifiedShare.share(shareMessageDetails);
print(
'\n\nreturned string after invoking the method shareViaWhatsApp is: $returnedString');
}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
title: const Text('ModifiedShare Plugin Example App'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text('Click the below button to Share!'),
FlatButton(
color: Colors.yellow,
onPressed: () {
callModifiedShare(false);
},
child: Text('Share'),
),
Padding(
padding: EdgeInsets.all(
20.0,
),
),
Text('Click the below button to share only via WhatsApp!'),
FlatButton(
color: Colors.lightGreen,
onPressed: () {
callModifiedShare(true);
},
child: Text('WhatsApp Share'),
),
],
),
),
),
);
}
}