2019-05-08 18:54:14 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:local_spend/common/apifunctions/request_logout_api.dart';
|
2019-05-10 11:43:45 +00:00
|
|
|
import 'package:local_spend/common/functions/get_token.dart';
|
|
|
|
// debug
|
|
|
|
import 'package:flutter/foundation.dart';
|
2019-05-08 18:54:14 +00:00
|
|
|
|
|
|
|
class BasicDrawer extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
_BasicDrawerState createState() => _BasicDrawerState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _BasicDrawerState extends State<BasicDrawer> {
|
2019-05-10 11:43:45 +00:00
|
|
|
var token;
|
|
|
|
// TODO: add getter with getToken to check logged in
|
|
|
|
|
2019-05-08 18:54:14 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Drawer(
|
|
|
|
child: Container(
|
2019-07-05 12:39:24 +00:00
|
|
|
padding: new EdgeInsets.all(32),
|
2019-05-08 18:54:14 +00:00
|
|
|
child: ListView(
|
|
|
|
children: <Widget>[
|
2019-07-04 15:57:29 +00:00
|
|
|
ListTile(
|
2019-07-05 12:39:24 +00:00
|
|
|
title: Text (
|
|
|
|
"Home",
|
|
|
|
style: TextStyle(color: Colors.black, fontSize: 20.0),
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pushNamed('/HomePage');
|
|
|
|
}
|
2019-07-04 15:57:29 +00:00
|
|
|
),
|
2019-05-08 18:54:14 +00:00
|
|
|
ListTile(
|
|
|
|
title: Text(
|
|
|
|
"Submit Receipt",
|
|
|
|
style: TextStyle(color: Colors.black, fontSize: 20.0),
|
|
|
|
),
|
|
|
|
onTap: () {
|
2019-05-10 11:43:45 +00:00
|
|
|
debugPrint('$token');
|
2019-05-08 18:54:14 +00:00
|
|
|
Navigator.of(context).pushNamed('/ReceiptPage');
|
|
|
|
},
|
2019-05-10 11:43:45 +00:00
|
|
|
// enabled: token != null && token.isNotEmpty,
|
2019-05-08 18:54:14 +00:00
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
title: Text(
|
|
|
|
"About",
|
|
|
|
style: TextStyle(color: Colors.black, fontSize: 20.0),
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
SystemChannels.textInput.invokeMethod('TextInput.hide');
|
2019-05-24 15:21:48 +00:00
|
|
|
Navigator.of(context).pushReplacementNamed('/AboutPage');
|
2019-05-08 18:54:14 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
title: Text(
|
|
|
|
"Logout",
|
|
|
|
style: TextStyle(color: Colors.black, fontSize: 20.0),
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
requestLogoutAPI(context);
|
|
|
|
Navigator.of(context).pushReplacementNamed('/LoginPage');
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|