share_social_media_plugin 1.2.0 share_social_media_plugin: ^1.2.0 copied to clipboard
Share social media plugin, share Line, Twitter, FB, Instagram and more!, I try develop step for step. Any suggestion please contact me.
import 'package:flutter/material.dart';
import 'package:http/src/response.dart';
import 'dart:io' show Platform;
import 'package:share_social_media_plugin/share_social_media_plugin.dart';
import 'package:flutter/services.dart';
import 'dart:convert';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final twitterLogin =
ShareSocialMediaPlugin(consumerKey: "", consumerSecret: '');
var titleTwitterButton = "Connect Twitter";
var outhTokenTwitter;
var oauthTokenSecretTwitter;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Share social media'),
),
body: Column(
children: <Widget>[
RaisedButton(
onPressed: () async {
try {
var result = await ShareSocialMediaPlugin.shareLine(
"http://www.google.com");
print(result);
} on PlatformException catch (e) {
print("sucedio un error");
}
},
child: Text('Share in Line', style: TextStyle(fontSize: 20)),
),
RaisedButton(
child: Text('Get image profile Twitter only android'),
onPressed: () async {
print(await twitterLogin.getProfileImage());
},
),
RaisedButton(
child: Text('Share in Twitter', style: TextStyle(fontSize: 20)),
onPressed: () async {
var response = await twitterLogin.shareTweet("Some message");
if (response['text'] != null) {
//Success
print(response);
} else {
//Fail
print(response);
}
},
),
RaisedButton(
onPressed: () async {
await ShareSocialMediaPlugin.shareInstagram(
"hello", "assets/nofumar.jpg", "assets/logo2323.png");
},
child: Text('Share in Instagram', style: TextStyle(fontSize: 20)),
),
],
),
),
);
}
}