2019-05-08 18:54:14 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:local_spend/common/platform/platform_scaffold.dart';
|
|
|
|
import 'package:local_spend/common/widgets/basic_drawer.dart';
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
2019-07-05 12:39:24 +00:00
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:local_spend/common/apifunctions/request_logout_api.dart';
|
|
|
|
import 'package:local_spend/common/functions/get_token.dart';
|
|
|
|
import 'package:flutter_fadein/flutter_fadein.dart';
|
2019-07-05 15:15:09 +00:00
|
|
|
import 'package:local_spend/common/functions/logout.dart';
|
2019-05-08 18:54:14 +00:00
|
|
|
|
|
|
|
class HomePage extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
_HomePageState createState() => _HomePageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _HomePageState extends State<HomePage> {
|
|
|
|
@override
|
2019-07-05 12:39:24 +00:00
|
|
|
|
2019-05-08 18:54:14 +00:00
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
_saveCurrentRoute("/HomePage");
|
|
|
|
}
|
|
|
|
|
|
|
|
_saveCurrentRoute(String lastRoute) async {
|
|
|
|
SharedPreferences preferences = await SharedPreferences.getInstance();
|
|
|
|
await preferences.setString('LastScreenRoute', lastRoute);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return PlatformScaffold(
|
|
|
|
appBar: AppBar(
|
|
|
|
title: Text(
|
2019-07-05 12:39:24 +00:00
|
|
|
"Navigation",
|
2019-05-08 18:54:14 +00:00
|
|
|
style: TextStyle(color: Colors.black),
|
|
|
|
),
|
|
|
|
iconTheme: IconThemeData(color: Colors.black),
|
|
|
|
elevation: Theme.of(context).platform == TargetPlatform.iOS ? 0.0 : 6.0,
|
|
|
|
),
|
|
|
|
drawer: BasicDrawer(),
|
|
|
|
body: Container(
|
2019-07-05 12:39:24 +00:00
|
|
|
child: FadeIn(
|
|
|
|
duration: Duration(milliseconds: 500),
|
|
|
|
curve: Curves.easeIn,
|
|
|
|
|
2019-05-08 18:54:14 +00:00
|
|
|
child: Column(
|
|
|
|
children: <Widget>[
|
2019-07-05 12:39:24 +00:00
|
|
|
|
|
|
|
ListTile(
|
|
|
|
contentPadding: EdgeInsets.fromLTRB(0, 15, 0, 0),
|
|
|
|
title: new Center(
|
|
|
|
child: new Text(
|
|
|
|
"Submit Receipt",
|
|
|
|
style: TextStyle(color: Colors.black, fontSize: 20.0),
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
// debugPrint('$token');
|
|
|
|
Navigator.of(context).pushNamed('/ReceiptPage');
|
|
|
|
},
|
|
|
|
),
|
|
|
|
|
|
|
|
ListTile(
|
|
|
|
title: new Center(
|
|
|
|
child: new Text(
|
|
|
|
"About",
|
|
|
|
style: TextStyle(color: Colors.black, fontSize: 20.0),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
SystemChannels.textInput.invokeMethod('TextInput.hide');
|
|
|
|
Navigator.of(context).pushReplacementNamed('/AboutPage');
|
|
|
|
},
|
|
|
|
),
|
|
|
|
|
|
|
|
ListTile(
|
|
|
|
title: new Center(
|
|
|
|
child: new Text(
|
|
|
|
"Logout",
|
|
|
|
style: TextStyle(color: Colors.black, fontSize: 20.0),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () {
|
2019-07-05 15:15:09 +00:00
|
|
|
logout(context);
|
2019-07-05 12:39:24 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
),
|
2019-05-08 18:54:14 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|