flutter_all_social_login 0.0.3 copy "flutter_all_social_login: ^0.0.3" to clipboard
flutter_all_social_login: ^0.0.3 copied to clipboard

PlatformiOS

Using this package to sign in all social platform like Google login, Apple login, Facebook, LinkedIn

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_all_social_login/flutter_all_social_login.dart';
import 'DashboardPage.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'dart:io' show Platform;

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  void initState() {
    // SocialLoginUtils().initializeApp();
    initializeApp();
    super.initState();
  }

  Future initializeApp() async{

    await Firebase.initializeApp();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            GestureDetector(
                onTap: () {

                  SocialLoginUtils().signInWithGoogle(context,isDisplayProgressBar: true,).then((userData) {
                    print("user button =="+userData.toString());
                    if(userData!=null){
                      Navigator.of(context)
                          .push(PageRouteBuilder(
                        pageBuilder: (BuildContext context, Animation<double> animation,
                            Animation<double> secondaryAnimation) =>
                            DashboardPage(userData:userData),
                        transitionDuration: Duration(seconds: 0),
                      ));
                    }
                  });
                },
                child:Container(
                  height: 40,
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(20),
                      color: Colors.white),
                  alignment: Alignment.center,
                  padding: const EdgeInsets.all(10),
                  margin: const EdgeInsets.all(10),
                  child:const Text("Google Login"),
                )),
            GestureDetector(
                onTap: () {

                  SocialLoginUtils().signInWithFacebook(context,isDisplayProgressBar: true,).then((userData) {
                    print("user button =="+userData.toString());
                    if(userData!=null){
                      Navigator.of(context)
                          .push(PageRouteBuilder(
                        pageBuilder: (BuildContext context, Animation<double> animation,
                            Animation<double> secondaryAnimation) =>
                            DashboardPage(userData:userData),
                        transitionDuration: Duration(seconds: 0),
                      ));
                    }
                  });
                },
                child:Container(
                  height: 40,
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(20),
                      color: Colors.white),
                  alignment: Alignment.center,
                  padding: const EdgeInsets.all(10),
                  margin: const EdgeInsets.all(10),
                  child:const Text("Facebook Login"),
                )),
            GestureDetector(
                onTap: () {

                  SocialLoginUtils().signInWithLinkedIn(context,isDisplayProgressBar: true,
                  clientId:'clientId' ,clientSecret:'clientSecret' ,redirectUrl: 'http://localhost:8081/linkedin/callback',
                      appBar:AppBar(title: Text("All Social login"),),
                    destroySession: true
                  ).then((userData) {
                    print("user button =="+userData.toString());
                    if(userData!=null){
                      Navigator.of(context)
                          .push(PageRouteBuilder(
                        pageBuilder: (BuildContext context, Animation<double> animation,
                            Animation<double> secondaryAnimation) =>
                            DashboardPage(mapUserData:userData),
                        transitionDuration: Duration(seconds: 0),
                      ));
                    }
                  });
                },
                child:Container(
                  height: 40,
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(20),
                      color: Colors.white),
                  alignment: Alignment.center,
                  padding: const EdgeInsets.all(10),
                  margin: const EdgeInsets.all(10),
                  child:const Text("Linked in Login"),
                )),
            GestureDetector(
                onTap: () {

                  SocialLoginUtils().appleLogin(context,Platform.isAndroid,isDisplayProgressBar: true,
                    clientID: "AS_PER_THE_DOCS"
                  ).then((userData) {
                    print("user button =="+userData.toString());
                    if(userData!=null){
                      Navigator.of(context)
                          .push(PageRouteBuilder(
                        pageBuilder: (BuildContext context, Animation<double> animation,
                            Animation<double> secondaryAnimation) =>
                            DashboardPage(userData:userData),
                        transitionDuration: Duration(seconds: 0),
                      ));
                    }
                  });
                },
                child:Container(
                  height: 40,
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(20),
                      color: Colors.white),
                  alignment: Alignment.center,
                  padding: const EdgeInsets.all(10),
                  margin: const EdgeInsets.all(10),
                  child:const Text("Apple Login"),
                )),
          ],
        ),
      ),
       // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
3
likes
80
pub points
53%
popularity

Publisher

unverified uploader

Using this package to sign in all social platform like Google login, Apple login, Facebook, LinkedIn

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (LICENSE)

Dependencies

crypto, firebase_auth, firebase_core, flutter, flutter_facebook_auth, fluttertoast, google_sign_in, linkedin_login, sign_in_with_apple

More

Packages that depend on flutter_all_social_login