explore_drawer.dart
7.03 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
import 'package:like/screens/home_page.dart';
import 'package:like/utils/authentication.dart';
import 'package:flutter/material.dart';
import 'auth_dialog.dart';
class ExploreDrawer extends StatefulWidget {
const ExploreDrawer({
Key? key,
}) : super(key: key);
@override
_ExploreDrawerState createState() => _ExploreDrawerState();
}
class _ExploreDrawerState extends State<ExploreDrawer> {
bool _isProcessing = false;
@override
Widget build(BuildContext context) {
return Drawer(
child: Container(
color: Theme.of(context).bottomAppBarColor,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
userEmail == null
? Container(
width: double.maxFinite,
child: TextButton(
// color: Colors.black,
// hoverColor: Colors.blueGrey[800],
// highlightColor: Colors.blueGrey[700],
style: TextButton.styleFrom(
primary: Colors.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
),
onPressed: () {
showDialog(
context: context,
builder: (context) => AuthDialog(),
);
},
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(15),
// ),
child: Padding(
padding: EdgeInsets.only(
top: 15.0,
bottom: 15.0,
),
child: Text(
'Sign in',
style: TextStyle(
fontSize: 20,
color: Colors.white,
),
),
),
),
)
: Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
CircleAvatar(
radius: 20,
backgroundImage:
imageUrl != null ? NetworkImage(imageUrl!) : null,
child: imageUrl == null
? Icon(
Icons.account_circle,
size: 40,
)
: Container(),
),
SizedBox(width: 10),
Text(
name ?? userEmail!,
style: TextStyle(
fontSize: 20,
color: Colors.white70,
),
)
],
),
SizedBox(height: 20),
userEmail != null
? Container(
width: double.maxFinite,
child: TextButton(
// color: Colors.black,
// hoverColor: Colors.blueGrey[800],
// highlightColor: Colors.blueGrey[700],
style: TextButton.styleFrom(
primary: Colors.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
),
onPressed: _isProcessing
? null
: () async {
setState(() {
_isProcessing = true;
});
await signOut().then((result) {
print(result);
Navigator.of(context).pushReplacement(
MaterialPageRoute(
fullscreenDialog: true,
builder: (context) => HomePage(),
),
);
}).catchError((error) {
print('Sign Out Error: $error');
});
setState(() {
_isProcessing = false;
});
},
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(15),
// ),
child: Padding(
padding: EdgeInsets.only(
top: 15.0,
bottom: 15.0,
),
child: _isProcessing
? CircularProgressIndicator()
: Text(
'Sign out',
style: TextStyle(
fontSize: 20,
color: Colors.white,
),
),
),
),
)
: Container(),
userEmail != null ? SizedBox(height: 20) : Container(),
InkWell(
onTap: () {},
child: Text(
'Discover',
style: TextStyle(color: Colors.white, fontSize: 22),
),
),
Padding(
padding: const EdgeInsets.only(top: 5.0, bottom: 5.0),
child: Divider(
color: Colors.blueGrey[400],
thickness: 2,
),
),
InkWell(
onTap: () {},
child: Text(
'Contact Us',
style: TextStyle(color: Colors.white, fontSize: 22),
),
),
Expanded(
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'Copyright © 2020 | EXPLORE',
style: TextStyle(
color: Colors.blueGrey[300],
fontSize: 14,
),
),
),
)
],
),
),
),
);
}
}