From f4a2e6ca7a633770e2de515999527f16fbbfd73b Mon Sep 17 00:00:00 2001 From: Felix Date: Tue, 27 Aug 2019 11:00:57 +0100 Subject: [PATCH] save before debugging marathon --- lib/main.dart | 17 +++++++++++++++++ lib/pages/login_page.dart | 14 +++++--------- lib/pages/stats_page.dart | 2 ++ 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 6b433ea..3f9987c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -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/more_page.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:local_spend/common/apifunctions/get_graph_data.dart'; void main() { runApp(MyApp()); } +void loadGraphs() { + +} + +class GraphWithTitle { + GraphWithTitle({ + this.graph, + this.title + }); + + GraphData graph; + String title; +} + class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { + var graphList = List(); + return new MaterialApp( debugShowCheckedModeBanner: false, localizationsDelegates: [ diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart index 2b21cda..a43bc27 100644 --- a/lib/pages/login_page.dart +++ b/lib/pages/login_page.dart @@ -21,12 +21,10 @@ class LoginPage extends StatefulWidget { class LoginPageState extends State { bool _isLoggingIn = false; final TextEditingController _emailController = - TextEditingController(/*text: 'test@example.com'*/); // remove + TextEditingController(); final TextEditingController _passwordController = - TextEditingController(/*text: 'abc123'*/); // remove - bool _saveLoginDetails = - true; // I am extremely sorry for the placement of this variable - // it will be fixed soon I promise + TextEditingController(); + bool _saveLoginDetails = true; FocusNode focusNode; // added so focus can move automatically @@ -81,11 +79,9 @@ class LoginPageState extends State { if (_saveLoginDetails) { await preferences.setString('username', username); await preferences.setString('password', password); - print("details saved"); } else { - await preferences.setString('username', ""); - await preferences.setString('password', ""); - print("details cleared"); + await preferences.setString('username', ""); // this does work... + await preferences.setString('password', ""); // ...but this doesn't seem to have any effect..? } await requestLoginAPI(context, username, password).then((value) { diff --git a/lib/pages/stats_page.dart b/lib/pages/stats_page.dart index f6102fd..f3f1e06 100644 --- a/lib/pages/stats_page.dart +++ b/lib/pages/stats_page.dart @@ -10,6 +10,8 @@ const demonstration = false; class StatsPage extends StatefulWidget { @override State 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 in instantiated MyApp() and pass that or load it from this class' child with (graphs = super.graphList) or something."); return new StatsPageState(); } }