Forgot password done
continuous-integration/drone/push Build is passing Details

pull/52/head
Emre KARTAL 2 years ago
parent a96d17891f
commit cb1fbb43db

@ -1,4 +1,3 @@
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -27,14 +26,18 @@ class _LoginScreenState extends State<LoginScreen> {
handleLogin() async { handleLogin() async {
if (_formKey.currentState!.validate()) { if (_formKey.currentState!.validate()) {
try { try {
await MyApp.userViewModel.login(_userMailTextField.text, _passwordTextField.text); await MyApp.userViewModel
.login(_userMailTextField.text, _passwordTextField.text);
Navigator.pushNamed(context, '/feed'); Navigator.pushNamed(context, '/feed');
} catch (e) { } catch (e) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text( content: Text(
e.toString() ?? "", e.toString(),
style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w400, fontSize: 20.h), style: GoogleFonts.plusJakartaSans(
color: Colors.white,
fontWeight: FontWeight.w400,
fontSize: 20.h),
), ),
backgroundColor: Colors.red, backgroundColor: Colors.red,
), ),
@ -63,19 +66,25 @@ class _LoginScreenState extends State<LoginScreen> {
child: Form( child: Form(
key: _formKey, key: _formKey,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment:
CrossAxisAlignment.center,
children: [ children: [
Flexible( Flexible(
flex: 4, flex: 4,
child: Padding( child: Padding(
padding: EdgeInsets.only(bottom: 60), padding: EdgeInsets.only(bottom: 60),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment:
MainAxisAlignment.end,
children: [ children: [
Text( Text(
"Te revoilà!", "Te revoilà!",
style: GoogleFonts.plusJakartaSans( style:
color: Colors.white, fontWeight: FontWeight.w600, fontSize: 38.h), GoogleFonts.plusJakartaSans(
color: Colors.white,
fontWeight:
FontWeight.w600,
fontSize: 38.h),
), ),
SizedBox( SizedBox(
height: 10, height: 10,
@ -84,8 +93,12 @@ class _LoginScreenState extends State<LoginScreen> {
width: 230.w, width: 230.w,
child: Text( child: Text(
"Bon retour parmis nous tu nous as manqué!", "Bon retour parmis nous tu nous as manqué!",
style: GoogleFonts.plusJakartaSans( style: GoogleFonts
color: Colors.white, fontWeight: FontWeight.w400, fontSize: 20.h), .plusJakartaSans(
color: Colors.white,
fontWeight:
FontWeight.w400,
fontSize: 20.h),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
), ),
@ -96,33 +109,51 @@ class _LoginScreenState extends State<LoginScreen> {
Expanded( Expanded(
flex: 5, flex: 5,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment:
mainAxisAlignment: MainAxisAlignment.center, CrossAxisAlignment.end,
mainAxisAlignment:
MainAxisAlignment.center,
children: [ children: [
TextFormField( TextFormField(
controller: _userMailTextField, controller: _userMailTextField,
keyboardAppearance: Brightness.dark, keyboardAppearance:
Brightness.dark,
validator: (value) { validator: (value) {
if (value == null || value.isEmpty) { if (value == null ||
value.isEmpty) {
return 'entrez un email valide'; return 'entrez un email valide';
} }
return null; return null;
}, },
cursorColor: primaryColor, cursorColor: primaryColor,
keyboardType: TextInputType.emailAddress, keyboardType:
style: GoogleFonts.plusJakartaSans(color: primaryColor), TextInputType.emailAddress,
style:
GoogleFonts.plusJakartaSans(
color: primaryColor),
decoration: InputDecoration( decoration: InputDecoration(
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(width: 1, color: strokeTextField), borderSide: BorderSide(
borderRadius: BorderRadius.all(Radius.circular(10))), width: 1,
prefix: const Padding(padding: EdgeInsets.only(left: 20.0)), color:
suffix: const Padding(padding: EdgeInsets.only(left: 20.0)), strokeTextField),
borderRadius: BorderRadius.all(
Radius.circular(10))),
prefix: const Padding(
padding: EdgeInsets.only(
left: 20.0)),
suffix: const Padding(
padding: EdgeInsets.only(
left: 20.0)),
fillColor: bgTextField, fillColor: bgTextField,
filled: true, filled: true,
errorStyle: TextStyle(fontSize: 9, height: 0.3), errorStyle: TextStyle(
focusColor: Color.fromRGBO(255, 255, 255, 0.30), fontSize: 9, height: 0.3),
focusColor: Color.fromRGBO(
255, 255, 255, 0.30),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(width: 1, color: strokeTextField), borderSide:
BorderSide(width: 1, color: strokeTextField),
borderRadius: BorderRadius.all(Radius.circular(10))), borderRadius: BorderRadius.all(Radius.circular(10))),
hintText: 'Email', hintText: 'Email',
hintStyle: GoogleFonts.plusJakartaSans(color: strokeTextField)), hintStyle: GoogleFonts.plusJakartaSans(color: strokeTextField)),
@ -132,31 +163,55 @@ class _LoginScreenState extends State<LoginScreen> {
), ),
TextFormField( TextFormField(
controller: _passwordTextField, controller: _passwordTextField,
keyboardAppearance: Brightness.dark, keyboardAppearance:
Brightness.dark,
obscureText: passenable, obscureText: passenable,
validator: (value) { validator: (value) {
if (value == null || value.isEmpty) { if (value == null ||
value.isEmpty) {
return 'entrez un mot de passe valide'; return 'entrez un mot de passe valide';
} }
return null; return null;
}, },
cursorColor: primaryColor, cursorColor: primaryColor,
style: GoogleFonts.plusJakartaSans(color: primaryColor), style:
GoogleFonts.plusJakartaSans(
color: primaryColor),
decoration: InputDecoration( decoration: InputDecoration(
focusedBorder: OutlineInputBorder( focusedBorder:
borderSide: BorderSide(width: 1, color: strokeTextField), OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10))), borderSide: BorderSide(
width: 1,
color:
strokeTextField),
borderRadius:
BorderRadius.all(
Radius.circular(
10))),
fillColor: bgTextField, fillColor: bgTextField,
filled: true, filled: true,
focusColor: Color.fromRGBO(255, 255, 255, 0.30), focusColor: Color.fromRGBO(
enabledBorder: OutlineInputBorder( 255, 255, 255, 0.30),
borderSide: BorderSide(width: 1, color: strokeTextField), enabledBorder:
borderRadius: BorderRadius.all(Radius.circular(10))), OutlineInputBorder(
borderSide: BorderSide(
width: 1,
color:
strokeTextField),
borderRadius:
BorderRadius.all(
Radius.circular(
10))),
hintText: 'Mot de passe', hintText: 'Mot de passe',
hintStyle: GoogleFonts.plusJakartaSans(color: strokeTextField), hintStyle:
prefix: const Padding(padding: EdgeInsets.only(left: 20.0)), GoogleFonts.plusJakartaSans(
color: strokeTextField),
prefix: const Padding(
padding: EdgeInsets.only(
left: 20.0)),
suffixIcon: Container( suffixIcon: Container(
padding: EdgeInsets.only(right: 10), padding: EdgeInsets.only(
right: 10),
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
height: 3, height: 3,
child: InkWell( child: InkWell(
@ -170,25 +225,40 @@ class _LoginScreenState extends State<LoginScreen> {
}); });
}, },
// Image tapped // Image tapped
splashColor: Colors.white10, splashColor:
Colors.white10,
// Splash color over image // Splash color over image
child: Image( child: Image(
image: passenable image: passenable
? AssetImage("assets/images/show_icon.png") ? AssetImage(
: AssetImage("assets/images/hide_icon.png"), "assets/images/show_icon.png")
: AssetImage(
"assets/images/hide_icon.png"),
height: 2, height: 2,
), ),
)), )),
errorStyle: TextStyle(fontSize: 9, height: 0.3), errorStyle: TextStyle(
), fontSize: 9, height: 0.3),
),
Padding(
padding: EdgeInsets.only(top: 10),
child: Text(
"Mot de passe oublié?",
style: GoogleFonts.plusJakartaSans(color: Colors.white),
), ),
), ),
GestureDetector(
behavior:
HitTestBehavior.translucent,
onTap: () {
Navigator.pushNamed(
context, '/forgetPassword');
},
child: Padding(
padding:
EdgeInsets.only(top: 10),
child: Text(
"Mot de passe oublié?",
style: GoogleFonts
.plusJakartaSans(
color:
Colors.white),
),
)),
SizedBox( SizedBox(
height: defaultPadding, height: defaultPadding,
), ),
@ -196,30 +266,44 @@ class _LoginScreenState extends State<LoginScreen> {
width: 600, width: 600,
child: LoginButton( child: LoginButton(
callback: handleLogin, callback: handleLogin,
text: "Se connecter",
)), )),
Align( Align(
child: GestureDetector( child: GestureDetector(
behavior: HitTestBehavior.translucent, behavior:
HitTestBehavior.translucent,
onTap: () { onTap: () {
Navigator.pushNamed(context, '/register'); Navigator.pushNamed(
context, '/register');
}, },
child: Padding( child: Padding(
padding: EdgeInsets.only(top: 20), padding:
EdgeInsets.only(top: 20),
child: RichText( child: RichText(
textAlign: TextAlign.center, textAlign: TextAlign.center,
text: TextSpan( text: TextSpan(
text: 'Pas encore inscrit?', text:
style: GoogleFonts.plusJakartaSans( 'Pas encore inscrit?',
color: Colors.white, style: GoogleFonts
fontWeight: FontWeight.w400, .plusJakartaSans(
fontSize: 15), color:
Colors.white,
fontWeight:
FontWeight
.w400,
fontSize: 15),
children: <TextSpan>[ children: <TextSpan>[
TextSpan( TextSpan(
text: " Sinscire", text: " Sinscire",
style: GoogleFonts.plusJakartaSans( style: GoogleFonts
fontSize: 15, .plusJakartaSans(
fontWeight: FontWeight.w400, fontSize:
color: primaryColor)), 15,
fontWeight:
FontWeight
.w400,
color:
primaryColor)),
], ],
), ),
), ),
@ -234,38 +318,55 @@ class _LoginScreenState extends State<LoginScreen> {
child: Padding( child: Padding(
padding: EdgeInsets.only(top: 20), padding: EdgeInsets.only(top: 20),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.center, MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [ children: [
ConstrainedBox( ConstrainedBox(
constraints: BoxConstraints(maxWidth: 600), constraints: BoxConstraints(
maxWidth: 600),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [ children: [
Expanded( Expanded(
child: Container( child: Container(
color: Color(0xFF3D3D3D), color:
Color(0xFF3D3D3D),
height: 1, height: 1,
), ),
), ),
Padding( Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets
left: defaultPadding, right: defaultPadding), .only(
left:
defaultPadding,
right:
defaultPadding),
child: Text( child: Text(
'Ou', 'Ou',
style: GoogleFonts.plusJakartaSans( style: GoogleFonts
color: Colors.white, fontWeight: FontWeight.bold), .plusJakartaSans(
color: Colors
.white,
fontWeight:
FontWeight
.bold),
), ),
), ),
Expanded( Expanded(
child: Container( child: Container(
height: 1, height: 1,
color: Color(0xFF3D3D3D), color:
Color(0xFF3D3D3D),
)), )),
], ],
), ),
), ),
SizedBox(height: defaultPadding), SizedBox(
height: defaultPadding),
SignInButton( SignInButton(
Buttons.Google, Buttons.Google,
text: "Login with Google", text: "Login with Google",

Loading…
Cancel
Save