Starting bug hunting
This commit is contained in:
parent
476afe153a
commit
f337e72476
|
|
@ -165,7 +165,13 @@ class DataManager{
|
|||
Map<String, int> _ThisSeasonCryptoEarnings = {};
|
||||
Map<String, int> _ThisSeasonGamesEarnings = {};
|
||||
|
||||
earningsObj.forEach((key, earnings) {
|
||||
earningsObj.forEach((key, _earnings) {
|
||||
int earnings;
|
||||
try{
|
||||
earnings = _earnings;
|
||||
}catch(e){
|
||||
earnings = int.parse(_earnings);
|
||||
}
|
||||
Debug.Log("$key : $earnings");
|
||||
dynamic gameData = Helpers.GetGameFromCode(key);
|
||||
_ThisSeasonCryptoEarnings.update(gameData['coin'], (value) => earnings, ifAbsent: ()=> earnings);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@ import 'package:fhub/backend/DataManager.dart';
|
|||
import 'package:fhub/backend/DebugHelper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
extension NumExtensions on num {
|
||||
bool get isInt => (this % 1) == 0;
|
||||
}
|
||||
class Helpers{
|
||||
|
||||
static IconData GetIconForCrypto(String val){
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ class _HomeState extends State<Home> {
|
|||
child: CustomBody(
|
||||
context: context,
|
||||
onAnimEnd: () {
|
||||
// kickstartAnimations();
|
||||
setState(() {});
|
||||
},
|
||||
bottomNav: [
|
||||
|
|
|
|||
193
lib/welcome.dart
193
lib/welcome.dart
|
|
@ -109,17 +109,23 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||
),
|
||||
),
|
||||
const SizedBox(height: 100),
|
||||
NeonButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
counter = 1;
|
||||
});
|
||||
},
|
||||
text: "Get Started",
|
||||
trailing: const Icon(
|
||||
Icons.arrow_circle_right_outlined,
|
||||
size: 30,
|
||||
)),
|
||||
GlassButton(onTap: (){setState(() {
|
||||
counter=1;
|
||||
});}, child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(mainAxisAlignment:MainAxisAlignment.spaceBetween,children: [Container(width: 30,),Text("Get Started",style: TextStyle(fontSize: 20)), Icon(Icons.arrow_circle_right_outlined,size: 30,)],),
|
||||
), width: 250, height : 50,color: Colors.lightBlueAccent),
|
||||
// NeonButton(
|
||||
// onPressed: () {
|
||||
// setState(() {
|
||||
// counter = 1;
|
||||
// });
|
||||
// },
|
||||
// text: "Get Started",
|
||||
// trailing: const Icon(
|
||||
// Icons.arrow_circle_right_outlined,
|
||||
// size: 30,
|
||||
// )),
|
||||
const SizedBox(height: 120),
|
||||
|
||||
],
|
||||
|
|
@ -135,97 +141,106 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||
return Header(child: loginLoading ? const Center(child: Text("Loading...")) : Column(mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("Let's Get you ${isLogin ? "Logged-In" : "Registered"}!",
|
||||
style: TextStyle(fontSize: 20)),
|
||||
const SizedBox(height: 30,),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.person), SizedBox(width: 15,),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||
child: GlassCard(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Column(children:[
|
||||
Text("Let's Get you ${isLogin ? "Logged-In" : "Registered"}!",
|
||||
style: TextStyle(fontSize: 20)),
|
||||
const SizedBox(height: 30,),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.person), SizedBox(width: 15,),
|
||||
|
||||
SizedBox(width: 250,
|
||||
child: TextField(controller: usernameController,
|
||||
decoration: InputDecoration(hintText: "Username"),),)
|
||||
],),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.key),
|
||||
SizedBox(width: 15,),
|
||||
SizedBox(width: 250,
|
||||
child: TextField(controller:passwordController,obscureText: true,
|
||||
decoration: InputDecoration(hintText: "Password"),),)
|
||||
],),
|
||||
const SizedBox(height: 20,),
|
||||
NeonButton(height: 40,
|
||||
width: 200,
|
||||
onPressed: () async{
|
||||
if(usernameController.text.length < 3){
|
||||
Dialogs.showAlertDialog(context, "Invalid Input", "Username must be longer than 3 characters");
|
||||
return;
|
||||
}
|
||||
if(passwordController.text.length < 3){
|
||||
Dialogs.showAlertDialog(context, "Invalid Input", "Password must be longer than 3 characters");
|
||||
return;
|
||||
}
|
||||
if(passwordController.text.contains(" ") || usernameController.text.contains(" ")){
|
||||
Dialogs.showAlertDialog(context, "Invalid Input", "Neither the username nor password can contain spaces");
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
loginLoading = true;
|
||||
});
|
||||
if(isLogin){
|
||||
SizedBox(width: 250,
|
||||
child: TextField(controller: usernameController,
|
||||
decoration: InputDecoration(hintText: "Username"),),)
|
||||
],),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.key),
|
||||
SizedBox(width: 15,),
|
||||
SizedBox(width: 250,
|
||||
child: TextField(controller:passwordController,obscureText: true,
|
||||
decoration: InputDecoration(hintText: "Password"),),)
|
||||
],),
|
||||
const SizedBox(height: 20,),
|
||||
GlassButton(height: 40,
|
||||
width: 200,
|
||||
onTap: () async{
|
||||
if(usernameController.text.length < 3){
|
||||
Dialogs.showAlertDialog(context, "Invalid Input", "Username must be longer than 3 characters");
|
||||
return;
|
||||
}
|
||||
if(passwordController.text.length < 3){
|
||||
Dialogs.showAlertDialog(context, "Invalid Input", "Password must be longer than 3 characters");
|
||||
return;
|
||||
}
|
||||
if(passwordController.text.contains(" ") || usernameController.text.contains(" ")){
|
||||
Dialogs.showAlertDialog(context, "Invalid Input", "Neither the username nor password can contain spaces");
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
loginLoading = true;
|
||||
});
|
||||
if(isLogin){
|
||||
|
||||
int loginResult = await LoginManager.Login(usernameController.text, passwordController.text);
|
||||
int loginResult = await LoginManager.Login(usernameController.text, passwordController.text);
|
||||
|
||||
if(loginResult == 0){
|
||||
loadHome();
|
||||
}else if(loginResult == 5){
|
||||
Dialogs.showAlertDialog(context, "Login Failed", "Incorrect username or password");
|
||||
}else{
|
||||
Dialogs.showAlertDialog(context, "Login Failed", "Error code : $loginResult");
|
||||
}
|
||||
}else{
|
||||
int regResult = await LoginManager.Register(usernameController.text, passwordController.text);
|
||||
if(loginResult == 0){
|
||||
loadHome();
|
||||
}else if(loginResult == 5){
|
||||
Dialogs.showAlertDialog(context, "Login Failed", "Incorrect username or password");
|
||||
}else{
|
||||
Dialogs.showAlertDialog(context, "Login Failed", "Error code : $loginResult");
|
||||
}
|
||||
}else{
|
||||
int regResult = await LoginManager.Register(usernameController.text, passwordController.text);
|
||||
|
||||
if(regResult == 0){
|
||||
loadHome();
|
||||
}else if(regResult == 5){
|
||||
Dialogs.showAlertDialog(context, "Register Failed", "Username Already exists, Please try again with a different username");
|
||||
}else{
|
||||
Dialogs.showAlertDialog(context, "Register Failed", "Error code : $regResult");
|
||||
}
|
||||
}
|
||||
setState(() {
|
||||
loginLoading = false;
|
||||
});
|
||||
},
|
||||
text: isLogin ? "Login" : "Register"),
|
||||
const SizedBox(height: 10,),
|
||||
InkWell(
|
||||
child: Text(isLogin
|
||||
? "Don't have an account? Register here"
|
||||
: "Already have an Account? Login here",
|
||||
style: TextStyle(color: Colors.blue)), onTap: () {
|
||||
setState(() {
|
||||
isLogin = !isLogin;
|
||||
});
|
||||
},),
|
||||
if(regResult == 0){
|
||||
await DataManager.GetGamesProgress();
|
||||
loadHome();
|
||||
}else if(regResult == 5){
|
||||
Dialogs.showAlertDialog(context, "Register Failed", "Username Already exists, Please try again with a different username");
|
||||
}else{
|
||||
Dialogs.showAlertDialog(context, "Register Failed", "Error code : $regResult");
|
||||
}
|
||||
}
|
||||
setState(() {
|
||||
loginLoading = false;
|
||||
});
|
||||
},
|
||||
child: isLogin ? Text("Login",style: TextStyle(fontSize: 18)) : Text("Register",style: TextStyle(fontSize: 18))),
|
||||
const SizedBox(height: 10,),
|
||||
InkWell(
|
||||
child: Text(isLogin
|
||||
? "Don't have an account? Register here"
|
||||
: "Already have an Account? Login here",
|
||||
style: TextStyle(color: Colors.blue)), onTap: () {
|
||||
setState(() {
|
||||
isLogin = !isLogin;
|
||||
});
|
||||
},),]),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.all(25.0),
|
||||
child: Center(child: Text("OR")),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
NeonButton(onPressed: () {
|
||||
GlassButton(onTap: () {
|
||||
// Dialogs.showAlertDialog(context, "Test", "This is a test message");
|
||||
SignWithGoogle();
|
||||
},
|
||||
text: "Sign with Google",
|
||||
colors: [Colors.green, Colors.teal],
|
||||
fontSize: 18,
|
||||
height: 45,
|
||||
heading: Icon(Icons.g_mobiledata, size: 40,))
|
||||
],)
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween,children: [Icon(Icons.g_mobiledata_rounded,size: 40), Text("Sign with Google",style:TextStyle(fontSize: 18)),Container()],),
|
||||
height: 50,
|
||||
width: 250,
|
||||
color: Colors.greenAccent
|
||||
)])
|
||||
|
||||
]));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user