Skip to content

Instantly share code, notes, and snippets.

@Moiz-Ali-Moomin
Created November 9, 2020 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Moiz-Ali-Moomin/0d0cdfd00635f707b7016c62123db42c to your computer and use it in GitHub Desktop.
Save Moiz-Ali-Moomin/0d0cdfd00635f707b7016c62123db42c to your computer and use it in GitHub Desktop.
Task 4 CMD
import 'cmd.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
void loi(BuildContext context) {
var alertDialog = AlertDialog(
title: Text("Log out of app?"),
content: Text("Are you sure you want to log out of the app!"),
actions: <Widget>[
FlatButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text("Cancel")),
FlatButton(
onPressed: () async {
await FirebaseAuth.instance.signOut();
Navigator.pushNamedAndRemoveUntil(
context, 'SignIn', (route) => false);
},
child: Text("Log Out"))
]);
showDialog(
context: context,
builder: (BuildContext context) {
return alertDialog;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Linux Terminal App"),
backgroundColor: Colors.black,
actions: [
IconButton(
icon: Icon(Icons.logout),
onPressed: () {
loi(context);
})
],
),
body: Body());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment