flutter_auth_buttons 0.5.0

Flutter Auth Buttons #

Flutter widget library containing buttons for authenticating with popular social networks: Google, Facebook, Twitter and Microsoft.

Screenshot

Usage #

Add flutter_auth_buttons to your pubspec.yaml, then import the Dart file:

import 'package:flutter_auth_buttons/flutter_auth_buttons.dart';

Use the onPressed attribute to capture the button press and call your authentication logic within that. To disable the button, pass null or omit the attribute.

FacebookSignInButton(onPressed: () {
  // call authentication logic
});

Some buttons have a dark mode. Enable this with the optional parameter:

GoogleSignInButton(
  onPressed: () {/* ... */}, 
  darkMode: true, // default: false
)

You can adjust the border-radius of the buttons:

TwitterSignInButton(
  onPressed: () {},
  borderRadius: 10.0,
)

See the documentation for API details: https://pub.dartlang.org/documentation/flutter_auth_buttons/latest/.

[0.5.0]

  • Added Microsoft button.

[0.4.0]

  • Border radius can be specified (thanks @nerder).
  • Google button shows correct background colour when pressed (thanks @g3rrydanc3).
  • Button content left-aligns when stretched.
  • onPressed attribute is no longer required.

[0.3.1]

  • Improved package description.

[0.3.0]

  • Added Twitter button.

[0.2.1]

  • Fix bug to prevent buttons from stretching.

[0.2.0]

  • Added Facebook button.

[0.1.0]

  • Added example application.

[0.0.1]

  • Support for Google button.

example/lib/main.dart

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

void main() async {
  runApp(new MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Button Demo',
      home: Scaffold(
        appBar: AppBar(
          title: Text("flutter_auth_buttons"),
        ),
        backgroundColor: Color.fromARGB(0xFF, 0xF0, 0xF0, 0xF0),
        body: Center(
          child: Column(
            children: <Widget>[
              Heading("Natural size"),
              Column(
                children: <Widget>[
                  GoogleSignInButton(onPressed: () {}),
                  GoogleSignInButton(onPressed: () {}, darkMode: true),
                  FacebookSignInButton(onPressed: () {}),
                  TwitterSignInButton(onPressed: () {}),
                  MicrosoftSignInButton(onPressed: () {}),
                  MicrosoftSignInButton(onPressed: () {}, darkMode: true),
                ],
              ),
              SizedBox(height: 25.0),
              Heading("Stretched (by parent)"),
              Padding(
                padding: const EdgeInsets.symmetric(horizontal: 40.0),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.stretch,
                  children: <Widget>[
                    GoogleSignInButton(onPressed: () {}),
                    GoogleSignInButton(onPressed: () {}, darkMode: true),
                    FacebookSignInButton(onPressed: () {}),
                    TwitterSignInButton(onPressed: () {}),
                    MicrosoftSignInButton(onPressed: () {}),
                    MicrosoftSignInButton(onPressed: () {}, darkMode: true),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

class Heading extends StatelessWidget {
  final String text;

  Heading(this.text);

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.only(top: 12.0, bottom: 12.0),
      child: Text(
        text,
        style: TextStyle(
          fontSize: 18.0,
          fontWeight: FontWeight.bold,
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_auth_buttons: ^0.5.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_auth_buttons/flutter_auth_buttons.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
95
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
98
Learn more about scoring.

We analyzed this package on Jul 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test

Admin