forked from medkamelhamdouni/lostandfound
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprofile.dart
76 lines (69 loc) · 2.22 KB
/
profile.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
//system package
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:firebase_auth/firebase_auth.dart';
//me package
import 'package:lostandfound/home.dart';
import 'package:lostandfound/ui/bottomnavigation.dart';
class Profile extends StatefulWidget {
final User user;
const Profile({Key key, this.user}) : super(key: key);
@override
_ProfileState createState() => _ProfileState();
}
class _ProfileState extends State<Profile> {
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
FirebaseAuth auth = FirebaseAuth.instance;
FirebaseAuth _auth = FirebaseAuth.instance;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Profile'),
leading: new IconButton(
icon: new Icon(Icons.arrow_back),
onPressed: () => Navigator.push(
context, new MaterialPageRoute(builder: (context) => new Home())),
),
),
bottomNavigationBar: BotmNavigate(),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
key: _scaffoldKey,
body: Container(
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
child: Text(
auth.currentUser.email,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 25),
),
),
Container(
child: ElevatedButton(
child: Text("Settieng"),
onPressed: () {},
),
),
Container(
child: ElevatedButton(
child: Text("LogOut"),
onPressed: () {
_signOut().whenComplete(() {
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (context) => Home()));
});
},
),
),
],
),
),
);
}
Future _signOut() async {
await _auth.signOut();
}
}