dotup_flutter_signin_button 1.0.1 dotup_flutter_signin_button: ^1.0.1 copied to clipboard
A Flutter plugin for iOS and Android for generating signin buttons for different social media account.
import 'package:dotup_flutter_signin_button/dotup_flutter_signin_button.dart';
import 'package:flutter/material.dart';
void main() {
SignInButton.defaultColor = Colors.white;
SignInButton.defaultBackgroundColor = Colors.grey.shade800;
SignInButton.useProviderColors = true;
runApp(MyApp());
}
class MyApp extends StatelessWidget {
/// This is an example app which make use of
/// `SignInButtonBuilder` and `SignInButton` class
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'dotup_flutter_signin_button',
theme: ThemeData.light(),
home: Scaffold(
backgroundColor: Color.fromRGBO(50, 50, 50, 1.0),
body: SignInPage(),
),
debugShowCheckedModeBanner: false,
);
}
}
class SignInPage extends StatelessWidget {
/// Show a simple "___ Button Pressed" indicator
void _showButtonPressDialog(BuildContext context, String provider) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text('$provider Button Pressed!'),
backgroundColor: Colors.black26,
duration: Duration(milliseconds: 400),
));
}
/// Normally the signin buttons should be contained in the SignInPage
@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
// signInButtonBuilder(
// text: 'Get going with Email',
// icon: Icons.email,
// onPressed: () {
// _showButtonPressDialog(context, 'Email');
// },
// backgroundColor: Colors.blueGrey[700]!,
// width: 220.0,
// ),
Padding(
padding: const EdgeInsets.fromLTRB(16, 16, 16, 0),
child: SignInButton(
Buttons.Google,
// mini: true,
onPressed: () {},
text: 'Mit Google',
shape: StadiumBorder(),
// elevation: 0,
padding: EdgeInsets.zero,
backgroundColor: Colors.black87,
contentAlignment: MainAxisAlignment.center,
),
),
Divider(),
SignInButton.mini(
Buttons.Google,
onPressed: () {
_showButtonPressDialog(context, 'Google');
},
// mini: true,
),
Divider(),
SignInButton(
Buttons.Apple,
onPressed: () {
_showButtonPressDialog(context, 'Apple');
},
),
Divider(),
SignInButton.mini(
Buttons.GitHub,
text: "Sign up with GitHub",
onPressed: () {
_showButtonPressDialog(context, 'Github');
},
),
Divider(),
SignInButton.mini(
Buttons.Microsoft,
text: "Sign up with Microsoft ",
onPressed: () {
_showButtonPressDialog(context, 'Microsoft ');
},
),
Divider(),
SignInButton.mini(
Buttons.Twitter,
text: "Use Twitter",
onPressed: () {
_showButtonPressDialog(context, 'Twitter');
},
),
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SignInButton.mini(
Buttons.LinkedIn,
onPressed: () {
_showButtonPressDialog(context, 'LinkedIn (mini)');
},
),
SizedBox(width: 10),
SignInButton.mini(
Buttons.Tumblr,
onPressed: () {
_showButtonPressDialog(context, 'Tumblr (mini)');
},
),
SizedBox(width: 10),
SignInButton.mini(
Buttons.Facebook,
onPressed: () {
_showButtonPressDialog(context, 'Facebook (mini)');
},
),
// signInButtonBuilder(
// icon: Icons.email,
// text: "Ignored for mini button",
// mini: true,
// onPressed: () {
// _showButtonPressDialog(context, 'Email (mini)');
// },
// backgroundColor: Colors.cyan,
// ),
],
),
],
),
);
}
}