mirror of
https://github.com/mdanics/fluttergram.git
synced 2025-08-06 13:19:53 +08:00
add logout button to edit profile page
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
import "package:flutter/material.dart";
|
import "package:flutter/material.dart";
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
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
|
import 'profile_page.dart'; //for the user class
|
||||||
|
|
||||||
class EditProfilePage extends StatelessWidget {
|
class EditProfilePage extends StatelessWidget {
|
||||||
@ -104,9 +104,25 @@ class EditProfilePage extends StatelessWidget {
|
|||||||
buildTextField(name: "Bio", controller: bioController),
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user