-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauthpage.dart
142 lines (135 loc) · 4.61 KB
/
authpage.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import 'package:flutter/material.dart';
import 'auth.dart';
import 'hellopage.dart';
import 'util.dart';
class AuthPage extends StatefulWidget {
AuthPage({Key key}) : super(key: key);
_AuthPageState createState() => _AuthPageState();
}
class _AuthPageState extends State<AuthPage> {
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
CustomColors.GradientTop,
CustomColors.GradientMiddle,
CustomColors.GradientBottom
])),
child: Container(
child: Column(
children: <Widget>[
Container(
height: MediaQuery.of(context).size.height / 3,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
'Узнай кто ты',
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: CustomColors.TextHeader),
),
Text(
'в новом цифровом мире',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w400,
color: CustomColors.TextHeader,
fontFamily: 'opensans'),
textAlign: TextAlign.center,
),
],
),
),
Expanded(
flex: 4,
child: Hero(
tag: 'Clipboard',
child: Image.asset('assets/auth_page_image.png'),
),
),
SizedBox(height: 40),
Expanded(
flex: 0,
child: RaisedButton(
onPressed: () {
login();
},
textColor: Colors.white,
padding: const EdgeInsets.all(0.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),
child: Container(
width: MediaQuery.of(context).size.width / 1.2,
height: 58,
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: <Color>[
CustomColors.AccentColor,
CustomColors.AccentColor,
],
),
borderRadius: BorderRadius.all(
Radius.circular(15.0),
),
boxShadow: [
BoxShadow(
color: CustomColors.AccentShadow,
blurRadius: 15.0,
spreadRadius: 7.0,
offset: Offset(0.0, 0.0),
),
],
),
child: Center(
child: const Text(
'ВОЙТИ ЧЕРЕЗ GOOGLE',
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.bold),
),
),
),
),
),
Expanded(
flex: 1,
child: Container(),
)
],
),
),
),
),
);
}
void login() {
Auth().googleSignIn().then((user) {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => HelloPage()),
);
}).catchError((error) {
final snackBar = SnackBar(content: Text('Ощибка при авторизации ' + error.toString()));
Scaffold.of(context).showSnackBar(snackBar);
});
}
}