From d5e7f14f5da7e1f89b51a60b2be7fe26f46b7fe2 Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 2 Apr 2019 15:21:45 -0400 Subject: [PATCH] add logout button to edit profile page --- lib/edit_profile_page.dart | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/edit_profile_page.dart b/lib/edit_profile_page.dart index 2d03508..c32011f 100644 --- a/lib/edit_profile_page.dart +++ b/lib/edit_profile_page.dart @@ -1,7 +1,7 @@ import "package:flutter/material.dart"; import 'dart:async'; import 'package:cloud_firestore/cloud_firestore.dart'; -import 'main.dart'; //for currentuser +import 'main.dart'; //for currentuser & google signin instance import 'profile_page.dart'; //for the user class class EditProfilePage extends StatelessWidget { @@ -104,9 +104,25 @@ class EditProfilePage extends StatelessWidget { buildTextField(name: "Bio", controller: bioController), ], ), + ), + new Padding( + padding: const EdgeInsets.all(16.0), + child: new MaterialButton( + onPressed: () => {_logout(context)}, + child: new Text("Logout") + + ) ) ], ); }); } + + void _logout(BuildContext context) async { + print("logout"); + await auth.signOut(); + await googleSignIn.signOut(); + + Navigator.pop(context); + } }