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/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<GraphWithTitle>();
return new MaterialApp(
debugShowCheckedModeBanner: false,
localizationsDelegates: [

View file

@ -21,12 +21,10 @@ class LoginPage extends StatefulWidget {
class LoginPageState extends State<LoginPage> {
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<LoginPage> {
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) {

View file

@ -10,6 +10,8 @@ const demonstration = false;
class StatsPage extends StatefulWidget {
@override
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();
}
}