Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

account page, home page modified, added a loader #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions lib/constants/loader.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';


class Load extends StatelessWidget {
@override
Widget build(BuildContext context) {

return Container(
child: Center(
child: SpinKitFadingCircle(
color: Colors.blue,
size: 50.0,
)
)
);
}
}

45 changes: 41 additions & 4 deletions lib/screens/account.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:employeeapp/models/Employee.dart';
import 'package:employeeapp/services/authentication.dart';
import 'package:flutter/material.dart';

class Account extends StatefulWidget {
Expand All @@ -7,6 +8,7 @@ class Account extends StatefulWidget {
}

class _AccountState extends State<Account> {
Auth _auth = Auth();
Employee fakeAccount = new Employee(
name: "Dr Disrespect",
username: "drdr",
Expand Down Expand Up @@ -35,13 +37,17 @@ class _AccountState extends State<Account> {
alignment: Alignment.center,
image: AssetImage('images/dr.jpeg'),
fit: BoxFit.cover,
),
),
),
),
SizedBox(
height: 25.0,
),
Divider(indent: 10.0, endIndent: 10.0, thickness: 2.0,),
Divider(
indent: 10.0,
endIndent: 10.0,
thickness: 2.0,
),
ListTile(
leading: Icon(Icons.person),
title: Row(
Expand Down Expand Up @@ -84,8 +90,7 @@ class _AccountState extends State<Account> {
],
),
),

ListTile(
ListTile(
leading: Icon(Icons.assignment_turned_in),
title: Row(
children: <Widget>[
Expand All @@ -107,6 +112,38 @@ class _AccountState extends State<Account> {
],
),
),
Divider(),
GestureDetector(
onTap: () {
_auth.signOut();
},
child: ListTile(
leading: Icon(Icons.exit_to_app),
title: Row(
children: <Widget>[
Text(
"Logout",
style: TextStyle(
fontSize: 22.0,
),
),
],
),
),
),
ListTile(
leading: Icon(Icons.settings),
title: Row(
children: <Widget>[
Text(
"Settings",
style: TextStyle(
fontSize: 22.0,
),
),
],
),
),
],
),
),
Expand Down
34 changes: 23 additions & 11 deletions lib/screens/homePage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,29 +53,41 @@ class _MyHomePageState extends State<MyHomePage> {
body: Container(
child: ListView.builder(
itemBuilder: ((BuildContext context, int index) {
return ListTile(
title: Text(
jobs[index]["name"],
style: TextStyle(
return Container(
height: 150.0,
child: Card(
elevation: 10.0,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
jobs[index]["name"],
style: TextStyle(
color: Colors.black,
fontSize: 22.0,
),
),
subtitle: Text(
)
),
Text(
jobs[index]["description"],
style: TextStyle(
color: Colors.black,
fontSize: 22.0,
),
),
trailing: Text(
),
Text(
jobs[index]["date"],
style: TextStyle(
color: Colors.black,
color: Colors.black45,
fontSize: 22.0,
),
),
onTap: () {},

],
)


)
);
}),
itemCount: jobs.length,
Expand Down
6 changes: 5 additions & 1 deletion lib/screens/login.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:employeeapp/constants/loader.dart';
import 'package:employeeapp/screens/register.dart';
import 'package:employeeapp/services/authentication.dart';
import 'package:employeeapp/utils/styles.dart';
Expand All @@ -9,6 +10,7 @@ class Login extends StatefulWidget {

final BaseAuth auth;
final VoidCallback loginCallback;
final loading = false;

@override
_LoginState createState() => _LoginState();
Expand All @@ -17,6 +19,7 @@ class Login extends StatefulWidget {
class _LoginState extends State<Login> {
final scaffoldKey = GlobalKey<ScaffoldState>();
bool _rememberME = false;
bool _loading = false;
TextEditingController emailController = new TextEditingController();
TextEditingController passwordController = new TextEditingController();

Expand Down Expand Up @@ -45,7 +48,7 @@ class _LoginState extends State<Login> {

@override
Widget build(BuildContext context) {
return Scaffold(
return _loading ? Load() : Scaffold(
key: scaffoldKey,
body: AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle.light,
Expand Down Expand Up @@ -208,6 +211,7 @@ class _LoginState extends State<Login> {
onPressed: () {
String email = emailController.text.trim();
String password = passwordController.text;
setState(() => _loading = true);

auth(email, password);
},
Expand Down
Loading