fitness-app/lib/Views/custom_drawer.dart
2020-04-03 13:27:51 +02:00

59 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:shared_preferences/shared_preferences.dart';
class CustomDrawer extends StatelessWidget{
void logout() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.remove("api_key");
SystemChannels.platform.invokeMethod('SystemNavigator.pop');
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
DrawerHeader(
child: Text(
'Workout planner',
style: TextStyle(color: Colors.white, fontSize: 25),
),
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
),
),
ListTile(
leading: Icon(Icons.input),
title: Text('Welcome'),
onTap: () => {},
),
ListTile(
leading: Icon(Icons.verified_user),
title: Text('Profile'),
onTap: () => {Navigator.of(context).pop()},
),
ListTile(
leading: Icon(Icons.settings),
title: Text('Settings'),
onTap: () => {Navigator.of(context).pop()},
),
ListTile(
leading: Icon(Icons.border_color),
title: Text('Feedback'),
onTap: () => {Navigator.of(context).pop()},
),
ListTile(
leading: Icon(Icons.exit_to_app),
title: Text('Logout'),
onTap: () {
logout();
},
),
],
),
);
}
}