Commit 2be2c232 authored by Manuel's avatar Manuel

added AppBar for logout

parent 663b2342
import 'package:circlegraph/circlegraph.dart';
import 'package:dashboard/querying/datagetter.dart';
import 'package:dashboard/ui/util/logged_in_appbar.dart';
import 'package:enhanced_future_builder/enhanced_future_builder.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
......@@ -102,6 +103,7 @@ class CommunityGraphViewPage extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: LoggedInAppBar(),
backgroundColor: Colors.white,
floatingActionButton: FloatingActionButton(
onPressed: () => redirectToCommunityMetaGraph(context),
......
import 'package:dashboard/exceptions/login_exception.dart';
import 'package:dashboard/graphing/communitygraph.dart';
import 'package:dashboard/loading.dart';
import 'package:dashboard/sign_in/loginpage.dart';
import 'package:dashboard/ui/sign_in/loginpage.dart';
import 'package:dashboard/util/loginhelper.dart';
import 'package:dashboard/util/user.dart';
import 'package:enhanced_future_builder/enhanced_future_builder.dart';
......
import 'package:dashboard/exceptions/login_exception.dart';
import 'package:dashboard/main.dart';
import 'package:dashboard/sign_in/login_form.dart';
import 'package:dashboard/ui/sign_in/login_form.dart';
import 'package:dashboard/util/loginhelper.dart';
import 'package:dashboard/util/user.dart';
import 'package:flutter/cupertino.dart';
......
import 'package:dashboard/main.dart';
import 'package:dashboard/util/loginhelper.dart';
import 'package:flutter/material.dart';
class LoggedInAppBar extends PreferredSize {
@override
Size get preferredSize => Size.fromHeight(60);
Future<void> _onLogout(context) async {
await LoginHelper().logout();
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) => MyApp(),
),
);
}
@override
Widget build(BuildContext context) {
return AppBar(
backgroundColor: Colors.blue,
actions: [
Padding(
padding: const EdgeInsets.all(8.0),
child: TextButton.icon(
onPressed: () => _onLogout(context),
icon: Icon(
Icons.logout,
color: Colors.white,
size: 25,
),
label: Text(
"Logout",
style: TextStyle(
color: Colors.white,
fontSize: 20,
),
),
),
),
],
);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment