save before debugging marathon

This commit is contained in:
Felix 2019-08-27 11:00:57 +01:00
parent 030f482a54
commit f4a2e6ca7a
3 changed files with 24 additions and 9 deletions

View File

@ -6,14 +6,31 @@ import 'package:local_spend/pages/receipt_page_2.dart';
import 'package:local_spend/pages/spash_screen.dart'; import 'package:local_spend/pages/spash_screen.dart';
import 'package:local_spend/pages/more_page.dart'; import 'package:local_spend/pages/more_page.dart';
import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:local_spend/common/apifunctions/get_graph_data.dart';
void main() { void main() {
runApp(MyApp()); runApp(MyApp());
} }
void loadGraphs() {
}
class GraphWithTitle {
GraphWithTitle({
this.graph,
this.title
});
GraphData graph;
String title;
}
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var graphList = List<GraphWithTitle>();
return new MaterialApp( return new MaterialApp(
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
localizationsDelegates: [ localizationsDelegates: [

View File

@ -21,12 +21,10 @@ class LoginPage extends StatefulWidget {
class LoginPageState extends State<LoginPage> { class LoginPageState extends State<LoginPage> {
bool _isLoggingIn = false; bool _isLoggingIn = false;
final TextEditingController _emailController = final TextEditingController _emailController =
TextEditingController(/*text: 'test@example.com'*/); // remove TextEditingController();
final TextEditingController _passwordController = final TextEditingController _passwordController =
TextEditingController(/*text: 'abc123'*/); // remove TextEditingController();
bool _saveLoginDetails = bool _saveLoginDetails = true;
true; // I am extremely sorry for the placement of this variable
// it will be fixed soon I promise
FocusNode focusNode; // added so focus can move automatically FocusNode focusNode; // added so focus can move automatically
@ -81,11 +79,9 @@ class LoginPageState extends State<LoginPage> {
if (_saveLoginDetails) { if (_saveLoginDetails) {
await preferences.setString('username', username); await preferences.setString('username', username);
await preferences.setString('password', password); await preferences.setString('password', password);
print("details saved");
} else { } else {
await preferences.setString('username', ""); await preferences.setString('username', ""); // this does work...
await preferences.setString('password', ""); await preferences.setString('password', ""); // ...but this doesn't seem to have any effect..?
print("details cleared");
} }
await requestLoginAPI(context, username, password).then((value) { await requestLoginAPI(context, username, password).then((value) {

View File

@ -10,6 +10,8 @@ const demonstration = false;
class StatsPage extends StatefulWidget { class StatsPage extends StatefulWidget {
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
print("TODO: The 'stats' page should be loaded on login and cached rather than reloading on every opening of the page.");
print("Create new List<GraphData> in instantiated MyApp() and pass that or load it from this class' child with (graphs = super.graphList) or something.");
return new StatsPageState(); return new StatsPageState();
} }
} }