-
Notifications
You must be signed in to change notification settings - Fork 0
added-login-signup-screen #3
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
Open
RandelMesa
wants to merge
8
commits into
develop
Choose a base branch
from
screen/login-signup
base: develop
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 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
69df3ca
added login and signup screen for the app
ec524bc
Merge branch 'develop' into screen/login-signup
Grrom c753f90
updated-login-signup
a2a3923
Merge branch 'screen/login-signup' of https://github.com/MemoryLamp/m…
2fea02a
add widgets to the scope of signup state
Grrom e9ee752
make signUpHere private and move it inside LoginScreenState
Grrom 48a17e5
use MLText instead of Text
Grrom 5cd81bf
Merge pull request #4 from MemoryLamp/improvements/login-signup
Grrom 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
This file contains hidden or 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 hidden or 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 hidden or 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,136 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:memory_lamp/helpers/size_mq.dart'; | ||
| import 'package:memory_lamp/theming/ml_colors.dart'; | ||
|
|
||
| class MLForm extends StatefulWidget { | ||
| final bool loadForSignup; | ||
| const MLForm({this.loadForSignup = false}); | ||
| @override | ||
| _MLFormState createState() => _MLFormState(); | ||
| } | ||
|
|
||
| class _MLFormState extends State<MLForm> { | ||
| final _mlFormKey = GlobalKey<FormState>(); | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Form( | ||
| key: _mlFormKey, | ||
| child: Column( | ||
| mainAxisAlignment: MainAxisAlignment.spaceAround, | ||
| mainAxisSize: MainAxisSize.max, | ||
| children: <Widget>[ | ||
| _userNameField(), | ||
| SizedBox(height: SizeMQ.height! * .03), | ||
| if (widget.loadForSignup) _emailField(), | ||
| SizedBox(height: SizeMQ.height! * .03), | ||
| _passwordField(), | ||
| SizedBox(height: SizeMQ.height! * .03), | ||
| if (widget.loadForSignup) _confirmPasswordField(), | ||
| widget.loadForSignup ? _agreement() : _rememberMe(), | ||
| ], | ||
| ), | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| //username | ||
| TextFormField _userNameField() => TextFormField( | ||
| keyboardType: TextInputType.name, | ||
| decoration: _defaultInputDecoration(label: 'Username'), | ||
| ); | ||
|
|
||
| TextFormField _emailField() => TextFormField( | ||
| keyboardType: TextInputType.emailAddress, | ||
| decoration: _defaultInputDecoration(label: 'Email'), | ||
| ); | ||
|
|
||
| //password | ||
| TextFormField _passwordField() => TextFormField( | ||
| keyboardType: TextInputType.visiblePassword, | ||
| obscureText: true, | ||
| decoration: _defaultInputDecoration(label: 'Password'), | ||
| ); | ||
|
|
||
| //confirmPassword | ||
| TextFormField _confirmPasswordField() => TextFormField( | ||
| keyboardType: TextInputType.visiblePassword, | ||
| obscureText: true, | ||
| decoration: _defaultInputDecoration(label: 'Confirm Password'), | ||
| ); | ||
|
|
||
| //AgreeToTos | ||
| // ---> i get errors when i put this above. can't seem find the error. for the meantime i put it here | ||
| bool agreeToTos = false; | ||
|
|
||
| Row _agreement() => Row( | ||
| children: [ | ||
| Theme( | ||
| child: Checkbox( | ||
| value: agreeToTos, | ||
| activeColor: Colors.blue, | ||
| checkColor: MLColors.primary, | ||
| onChanged: (value) {}), | ||
| data: ThemeData(unselectedWidgetColor: Colors.white38), | ||
| ), | ||
| Row( | ||
| crossAxisAlignment: CrossAxisAlignment.start, | ||
| children: [ | ||
| Text( | ||
| "I agree with the ", | ||
| style: TextStyle( | ||
| color: Colors.white, | ||
| fontSize: getProportionateScreenWidth(7)), | ||
| ), | ||
| Text( | ||
| "Terms and Conditions", | ||
| style: TextStyle( | ||
| decoration: TextDecoration.underline, | ||
| color: Colors.white, | ||
| fontSize: getProportionateScreenWidth(7)), | ||
| ), | ||
| ], | ||
| ) | ||
| ], | ||
| ); | ||
|
|
||
| //rememberMe | ||
| bool remember = false; | ||
|
|
||
| Row _rememberMe() => Row( | ||
| mainAxisAlignment: MainAxisAlignment.end, | ||
| children: [ | ||
| Theme( | ||
| child: Checkbox( | ||
| value: remember, | ||
| activeColor: Colors.blue, | ||
| checkColor: MLColors.primary, | ||
| onChanged: (value) {}), | ||
| data: ThemeData(unselectedWidgetColor: Colors.white38), | ||
| ), | ||
| Text( | ||
| "Remember Me ", | ||
| style: TextStyle( | ||
| color: Colors.white, fontSize: getProportionateScreenWidth(7)), | ||
| ), | ||
| ], | ||
| ); | ||
|
|
||
| _defaultInputDecoration({ | ||
| required String label, | ||
| }) { | ||
| return InputDecoration( | ||
| labelStyle: TextStyle(color: Colors.white), | ||
| labelText: label, | ||
| contentPadding: EdgeInsets.zero, | ||
| floatingLabelBehavior: FloatingLabelBehavior.always, | ||
| focusedBorder: UnderlineInputBorder( | ||
| borderSide: BorderSide(color: Colors.white), | ||
| ), | ||
| enabledBorder: | ||
| UnderlineInputBorder(borderSide: BorderSide(color: Colors.white)), | ||
| ); | ||
| } | ||
|
|
||
| //TO DO: validations | ||
This file contains hidden or 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 hidden or 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,187 @@ | ||
| import 'package:flutter/material.dart'; | ||
| // ignore: import_of_legacy_library_into_null_safe | ||
|
Grrom marked this conversation as resolved.
Outdated
|
||
| import 'package:flutter_icons/flutter_icons.dart'; | ||
| import 'package:memory_lamp/defaults/buttons/ml_elevated_button.dart'; | ||
| import 'package:memory_lamp/form/ml_form.dart'; | ||
| import 'package:memory_lamp/helpers/size_mq.dart'; | ||
| import 'package:memory_lamp/screens/signupCallAction.dart'; | ||
| import 'package:memory_lamp/theming/ml_colors.dart'; | ||
|
|
||
| class LoginScreen extends StatefulWidget { | ||
| static String routeName = '/login'; | ||
| LoginScreen({Key? key}) : super(key: key); | ||
|
|
||
| @override | ||
| _LoginScreenState createState() => _LoginScreenState(); | ||
| } | ||
|
|
||
| class _LoginScreenState extends State<LoginScreen> { | ||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Scaffold( | ||
| backgroundColor: MLColors.primary, | ||
| body: SafeArea( | ||
| child: Container( | ||
| child: SingleChildScrollView( | ||
| child: Container( | ||
| height: SizeMQ.height! * .9, | ||
| padding: EdgeInsets.symmetric(horizontal: SizeMQ.width! * .1), | ||
| child: Column( | ||
| mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| children: [ | ||
| _welcome(), | ||
| SizedBox(width: SizeMQ.width! * .03), | ||
| MLForm(), | ||
| _loginButton(), | ||
| _orDivider(), | ||
| Row( | ||
| mainAxisAlignment: MainAxisAlignment.center, | ||
| children: [ | ||
| _googleLogin(), | ||
| SizedBox(width: SizeMQ.width! * .03), | ||
| _facebookLogin(), | ||
| ], | ||
| ), | ||
| SizedBox(width: SizeMQ.height! * .03), | ||
| SignUpHere(), | ||
| ], | ||
| ), | ||
| ), | ||
| ), | ||
| ), | ||
| ), | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| // ====== COMPONENTS | ||
|
|
||
| //WelcomeMessage | ||
| Column _welcome() => Column( | ||
| mainAxisSize: MainAxisSize.max, | ||
| children: [ | ||
| Align( | ||
| alignment: Alignment.topLeft, | ||
| child: Text( | ||
| "Welcome Back! ", | ||
| style: TextStyle( | ||
| color: Colors.white, | ||
| fontSize: getProportionateScreenWidth(14), | ||
| fontWeight: FontWeight.normal, | ||
| height: 2, | ||
| ), | ||
| ), | ||
| ), | ||
| Align( | ||
| alignment: Alignment.topLeft, | ||
| child: Text( | ||
| 'Sign in to continue', | ||
| style: (TextStyle( | ||
| color: Colors.white54, | ||
| )), | ||
| ), | ||
| ), | ||
| ], | ||
| ); | ||
|
|
||
| //LoginButton | ||
| MLElevatedButton _loginButton() => MLElevatedButton( | ||
| child: Text( | ||
| 'Log in', | ||
| style: TextStyle(color: MLColors.primary), | ||
| ), | ||
| color: Colors.white, | ||
| onPressed: () { | ||
| print('Login'); | ||
| }, | ||
| ); | ||
|
|
||
| //Facebook Login | ||
| Row _facebookLogin() => row( | ||
| MaterialCommunityIcons.facebook, | ||
| 'Facebook', | ||
| Colors.blue[900], | ||
| ); | ||
|
|
||
| //Google Login | ||
| Row _googleLogin() => row( | ||
| MaterialCommunityIcons.google, | ||
| 'Google', | ||
| Colors.red, | ||
| ); | ||
|
|
||
| //for soical media login | ||
| Row row( | ||
| IconData icon, | ||
| String title, | ||
| Color? backgroundColor, | ||
| ) { | ||
| return Row( | ||
| mainAxisSize: MainAxisSize.max, | ||
| children: [ | ||
| TextButton( | ||
| onPressed: () { | ||
| print('logged in'); | ||
| }, | ||
| style: TextButton.styleFrom( | ||
| primary: Colors.white, | ||
| backgroundColor: backgroundColor, | ||
| minimumSize: Size(150, getProportionateScreenHeight(60)), | ||
| shape: RoundedRectangleBorder( | ||
| borderRadius: BorderRadius.circular(9), | ||
| ), | ||
| ), | ||
| child: Row( | ||
| children: [ | ||
| Icon(icon), | ||
| SizedBox( | ||
| width: 15, | ||
| ), | ||
| Text(title), | ||
| ], | ||
| ), | ||
| ), | ||
| ], | ||
| ); | ||
| } | ||
|
|
||
| //ORDivider | ||
| Row _orDivider() => Row( | ||
| mainAxisSize: MainAxisSize.max, | ||
| children: [ | ||
| OrDivider( | ||
| indent: 0, | ||
| endIndent: 10, | ||
| ), | ||
| Text( | ||
| 'OR', | ||
| style: TextStyle(color: Colors.white), | ||
| ), | ||
| OrDivider( | ||
| indent: 10, | ||
| endIndent: 0, | ||
| ), | ||
| ], | ||
| ); | ||
|
|
||
| class OrDivider extends StatelessWidget { | ||
| final double indent; | ||
| final double endIndent; | ||
|
|
||
| const OrDivider({ | ||
| required this.indent, | ||
| required this.endIndent, | ||
| }); | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Expanded( | ||
| child: Divider( | ||
| color: Colors.white, | ||
| indent: indent, | ||
| endIndent: endIndent, | ||
| thickness: 1.0, | ||
| ), | ||
| ); | ||
| } | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.