-
Notifications
You must be signed in to change notification settings - Fork 16
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
HomePage and Auth Page refactored #52
Open
VanshKela
wants to merge
5
commits into
therealansh:master
Choose a base branch
from
VanshKela:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ebcede0
Created new decorations.dart file and refactored auth page
VanshKela dc0b6e1
HomePage refactored and changed auto validate mode to on user interac…
VanshKela ad191df
SubjectSlides.dart deleted
VanshKela 7974df6
changed the name of byAditya directory to homepageImages
VanshKela 665999f
Removed Dead code
VanshKela File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,14 @@ | ||
const String DIRECTOR_MSG = | ||
"Being the Director of an ‘Institution of National Importance’it is a matter of pride as well as responsibility. Now, as the baton has passed on to me, I realize that it is for me to lay a roadmap that would take this institution to even greater heights. Having come from a research background and having seen, at close quarters, what meaningful research output can do for the growth and prestige of the country, I am convinced that research has to be a thrust area for our institutions of higher learning. I would strive to provide that thrust in this institution. If we succeed in enthusing our faculty, staff and students towards this end, our institute would become a cradle of creative and innovative ideas that can help develop new technologies, which, in turn, would transform our country. As a young institute, IIIT Sonepat has a unique opportunity to make a difference not only to Indian IT industry and the academic research community, but also the people of the entire region of Haryana. With this environment and rapidly improving connectivity to the IT capital New Delhi and the business city Gurugram, IIIT Sonepat is strategically positioned to develop into one of the best institutes of national importance in the country, under able and caring mentorship by NIT-Kurukshetra. In the coming years, with the support of its eminent Chairperson and Governing Body, the Institute will make every effort to construct and move to its spacious permanent campus located in a pristine setting near Sonepat. IIIT Sonepat is keen to push an effective research agenda and enhance its academic offerings by adding postgraduate and research programmes as well as more specializations of current relevance in undergraduate studies. Postgraduate studies and research will be a key factor for improving our visibility to the world. I also seek support of all stake holders in steering the institute to a great future. We have lots of work to do as multiple fronts. We have to create quality infrastructure, develop labs for academic and research activities, enhance research potential, expand the academic programs. We have to achieve all these in the fast changing education system. Let's all work together to achieve these goals."; | ||
String greetingMessage() { | ||
var timeNow = DateTime.now().hour; | ||
|
||
if (timeNow <= 12) { | ||
return 'Good Morning'; | ||
} else if ((timeNow > 12) && (timeNow <= 16)) { | ||
return 'Good Afternoon'; | ||
} else { | ||
return 'Good Evening'; | ||
} | ||
} | ||
String greeting = greetingMessage(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import 'package:flutter/material.dart'; | ||
InputDecoration inputDecor({String hint, IconData prefix, bool obscure, IconData suffix, Function toogle}) { | ||
return InputDecoration( | ||
enabledBorder: OutlineInputBorder( | ||
borderSide: BorderSide(color: Colors.transparent), | ||
borderRadius: BorderRadius.all( | ||
Radius.circular(30.0), | ||
), | ||
), | ||
focusedBorder: OutlineInputBorder( | ||
borderRadius: BorderRadius.all( | ||
Radius.circular(30.0), | ||
), | ||
borderSide: BorderSide(color: Colors.grey[100]), | ||
), | ||
hintText: hint, | ||
filled: true, | ||
fillColor: Colors.grey.shade200, | ||
prefixIcon: Icon( | ||
prefix, | ||
size: 25.0, | ||
color: Colors.black, | ||
), | ||
suffixIcon: IconButton( | ||
onPressed: toogle, | ||
icon: Icon( | ||
obscure ? Icons.visibility_off : suffix, | ||
size: 25.0, | ||
color: Colors.black, | ||
), | ||
), | ||
hintStyle: TextStyle( | ||
color: Colors.grey, | ||
fontSize: 12.0, | ||
fontWeight: FontWeight.w900, | ||
fontStyle: FontStyle.normal, | ||
), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,18 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:iiit_sonepat_stable/constants/routes.dart'; | ||
import 'package:iiit_sonepat_stable/constants/screenSize.dart'; | ||
import 'package:iiit_sonepat_stable/constants/theme.dart'; | ||
import 'package:iiit_sonepat_stable/constants/validators.dart'; | ||
import 'package:iiit_sonepat_stable/ui/Auth/Login_Page/Landing.dart'; | ||
import 'package:iiit_sonepat_stable/main.dart'; | ||
import 'package:iiit_sonepat_stable/ui/Home/homepage.dart'; | ||
import 'FogetPasswordPage.dart'; | ||
import 'package:fluttertoast/fluttertoast.dart'; | ||
import 'package:iiit_sonepat_stable/constants/decorations.dart'; | ||
|
||
class Auth extends StatefulWidget { | ||
@override | ||
_AuthState createState() => _AuthState(); | ||
} | ||
|
||
class _AuthState extends State<Auth> { | ||
final _scaffoldKey = GlobalKey<ScaffoldState>(); | ||
|
||
final TextEditingController emailController = new TextEditingController(); | ||
|
||
final TextEditingController passwordController = new TextEditingController(); | ||
|
@@ -24,50 +21,6 @@ class _AuthState extends State<Auth> { | |
|
||
bool isObscure = true; | ||
|
||
InputDecoration inputDecor( | ||
String hint, IconData prefix, bool obscure, IconData suffix) { | ||
return InputDecoration( | ||
enabledBorder: OutlineInputBorder( | ||
borderSide: BorderSide(color: Colors.transparent), | ||
borderRadius: BorderRadius.all( | ||
Radius.circular(30.0), | ||
), | ||
), | ||
focusedBorder: OutlineInputBorder( | ||
borderRadius: BorderRadius.all( | ||
Radius.circular(30.0), | ||
), | ||
borderSide: BorderSide(color: Colors.grey[100]), | ||
), | ||
hintText: hint, | ||
filled: true, | ||
fillColor: Colors.grey.shade200, | ||
prefixIcon: Icon( | ||
prefix, | ||
size: 25.0, | ||
color: Colors.black, | ||
), | ||
suffixIcon: IconButton( | ||
onPressed: () { | ||
setState(() { | ||
isObscure = !isObscure; | ||
}); | ||
}, | ||
icon: Icon( | ||
isObscure && obscure ? Icons.visibility_off : suffix, | ||
size: 25.0, | ||
color: Colors.black, | ||
), | ||
), | ||
hintStyle: TextStyle( | ||
color: Colors.grey, | ||
fontSize: 12.0, | ||
fontWeight: FontWeight.w900, | ||
fontStyle: FontStyle.normal, | ||
), | ||
); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
SizeConfig().init(context); | ||
|
@@ -140,24 +93,28 @@ class _AuthState extends State<Auth> { | |
child: Column( | ||
children: [ | ||
TextFormField( | ||
// autovalidateMode: AutovalidateMode.always, | ||
autovalidateMode: | ||
AutovalidateMode.onUserInteraction, | ||
validator: emailValidator, | ||
style: TextStyle( | ||
color: Colors.black, | ||
fontSize: 15, | ||
), | ||
controller: emailController, | ||
decoration: inputDecor( | ||
"[email protected]", | ||
Icons.mail_outline, | ||
false, | ||
null), | ||
hint: "[email protected]", | ||
prefix: Icons.mail_outline, | ||
obscure: false, | ||
suffix: null, | ||
toogle: null, | ||
), | ||
), | ||
SizedBox( | ||
height: 12.0, | ||
), | ||
TextFormField( | ||
//autovalidateMode: AutovalidateMode.always, | ||
autovalidateMode: | ||
AutovalidateMode.onUserInteraction, | ||
validator: pwdValidator, | ||
style: TextStyle( | ||
color: Colors.black, | ||
|
@@ -166,10 +123,15 @@ class _AuthState extends State<Auth> { | |
obscureText: isObscure, | ||
controller: passwordController, | ||
decoration: inputDecor( | ||
"Password", | ||
Icons.lock_outline_rounded, | ||
true, | ||
Icons.visibility), | ||
hint: "Password", | ||
prefix: Icons.lock_outline_rounded, | ||
obscure: isObscure, | ||
suffix: Icons.visibility, | ||
toogle: () { | ||
setState(() { | ||
isObscure = !isObscure; | ||
}); | ||
}), | ||
), | ||
], | ||
), | ||
|
@@ -192,17 +154,6 @@ class _AuthState extends State<Auth> { | |
onTap: () { | ||
//[TODO] add direct mail facilty to contact admin | ||
Fluttertoast.showToast(msg: "Contact Admin"); | ||
// Navigator.push( | ||
// context, | ||
// MaterialPageRoute( | ||
// builder: (context) => | ||
// ForgetPassword( | ||
// rollController, | ||
// phoneController, | ||
// nameController, | ||
// ), | ||
// ), | ||
// ); | ||
}), | ||
), | ||
), | ||
|
@@ -211,30 +162,32 @@ class _AuthState extends State<Auth> { | |
child: ButtonTheme( | ||
minWidth: 250, | ||
height: 60, | ||
// ignore: deprecated_member_use | ||
child: RaisedButton( | ||
color: Colors.black87, | ||
child: Text( | ||
"Sign In", | ||
style: TextStyle( | ||
fontSize: 20.0, | ||
fontWeight: FontWeight.w600, | ||
color: Colors.white), | ||
), | ||
shape: RoundedRectangleBorder( | ||
borderRadius: new BorderRadius.circular(30.0), | ||
), | ||
onPressed: () { | ||
if (!formAuthKey.currentState.validate()) { | ||
Fluttertoast.showToast( | ||
msg: 'Oops something went wrong'); | ||
} else { | ||
Navigator.push( | ||
context, | ||
MaterialPageRoute( | ||
builder: (context) => HomeScreen()), | ||
); | ||
} | ||
}), | ||
color: Colors.black87, | ||
child: Text( | ||
"Sign In", | ||
style: TextStyle( | ||
fontSize: 20.0, | ||
fontWeight: FontWeight.w600, | ||
color: Colors.white), | ||
), | ||
shape: RoundedRectangleBorder( | ||
borderRadius: new BorderRadius.circular(30.0), | ||
), | ||
onPressed: () { | ||
if (!formAuthKey.currentState.validate()) { | ||
Fluttertoast.showToast( | ||
msg: 'Oops something went wrong'); | ||
} else { | ||
Navigator.push( | ||
context, | ||
MaterialPageRoute( | ||
builder: (context) => HomeScreen()), | ||
); | ||
} | ||
}, | ||
), | ||
), | ||
), | ||
], | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not need to be refactored
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed some functionality of it too as it was using two bools before and doing an and operation on them now it only takes one and removed setState from it.