forked from elbeicktalat/flutter_auth_buttons
/
main.dart
114 lines (110 loc) · 3.73 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import 'package:social_auth_buttons/res/shared/colors.dart';
import 'package:social_auth_buttons/social_auth_buttons.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String appName = 'Auth Buttons Example';
bool darkMode = false;
AuthButtonStyle? authButtonStyle;
Color githubBtnColor = Colors.white;
Color facebookBtnColor = Colors.white;
@override
Widget build(BuildContext context) {
return MaterialApp(
title: appName,
home: Scaffold(
appBar: AppBar(
title: Text(appName),
),
body: Container(
width: double.infinity,
color: darkMode ? Color(0xff303030) : Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () => setState(() => darkMode = !darkMode),
child: Text('Dark / Light mode'),
),
ElevatedButton(
onPressed: () => setState(() {
authButtonStyle =
authButtonStyle == null ? AuthButtonStyle.icon : null;
}),
child: Text('Icon / Extended mode'),
),
ElevatedButton(
onPressed: () => setState(() {
facebookBtnColor = facebookBtnColor == Colors.white
? buttonFacebookColor
: Colors.white;
githubBtnColor = githubBtnColor == Colors.white
? buttonGithubColor
: Colors.white;
}),
child: Text('GitHub and Facebook Button Color'),
),
SizedBox(height: 50),
GoogleAuthButton(
onPressed: () {},
darkMode: darkMode,
style: authButtonStyle,
width: authButtonStyle == null ? 300 : null,
),
SizedBox(height: 10),
AppleAuthButton(
onPressed: () {},
darkMode: darkMode,
style: authButtonStyle,
width: authButtonStyle == null ? 300 : null,
),
SizedBox(height: 10),
FacebookAuthButton(
onPressed: () {},
darkMode: darkMode,
style: authButtonStyle,
buttonColor: facebookBtnColor,
width: authButtonStyle == null ? 300 : null,
),
SizedBox(height: 10),
GithubAuthButton(
onPressed: () {},
darkMode: darkMode,
style: authButtonStyle,
buttonColor: githubBtnColor,
width: authButtonStyle == null ? 300 : null,
),
SizedBox(height: 10),
MicrosoftAuthButton(
onPressed: () {},
darkMode: darkMode,
style: authButtonStyle,
width: authButtonStyle == null ? 300 : null,
),
SizedBox(height: 10),
TwitterAuthButton(
onPressed: () {},
darkMode: darkMode,
style: authButtonStyle,
width: authButtonStyle == null ? 300 : null,
),
SizedBox(height: 10),
EmailPasswordAuthButton(
onPressed: () {},
darkMode: darkMode,
style: authButtonStyle,
width: authButtonStyle == null ? 300 : null,
),
],
),
),
),
);
}
}