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

Navigations fixed

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