Commit a8dd8153 authored by Piyumi Dayarathna's avatar Piyumi Dayarathna 💬

Navigations fixed

parent 4745d41d
...@@ -4,6 +4,7 @@ import 'package:flutter/cupertino.dart'; ...@@ -4,6 +4,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_signin_button/flutter_signin_button.dart'; import 'package:flutter_signin_button/flutter_signin_button.dart';
import '../mainRegisterPage.dart';
import 'login.dart'; import 'login.dart';
class Start extends StatefulWidget { class Start extends StatefulWidget {
...@@ -17,7 +18,6 @@ class _StartState extends State<Start> { ...@@ -17,7 +18,6 @@ class _StartState extends State<Start> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(
color: Colors.white, color: Colors.white,
...@@ -55,7 +55,9 @@ class _StartState extends State<Start> { ...@@ -55,7 +55,9 @@ class _StartState extends State<Start> {
"Your Personal Defender Against COVID", "Your Personal Defender Against COVID",
style: TextStyle(color: Colors.black54), style: TextStyle(color: Colors.black54),
), ),
SizedBox(height: 20,), SizedBox(
height: 20,
),
Column( Column(
children: [ children: [
SizedBox( SizedBox(
...@@ -63,11 +65,9 @@ class _StartState extends State<Start> { ...@@ -63,11 +65,9 @@ class _StartState extends State<Start> {
width: 300, width: 300,
child: RaisedButton( child: RaisedButton(
onPressed: () { onPressed: () {
// go to login page // go to login page
Navigator.push( Navigator.push(context,
context, MaterialPageRoute(builder: (context) => Login())); MaterialPageRoute(builder: (context) => Login()));
}, },
child: Text("SIGN IN", child: Text("SIGN IN",
style: TextStyle( style: TextStyle(
...@@ -84,7 +84,9 @@ class _StartState extends State<Start> { ...@@ -84,7 +84,9 @@ class _StartState extends State<Start> {
// "Dont have an account yet ?", // "Dont have an account yet ?",
// style: TextStyle(color: Colors.black54), // style: TextStyle(color: Colors.black54),
// ), // ),
SizedBox(height: 15,), SizedBox(
height: 15,
),
SizedBox( SizedBox(
height: 60, height: 60,
width: 300, width: 300,
...@@ -92,7 +94,9 @@ class _StartState extends State<Start> { ...@@ -92,7 +94,9 @@ class _StartState extends State<Start> {
onPressed: () { onPressed: () {
// go to Register page // go to Register page
Navigator.push( Navigator.push(
context, MaterialPageRoute(builder: (context) => Register())); context,
MaterialPageRoute(
builder: (context) => mainRegisterPage()));
}, },
child: Text("Register Now", child: Text("Register Now",
style: TextStyle( style: TextStyle(
...@@ -105,7 +109,9 @@ class _StartState extends State<Start> { ...@@ -105,7 +109,9 @@ class _StartState extends State<Start> {
color: Colors.lightBlue, color: Colors.lightBlue,
), ),
), ),
SizedBox(height: 30,), SizedBox(
height: 30,
),
SizedBox( SizedBox(
height: 60, height: 60,
width: 300, width: 300,
......
import 'package:covidefender/AuthConfigs/Register.dart';
import 'package:covidefender/STracker/HandWashing/quizpage.dart'; import 'package:covidefender/STracker/HandWashing/quizpage.dart';
import 'package:covidefender/STracker/levelsDashboard.dart'; import 'package:covidefender/STracker/levelsDashboard.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -181,7 +182,7 @@ class _finalOverallResultPageState extends State<finalOverallResultPage> { ...@@ -181,7 +182,7 @@ class _finalOverallResultPageState extends State<finalOverallResultPage> {
borderRadius: BorderRadius.circular(20.0)), borderRadius: BorderRadius.circular(20.0)),
onPressed: () { onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute( Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => levelsDashboard(), builder: (context) => Register(),
)); ));
}, },
child: Text( child: Text(
......
...@@ -10,8 +10,6 @@ import 'AuthConfigs/StartScreen.dart'; ...@@ -10,8 +10,6 @@ import 'AuthConfigs/StartScreen.dart';
class HomeScreen extends StatefulWidget { class HomeScreen extends StatefulWidget {
_HomeScreenState createState() => _HomeScreenState(); _HomeScreenState createState() => _HomeScreenState();
} }
class _HomeScreenState extends State<HomeScreen> { class _HomeScreenState extends State<HomeScreen> {
...@@ -21,7 +19,7 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -21,7 +19,7 @@ class _HomeScreenState extends State<HomeScreen> {
@override @override
void initState() { void initState() {
this.checkAuthentification();//check every time in homescreen this.checkAuthentification(); //check every time in homescreen
this.getUser(); this.getUser();
} }
...@@ -38,11 +36,12 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -38,11 +36,12 @@ class _HomeScreenState extends State<HomeScreen> {
} }
}); });
} }
// if user already logged in // if user already logged in
getUser() async { getUser() async {
print("***********Get User Running**********"); print("***********Get User Running**********");
FirebaseUser firebaseuser = FirebaseUser firebaseuser =
await _auth.currentUser(); // get current user from firebase await _auth.currentUser(); // get current user from firebase
await firebaseuser?.reload(); await firebaseuser?.reload();
firebaseuser = await _auth.currentUser(); firebaseuser = await _auth.currentUser();
...@@ -54,12 +53,10 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -54,12 +53,10 @@ class _HomeScreenState extends State<HomeScreen> {
} }
} }
signOut() async{ signOut() async {
_auth.signOut(); _auth.signOut();
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
var size = MediaQuery.of(context).size; var size = MediaQuery.of(context).size;
return Scaffold( return Scaffold(
...@@ -97,7 +94,8 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -97,7 +94,8 @@ class _HomeScreenState extends State<HomeScreen> {
CircleAvatar( CircleAvatar(
radius: 55, radius: 55,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
backgroundImage: AssetImage('lib/assets/images/cdlogo2.png'), backgroundImage:
AssetImage('lib/assets/images/cdlogo2.png'),
), ),
SizedBox( SizedBox(
width: 16, width: 16,
...@@ -130,13 +128,13 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -130,13 +128,13 @@ class _HomeScreenState extends State<HomeScreen> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
FlatButton( FlatButton(
onPressed: () { // onPressed: () {
Navigator.push( // Navigator.push(
context, // context,
MaterialPageRoute( // MaterialPageRoute(
builder: (context) => loginPage()), // builder: (context) => loginPage()),
); // );
}, // },
child: Image.asset( child: Image.asset(
'lib/assets/images/man80.png'), 'lib/assets/images/man80.png'),
), ),
...@@ -217,14 +215,14 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -217,14 +215,14 @@ class _HomeScreenState extends State<HomeScreen> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
FlatButton( FlatButton(
onPressed: () { // onPressed: () {
Navigator.push( // Navigator.push(
context, // context,
MaterialPageRoute( // MaterialPageRoute(
builder: (context) => // builder: (context) =>
splashscreen()), // splashscreen()),
); // );
}, // },
child: Image.asset( child: Image.asset(
'lib/assets/images/time80.png'), 'lib/assets/images/time80.png'),
), ),
...@@ -267,15 +265,15 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -267,15 +265,15 @@ class _HomeScreenState extends State<HomeScreen> {
height: 60, height: 60,
width: 300, width: 300,
child: RaisedButton( child: RaisedButton(
onPressed: (){ onPressed: () {
print("***********Sign out clicked**********"); print("***********Sign out clicked**********");
signOut().whenComplete(() => Navigator.of(context) signOut().whenComplete(() => Navigator.of(context)
.pushAndRemoveUntil( .pushAndRemoveUntil(
MaterialPageRoute( MaterialPageRoute(
builder: (context) => Start()),(Route <dynamic> route) => false)); builder: (context) => Start()),
(Route<dynamic> route) => false));
}, },
child: Text("Sign Out", child: Text("Sign Out",
style: TextStyle( style: TextStyle(
fontSize: 20.0, fontSize: 20.0,
...@@ -285,8 +283,7 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -285,8 +283,7 @@ class _HomeScreenState extends State<HomeScreen> {
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
), ),
color: Colors.lightBlue, color: Colors.lightBlue,
) )),
),
) )
], ],
), ),
......
...@@ -80,7 +80,7 @@ class _mainRegisterPageState extends State<mainRegisterPage> { ...@@ -80,7 +80,7 @@ class _mainRegisterPageState extends State<mainRegisterPage> {
body: Column( body: Column(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 2,
child: ButtonTheme( child: ButtonTheme(
minWidth: 800.0, minWidth: 800.0,
height: 100.0, height: 100.0,
...@@ -89,7 +89,7 @@ class _mainRegisterPageState extends State<mainRegisterPage> { ...@@ -89,7 +89,7 @@ class _mainRegisterPageState extends State<mainRegisterPage> {
onPressed: () {}, onPressed: () {},
child: Text( child: Text(
"Registration", "Registration",
style: TextStyle(color: Colors.white, fontSize: 30), style: TextStyle(color: Colors.white, fontSize: 20),
), ),
), ),
)), )),
...@@ -101,7 +101,7 @@ class _mainRegisterPageState extends State<mainRegisterPage> { ...@@ -101,7 +101,7 @@ class _mainRegisterPageState extends State<mainRegisterPage> {
), ),
), ),
Expanded( Expanded(
flex: 5, flex: 6,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
...@@ -130,9 +130,10 @@ class _mainRegisterPageState extends State<mainRegisterPage> { ...@@ -130,9 +130,10 @@ class _mainRegisterPageState extends State<mainRegisterPage> {
), ),
child: Center( child: Center(
child: Text( child: Text(
"You have to answer a quiz before register \n Press Start Quiz to navigate.", "You have to answer a quiz before register. \n \n Press Start Quiz to navigate.",
textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 20.0,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
), ),
), ),
...@@ -153,13 +154,14 @@ class _mainRegisterPageState extends State<mainRegisterPage> { ...@@ -153,13 +154,14 @@ class _mainRegisterPageState extends State<mainRegisterPage> {
}, },
child: Text( child: Text(
"Start Quiz", "Start Quiz",
textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 20.0,
), ),
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 20.0, vertical: 10.0,
horizontal: 200.0, horizontal: 80.0,
), ),
) )
], ],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment