Created
October 8, 2019 19:16
-
-
Save rpsnaik/3a5975bfbd75ed2a903c3625c8e9ee95 to your computer and use it in GitHub Desktop.
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
class LoginPage extends StatelessWidget { | |
final TextEditingController emailCtrl = TextEditingController(); | |
final TextEditingController passCtrl = TextEditingController(); | |
@override | |
Widget build(BuildContext context) { | |
final loginLogic = Provider.of<LoginLogic>(context); | |
final uiComponents = Provider.of<ShowCustomAlertDialog>(context); | |
return Scaffold( | |
backgroundColor: Colors.black, | |
appBar: AppBar( | |
elevation: 0.0, | |
backgroundColor: Colors.black, | |
), | |
body: Container( | |
padding: EdgeInsets.all(10.0), | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.start, | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
Text("Email or userame", style: TextStyle( | |
fontSize: 30.0, | |
fontFamily: 'Proxima Nova Bold', | |
),), | |
SizedBox( | |
height: 5.0, | |
), | |
TextFormField( | |
controller: emailCtrl, | |
autofocus: false, | |
decoration: InputDecoration( | |
contentPadding: EdgeInsets.all(16.0), | |
fillColor: Colors.grey, | |
filled: true, | |
border: OutlineInputBorder(), | |
), | |
onChanged: (String text){ | |
loginLogic.loginButtonListener(emailCtrl.text, passCtrl.text); | |
}, | |
), | |
SizedBox( | |
height: 30.0, | |
), | |
Text("Password", style: TextStyle( | |
fontSize: 30.0, | |
fontFamily: 'Proxima Nova Bold', | |
),), | |
SizedBox( | |
height: 5.0, | |
), | |
TextFormField( | |
controller: passCtrl, | |
obscureText: !loginLogic.showPassword, | |
autofocus: false, | |
decoration: InputDecoration( | |
contentPadding: EdgeInsets.all(16.0), | |
fillColor: Colors.grey, | |
filled: true, | |
border: OutlineInputBorder(), | |
suffixIcon: IconButton( | |
onPressed: (){ | |
loginLogic.showPassFun(); | |
}, | |
icon: loginLogic.showPassword ? Icon(Icons.visibility, color: Colors.white,) : Icon(Icons.visibility_off , color: Colors.white,), | |
) | |
), | |
onChanged: (String text){ | |
loginLogic.loginButtonListener(emailCtrl.text, passCtrl.text); | |
}, | |
), | |
SizedBox( | |
height: 20.0, | |
), | |
Center( | |
child: loginLogic.isAuthenticating ? CircularProgressIndicator() : RaisedButton( | |
padding: EdgeInsets.fromLTRB(45.0, 15.0, 45.0, 15.0), | |
onPressed: (){ | |
FocusScope.of(context).unfocus(); | |
loginLogic.loginButton ? loginLogic.loginIn(context ,emailCtrl.text, passCtrl.text) : uiComponents.showCustomDialog(context, "Enter your Email and Password") ; | |
}, | |
color: loginLogic.loginButton ? Colors.white : Colors.grey, | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(100.0), | |
), | |
child: Text("LOG IN", style: TextStyle( | |
color: Colors.black, | |
fontSize: 18.0, | |
fontFamily: 'Proxima Nova Bold' | |
),), | |
), | |
), | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment