⚰️ remove useless SingleChidScrollView on login and signup

profile
remrem 2 years ago
parent 44c38bbdb7
commit 2aa6c43f5d

@ -72,217 +72,214 @@ class _MobileLoginView extends State<MobileLoginView> {
var media = MediaQuery.of(context).size; var media = MediaQuery.of(context).size;
return Scaffold( return Scaffold(
backgroundColor: TColor.white, backgroundColor: TColor.white,
body: SingleChildScrollView( body: SafeArea(
child: SafeArea( child: Container(
child: Container( height: media.height * 0.9,
height: media.height * 0.9, padding: const EdgeInsets.symmetric(horizontal: 20),
padding: const EdgeInsets.symmetric(horizontal: 20), child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, children: [
children: [ Text(
Text( "Bienvenue",
"Bienvenue", style: TextStyle(color: TColor.gray, fontSize: 16),
style: TextStyle(color: TColor.gray, fontSize: 16), ),
), Text(
Text( "Se connecter",
"Se connecter", style: TextStyle(
style: TextStyle( color: TColor.black,
color: TColor.black, fontSize: 20,
fontSize: 20, fontWeight: FontWeight.w700),
fontWeight: FontWeight.w700), ),
), SizedBox(
SizedBox( height: media.width * 0.05,
height: media.width * 0.05, ),
), SizedBox(
SizedBox( height: media.width * 0.04,
height: media.width * 0.04, ),
), RoundTextField(
RoundTextField( hitText: "Email",
hitText: "Email", icon: "assets/img/email.svg",
icon: "assets/img/email.svg", keyboardType: TextInputType.emailAddress,
keyboardType: TextInputType.emailAddress, controller: controllerTextEmail,
controller: controllerTextEmail, ),
), SizedBox(
SizedBox( height: media.width * 0.04,
height: media.width * 0.04, ),
), RoundTextField(
RoundTextField( controller: controllerTextPassword,
controller: controllerTextPassword, hitText: "Mot de passe",
hitText: "Mot de passe", icon: "assets/img/lock.svg",
icon: "assets/img/lock.svg", obscureText: _obscureText,
obscureText: _obscureText, rigtIcon: TextButton(
rigtIcon: TextButton( onPressed: _toggle,
onPressed: _toggle, child: Container(
child: Container( alignment: Alignment.center,
alignment: Alignment.center, width: 20,
height: 20,
child: SvgPicture.asset(
"assets/img/show_password.svg",
width: 20, width: 20,
height: 20, height: 20,
child: SvgPicture.asset( fit: BoxFit.contain,
"assets/img/show_password.svg", ))),
width: 20, ),
height: 20, Row(
fit: BoxFit.contain, mainAxisAlignment: MainAxisAlignment.center,
))), children: [
), Text(
Row( "Mot de passe oublié ?",
mainAxisAlignment: MainAxisAlignment.center, style: TextStyle(
children: [ color: TColor.gray,
Text( fontSize: 15,
"Mot de passe oublié ?", decoration: TextDecoration.underline),
style: TextStyle( ),
color: TColor.gray, ],
fontSize: 15, ),
decoration: TextDecoration.underline), SizedBox(
), height: media.width * 0.04,
], ),
), Visibility(
SizedBox( visible: _errorLogin,
height: media.width * 0.04, child: Text("Error - $_msgError",
), style: TextStyle(color: TColor.red))),
Visibility( const Spacer(),
visible: _errorLogin, RoundButton(
child: Text("Error - $_msgError", title: "Se connecter",
style: TextStyle(color: TColor.red))), onPressed: () async {
const Spacer(), if (!emailValidate || !passwordValidate) {
RoundButton( _printMsgError("Les champs renseigné ne sont pas valide");
title: "Se connecter", return;
onPressed: () async { }
if (!emailValidate || !passwordValidate) { Tuple2<bool, String> result =
_printMsgError( await util.checkLoginAndPassword(
"Les champs renseigné ne sont pas valide"); controllerTextEmail.text,
return; controllerTextPassword.text);
}
Tuple2<bool, String> result =
await util.checkLoginAndPassword(
controllerTextEmail.text,
controllerTextPassword.text);
if (result.item1 == true) {
Tuple2 infoUser = await util.getUserInfo(result.item2);
if (infoUser.item1 == false) { if (result.item1 == true) {
//print("Erreur - Impossible de récupéré les données de l'utilisateur"); Tuple2 infoUser = await util.getUserInfo(result.item2);
_printMsgError(
"Impossible de récupéré les données de l'utilisateur - {$infoUser.item2}");
} else {
util.fillUser(context, infoUser.item2, result.item2);
Navigator.push( if (infoUser.item1 == false) {
context, //print("Erreur - Impossible de récupéré les données de l'utilisateur");
MaterialPageRoute( _printMsgError(
builder: (context) => const MainTabView())); "Impossible de récupéré les données de l'utilisateur - {$infoUser.item2}");
}
} else { } else {
_printMsgError("Connexion refuser - ${result.item2}"); util.fillUser(context, infoUser.item2, result.item2);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const MainTabView()));
} }
}), } else {
SizedBox( _printMsgError("Connexion refuser - ${result.item2}");
height: media.width * 0.04, }
), }),
Row( SizedBox(
// crossAxisAlignment: CrossAxisAlignment., height: media.width * 0.04,
children: [ ),
Expanded( Row(
child: Container( // crossAxisAlignment: CrossAxisAlignment.,
height: 1, children: [
color: TColor.gray.withOpacity(0.5), Expanded(
)),
Text(
" Or ",
style: TextStyle(color: TColor.black, fontSize: 12),
),
Expanded(
child: Container(
height: 1,
color: TColor.gray.withOpacity(0.5),
)),
],
),
SizedBox(
height: media.width * 0.04,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GestureDetector(
onTap: () {},
child: Container( child: Container(
width: 50, height: 1,
height: 50, color: TColor.gray.withOpacity(0.5),
alignment: Alignment.center, )),
decoration: BoxDecoration( Text(
color: TColor.white, " Or ",
border: Border.all( style: TextStyle(color: TColor.black, fontSize: 12),
width: 1, ),
color: TColor.gray.withOpacity(0.4), Expanded(
), child: Container(
borderRadius: BorderRadius.circular(15), height: 1,
), color: TColor.gray.withOpacity(0.5),
child: Image.asset( )),
"assets/img/google.png", ],
width: 20, ),
height: 20, SizedBox(
height: media.width * 0.04,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GestureDetector(
onTap: () {},
child: Container(
width: 50,
height: 50,
alignment: Alignment.center,
decoration: BoxDecoration(
color: TColor.white,
border: Border.all(
width: 1,
color: TColor.gray.withOpacity(0.4),
), ),
borderRadius: BorderRadius.circular(15),
),
child: Image.asset(
"assets/img/google.png",
width: 20,
height: 20,
), ),
), ),
SizedBox( ),
width: media.width * 0.04, SizedBox(
), width: media.width * 0.04,
GestureDetector( ),
onTap: () {}, GestureDetector(
child: Container( onTap: () {},
width: 50, child: Container(
height: 50, width: 50,
alignment: Alignment.center, height: 50,
decoration: BoxDecoration( alignment: Alignment.center,
color: TColor.white, decoration: BoxDecoration(
border: Border.all( color: TColor.white,
width: 1, border: Border.all(
color: TColor.gray.withOpacity(0.4), width: 1,
), color: TColor.gray.withOpacity(0.4),
borderRadius: BorderRadius.circular(15),
),
child: Image.asset(
"assets/img/suunto.png",
width: 35,
height: 35,
), ),
borderRadius: BorderRadius.circular(15),
), ),
) child: Image.asset(
], "assets/img/suunto.png",
), width: 35,
SizedBox( height: 35,
height: media.width * 0.04, ),
), ),
TextButton( )
onPressed: () { ],
Navigator.pop(context); ),
}, SizedBox(
child: Column( height: media.width * 0.04,
mainAxisSize: MainAxisSize.min, ),
children: [ TextButton(
Text( onPressed: () {
"Vous n'avez pas toujours pas de compte ? ", Navigator.pop(context);
style: TextStyle( },
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Vous n'avez pas toujours pas de compte ? ",
style: TextStyle(
color: TColor.black,
fontSize: 14,
),
),
Text(
"Créer un compte",
style: TextStyle(
color: TColor.black, color: TColor.black,
fontSize: 14, fontSize: 14,
), fontWeight: FontWeight.w700),
), )
Text( ],
"Créer un compte",
style: TextStyle(
color: TColor.black,
fontSize: 14,
fontWeight: FontWeight.w700),
)
],
),
),
SizedBox(
height: media.width * 0.04,
), ),
], ),
), SizedBox(
height: media.width * 0.04,
),
],
), ),
), ),
), ),

@ -91,230 +91,227 @@ class _MobileSignUpView extends State<MobileSignUpView> {
var media = MediaQuery.of(context).size; var media = MediaQuery.of(context).size;
return Scaffold( return Scaffold(
backgroundColor: TColor.white, backgroundColor: TColor.white,
body: SingleChildScrollView( body: SafeArea(
child: SafeArea( child: Padding(
child: Padding( padding: const EdgeInsets.symmetric(horizontal: 20),
padding: const EdgeInsets.symmetric(horizontal: 20), child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, children: [
children: [ Text(
Text( "Bienvenue,",
"Bienvenue,", style: TextStyle(color: TColor.gray, fontSize: 16),
style: TextStyle(color: TColor.gray, fontSize: 16), ),
), Text(
Text( "Créer un compte",
"Créer un compte", style: TextStyle(
style: TextStyle( color: TColor.black,
color: TColor.black, fontSize: 20,
fontSize: 20, fontWeight: FontWeight.w700),
fontWeight: FontWeight.w700), ),
), SizedBox(
SizedBox( height: media.width * 0.05,
height: media.width * 0.05, ),
), RoundTextField(
RoundTextField( hitText: "Prénom",
hitText: "Prénom", icon: "assets/img/user_text.svg",
icon: "assets/img/user_text.svg", controller: controllerUsername,
controller: controllerUsername, ),
), SizedBox(
SizedBox( height: media.width * 0.04,
height: media.width * 0.04, ),
), RoundTextField(
RoundTextField( hitText: "Email",
hitText: "Email", icon: "assets/img/email.svg",
icon: "assets/img/email.svg", keyboardType: TextInputType.emailAddress,
keyboardType: TextInputType.emailAddress, controller: controllerTextEmail,
controller: controllerTextEmail, ),
), SizedBox(
SizedBox( height: media.width * 0.04,
height: media.width * 0.04, ),
), RoundTextField(
RoundTextField( hitText: "Mot de passe",
hitText: "Mot de passe", icon: "assets/img/lock.svg",
icon: "assets/img/lock.svg", obscureText: _obscureText,
obscureText: _obscureText, controller: controllerTextPassword,
controller: controllerTextPassword, rigtIcon: TextButton(
rigtIcon: TextButton( onPressed: _toggle,
onPressed: _toggle, child: Container(
child: Container( alignment: Alignment.center,
alignment: Alignment.center, width: 20,
height: 20,
child: SvgPicture.asset(
"assets/img/show_password.svg",
width: 20, width: 20,
height: 20, height: 20,
child: SvgPicture.asset( fit: BoxFit.contain,
"assets/img/show_password.svg", ))),
width: 20, ),
height: 20, Row(
fit: BoxFit.contain, // crossAxisAlignment: CrossAxisAlignment.,
))), children: [
), IconButton(
Row( onPressed: () {
// crossAxisAlignment: CrossAxisAlignment., _check();
children: [ },
IconButton( icon: Icon(
onPressed: () { _isCheck
_check(); ? Icons.check_box_outlined
}, : Icons.check_box_outline_blank_outlined,
icon: Icon( color: TColor.gray,
_isCheck size: 20,
? Icons.check_box_outlined
: Icons.check_box_outline_blank_outlined,
color: TColor.gray,
size: 20,
),
), ),
Padding( ),
padding: const EdgeInsets.only(top: 8), Padding(
child: Text( padding: const EdgeInsets.only(top: 8),
"En continuant, vous acceptez notre Politique de\nconfidentialité et nos Conditions d'utilisation.", child: Text(
style: TextStyle(color: TColor.gray, fontSize: 10), "En continuant, vous acceptez notre Politique de\nconfidentialité et nos Conditions d'utilisation.",
), style: TextStyle(color: TColor.gray, fontSize: 10),
)
],
),
SizedBox(
height: media.width * 0.05,
),
Visibility(
visible: _errorCreateUser,
child: Text("Error - $_msgError",
style: TextStyle(color: TColor.red))),
SizedBox(
height: media.width * 0.4,
),
RoundButton(
title: "Créer un compte",
onPressed: () async {
if (!emailValidate ||
!passwordValidate ||
!usernameValidate) {
_printMsgError(
"Les champs renseigné ne sont pas valide");
return;
}
Tuple2<bool, String> result = await util.createUser(
controllerTextEmail.text,
controllerUsername.text,
controllerTextPassword.text);
if (result.item1) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const LoginView()));
} else {
_printMsgError(result.item2);
}
}),
SizedBox(
height: media.width * 0.04,
),
Row(
// crossAxisAlignment: CrossAxisAlignment.,
children: [
Expanded(
child: Container(
height: 1,
color: TColor.gray.withOpacity(0.5),
)),
Text(
" Ou ",
style: TextStyle(color: TColor.black, fontSize: 12),
), ),
Expanded( )
child: Container( ],
height: 1, ),
color: TColor.gray.withOpacity(0.5), SizedBox(
)), height: media.width * 0.05,
], ),
), Visibility(
SizedBox( visible: _errorCreateUser,
height: media.width * 0.04, child: Text("Error - $_msgError",
), style: TextStyle(color: TColor.red))),
Row( SizedBox(
mainAxisAlignment: MainAxisAlignment.center, height: media.width * 0.4,
children: [ ),
GestureDetector( RoundButton(
onTap: () {}, title: "Créer un compte",
onPressed: () async {
if (!emailValidate ||
!passwordValidate ||
!usernameValidate) {
_printMsgError("Les champs renseigné ne sont pas valide");
return;
}
Tuple2<bool, String> result = await util.createUser(
controllerTextEmail.text,
controllerUsername.text,
controllerTextPassword.text);
if (result.item1) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const LoginView()));
} else {
_printMsgError(result.item2);
}
}),
SizedBox(
height: media.width * 0.04,
),
Row(
// crossAxisAlignment: CrossAxisAlignment.,
children: [
Expanded(
child: Container( child: Container(
width: 50, height: 1,
height: 50, color: TColor.gray.withOpacity(0.5),
alignment: Alignment.center, )),
decoration: BoxDecoration( Text(
color: TColor.white, " Ou ",
border: Border.all( style: TextStyle(color: TColor.black, fontSize: 12),
width: 1, ),
color: TColor.gray.withOpacity(0.4), Expanded(
), child: Container(
borderRadius: BorderRadius.circular(15), height: 1,
), color: TColor.gray.withOpacity(0.5),
child: Image.asset( )),
"assets/img/google.png", ],
width: 20, ),
height: 20, SizedBox(
height: media.width * 0.04,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GestureDetector(
onTap: () {},
child: Container(
width: 50,
height: 50,
alignment: Alignment.center,
decoration: BoxDecoration(
color: TColor.white,
border: Border.all(
width: 1,
color: TColor.gray.withOpacity(0.4),
), ),
borderRadius: BorderRadius.circular(15),
),
child: Image.asset(
"assets/img/google.png",
width: 20,
height: 20,
), ),
), ),
SizedBox( ),
width: media.width * 0.04, SizedBox(
), width: media.width * 0.04,
GestureDetector( ),
onTap: () {}, GestureDetector(
child: Container( onTap: () {},
width: 50, child: Container(
height: 50, width: 50,
alignment: Alignment.center, height: 50,
decoration: BoxDecoration( alignment: Alignment.center,
color: TColor.white, decoration: BoxDecoration(
border: Border.all( color: TColor.white,
width: 1, border: Border.all(
color: TColor.gray.withOpacity(0.4), width: 1,
), color: TColor.gray.withOpacity(0.4),
borderRadius: BorderRadius.circular(15),
),
child: Image.asset(
"assets/img/suunto.png",
width: 35,
height: 35,
), ),
borderRadius: BorderRadius.circular(15),
), ),
) child: Image.asset(
], "assets/img/suunto.png",
), width: 35,
SizedBox( height: 35,
height: media.width * 0.04, ),
), ),
TextButton( )
onPressed: () { ],
Navigator.push( ),
context, SizedBox(
MaterialPageRoute( height: media.width * 0.04,
builder: (context) => const LoginView())); ),
}, TextButton(
child: Row( onPressed: () {
mainAxisSize: MainAxisSize.min, Navigator.push(
children: [ context,
Text( MaterialPageRoute(
"Vous avez déjà un compte ? ", builder: (context) => const LoginView()));
style: TextStyle( },
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Vous avez déjà un compte ? ",
style: TextStyle(
color: TColor.black,
fontSize: 14,
),
),
Text(
"Se connecter",
style: TextStyle(
color: TColor.black, color: TColor.black,
fontSize: 14, fontSize: 14,
), fontWeight: FontWeight.w700),
), )
Text( ],
"Se connecter",
style: TextStyle(
color: TColor.black,
fontSize: 14,
fontWeight: FontWeight.w700),
)
],
),
),
SizedBox(
height: media.width * 0.04,
), ),
], ),
), SizedBox(
height: media.width * 0.04,
),
],
), ),
), ),
), ),

@ -73,148 +73,144 @@ class _WebLoginView extends State<WebLoginView> {
var media = MediaQuery.of(context).size; var media = MediaQuery.of(context).size;
return Scaffold( return Scaffold(
backgroundColor: TColor.white, backgroundColor: TColor.white,
body: SingleChildScrollView( body: SafeArea(
child: SafeArea( child: Container(
child: Container( padding: const EdgeInsets.symmetric(horizontal: 300),
padding: const EdgeInsets.symmetric(horizontal: 300), height: media.height,
height: media.height, child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, children: [
children: [ SizedBox(
SizedBox( height: media.width * 0.03,
height: media.width * 0.03, ),
), Text(
Text( "Bienvenue sur SmartFit",
"Bienvenue", style: TextStyle(color: TColor.gray, fontSize: 16),
style: TextStyle(color: TColor.gray, fontSize: 16), ),
), Text(
Text( "Se connecter",
"Se connecter", style: TextStyle(
style: TextStyle( color: TColor.black,
color: TColor.black, fontSize: 20,
fontSize: 20, fontWeight: FontWeight.w700),
fontWeight: FontWeight.w700), ),
), SizedBox(
SizedBox( height: media.width * 0.04,
height: media.width * 0.04, ),
), RoundTextField(
RoundTextField( hitText: "Email",
hitText: "Email", icon: "assets/img/email.svg",
icon: "assets/img/email.svg", keyboardType: TextInputType.emailAddress,
keyboardType: TextInputType.emailAddress, controller: controllerTextEmail,
controller: controllerTextEmail, ),
), SizedBox(
SizedBox( height: media.width * 0.04,
height: media.width * 0.04, ),
), RoundTextField(
RoundTextField( controller: controllerTextPassword,
controller: controllerTextPassword, hitText: "Mot de passe",
hitText: "Mot de passe", icon: "assets/img/lock.svg",
icon: "assets/img/lock.svg", obscureText: _obscureText,
obscureText: _obscureText, rigtIcon: TextButton(
rigtIcon: TextButton( onPressed: _toggle,
onPressed: _toggle, child: Container(
child: Container( alignment: Alignment.center,
alignment: Alignment.center, width: 20,
height: 20,
child: SvgPicture.asset(
"assets/img/show_password.svg",
width: 20, width: 20,
height: 20, height: 20,
child: SvgPicture.asset( fit: BoxFit.contain,
"assets/img/show_password.svg", ))),
width: 20, ),
height: 20, SizedBox(
fit: BoxFit.contain, height: media.width * 0.01,
))), ),
), Row(
SizedBox( mainAxisAlignment: MainAxisAlignment.center,
height: media.width * 0.01, children: [
), Text(
Row( "Mot de passe oublié ?",
mainAxisAlignment: MainAxisAlignment.center, style: TextStyle(
children: [ color: TColor.gray,
Text( fontSize: 15,
"Mot de passe oublié ?", decoration: TextDecoration.underline),
style: TextStyle( ),
color: TColor.gray, ],
fontSize: 15, ),
decoration: TextDecoration.underline), SizedBox(
), height: media.width * 0.04,
], ),
), Visibility(
SizedBox( visible: _errorLogin,
height: media.width * 0.04, child: Text("Error - $_msgError",
), style: TextStyle(color: TColor.red))),
Visibility( const Spacer(),
visible: _errorLogin, RoundButton(
child: Text("Error - $_msgError", title: "Se connecter",
style: TextStyle(color: TColor.red))), onPressed: () async {
const Spacer(), if (!emailValidate || !passwordValidate) {
RoundButton( _printMsgError("Les champs renseigné ne sont pas valide");
title: "Se connecter", return;
onPressed: () async { }
if (!emailValidate || !passwordValidate) { Tuple2<bool, String> result =
_printMsgError( await util.checkLoginAndPassword(
"Les champs renseigné ne sont pas valide"); controllerTextEmail.text,
return; controllerTextPassword.text);
}
Tuple2<bool, String> result =
await util.checkLoginAndPassword(
controllerTextEmail.text,
controllerTextPassword.text);
if (result.item1 == true) { if (result.item1 == true) {
Tuple2 infoUser = await util.getUserInfo(result.item2); Tuple2 infoUser = await util.getUserInfo(result.item2);
if (infoUser.item1 == false) { if (infoUser.item1 == false) {
//print("Erreur - Impossible de récupéré les données de l'utilisateur"); //print("Erreur - Impossible de récupéré les données de l'utilisateur");
_printMsgError( _printMsgError(
"Impossible de récupéré les données de l'utilisateur - {$infoUser.item2}"); "Impossible de récupéré les données de l'utilisateur - {$infoUser.item2}");
} else {
util.fillUser(context, infoUser.item2, result.item2);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const MainTabView()));
}
} else { } else {
_printMsgError("Connexion refuser - ${result.item2}"); util.fillUser(context, infoUser.item2, result.item2);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const MainTabView()));
} }
}), } else {
SizedBox( _printMsgError("Connexion refuser - ${result.item2}");
height: media.width * 0.04, }
), }),
SizedBox(
SizedBox( height: media.width * 0.04,
height: media.width * 0.04, ),
), SizedBox(
TextButton( height: media.width * 0.04,
onPressed: () { ),
Navigator.pop(context); TextButton(
}, onPressed: () {
child: Column( Navigator.pop(context);
mainAxisSize: MainAxisSize.min, },
children: [ child: Column(
Text( mainAxisSize: MainAxisSize.min,
"Vous n'avez pas toujours pas de compte ? ", children: [
style: TextStyle( Text(
"Vous n'avez pas toujours pas de compte ? ",
style: TextStyle(
color: TColor.black,
fontSize: 14,
),
),
Text(
"Créer un compte",
style: TextStyle(
color: TColor.black, color: TColor.black,
fontSize: 14, fontSize: 14,
), fontWeight: FontWeight.w700),
), )
Text( ],
"Créer un compte",
style: TextStyle(
color: TColor.black,
fontSize: 14,
fontWeight: FontWeight.w700),
)
],
),
),
SizedBox(
height: media.width * 0.04,
), ),
], ),
), SizedBox(
height: media.width * 0.04,
),
],
), ),
), ),
), ),

@ -90,159 +90,154 @@ class _WebSignUpView extends State<WebSignUpView> {
var media = MediaQuery.of(context).size; var media = MediaQuery.of(context).size;
return Scaffold( return Scaffold(
backgroundColor: TColor.white, backgroundColor: TColor.white,
body: SingleChildScrollView( body: SafeArea(
child: SafeArea( child: Padding(
child: Padding( padding: const EdgeInsets.symmetric(horizontal: 300),
padding: const EdgeInsets.symmetric(horizontal: 300), child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, children: [
children: [ SizedBox(
SizedBox( height: media.width * 0.04,
height: media.width * 0.04, ),
), Text(
Text( "Bienvenue,",
"Bienvenue,", style: TextStyle(color: TColor.gray, fontSize: 16),
style: TextStyle(color: TColor.gray, fontSize: 16), ),
), Text(
Text( "Créer un compte",
"Créer un compte", style: TextStyle(
style: TextStyle( color: TColor.black,
color: TColor.black, fontSize: 20,
fontSize: 20, fontWeight: FontWeight.w700),
fontWeight: FontWeight.w700), ),
), SizedBox(
SizedBox( height: media.width * 0.05,
height: media.width * 0.05, ),
), RoundTextField(
RoundTextField( hitText: "Prénom",
hitText: "Prénom", icon: "assets/img/user_text.svg",
icon: "assets/img/user_text.svg", controller: controllerUsername,
controller: controllerUsername, ),
), SizedBox(
SizedBox( height: media.width * 0.04,
height: media.width * 0.04, ),
), RoundTextField(
RoundTextField( hitText: "Email",
hitText: "Email", icon: "assets/img/email.svg",
icon: "assets/img/email.svg", keyboardType: TextInputType.emailAddress,
keyboardType: TextInputType.emailAddress, controller: controllerTextEmail,
controller: controllerTextEmail, ),
), SizedBox(
SizedBox( height: media.width * 0.04,
height: media.width * 0.04, ),
), RoundTextField(
RoundTextField( hitText: "Mot de passe",
hitText: "Mot de passe", icon: "assets/img/lock.svg",
icon: "assets/img/lock.svg", obscureText: _obscureText,
obscureText: _obscureText, controller: controllerTextPassword,
controller: controllerTextPassword, rigtIcon: TextButton(
rigtIcon: TextButton( onPressed: _toggle,
onPressed: _toggle, child: Container(
child: Container( alignment: Alignment.center,
alignment: Alignment.center, width: 20,
height: 20,
child: SvgPicture.asset(
"assets/img/show_password.svg",
width: 20, width: 20,
height: 20, height: 20,
child: SvgPicture.asset( fit: BoxFit.contain,
"assets/img/show_password.svg", ))),
width: 20, ),
height: 20, Row(
fit: BoxFit.contain, // crossAxisAlignment: CrossAxisAlignment.,
))), children: [
), IconButton(
Row( onPressed: () {
// crossAxisAlignment: CrossAxisAlignment., _check();
},
icon: Icon(
_isCheck
? Icons.check_box_outlined
: Icons.check_box_outline_blank_outlined,
color: TColor.gray,
size: 20,
),
),
Padding(
padding: const EdgeInsets.only(top: 8),
child: Text(
"En continuant, vous acceptez notre Politique de\nconfidentialité et nos Conditions d'utilisation.",
style: TextStyle(color: TColor.gray, fontSize: 10),
),
)
],
),
Visibility(
visible: _errorCreateUser,
child: Text("Error - $_msgError",
style: TextStyle(color: TColor.red))),
SizedBox(
height: media.width * 0.05,
),
RoundButton(
title: "Créer un compte",
onPressed: () async {
if (!emailValidate ||
!passwordValidate ||
!usernameValidate) {
_printMsgError("Les champs renseigné ne sont pas valide");
return;
}
Tuple2<bool, String> result = await util.createUser(
controllerTextEmail.text,
controllerUsername.text,
controllerTextPassword.text);
if (result.item1) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const LoginView()));
} else {
_printMsgError(result.item2);
}
}),
SizedBox(
height: media.width * 0.04,
),
SizedBox(
height: media.width * 0.04,
),
TextButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const LoginView()));
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [ children: [
IconButton( Text(
onPressed: () { "Vous avez déjà un compte ? ",
_check(); style: TextStyle(
}, color: TColor.black,
icon: Icon( fontSize: 14,
_isCheck
? Icons.check_box_outlined
: Icons.check_box_outline_blank_outlined,
color: TColor.gray,
size: 20,
), ),
), ),
Padding( Text(
padding: const EdgeInsets.only(top: 8), "Se connecter",
child: Text( style: TextStyle(
"En continuant, vous acceptez notre Politique de\nconfidentialité et nos Conditions d'utilisation.",
style: TextStyle(color: TColor.gray, fontSize: 10),
),
)
],
),
Visibility(
visible: _errorCreateUser,
child: Text("Error - $_msgError",
style: TextStyle(color: TColor.red))),
SizedBox(
height: media.width * 0.05,
),
RoundButton(
title: "Créer un compte",
onPressed: () async {
if (!emailValidate ||
!passwordValidate ||
!usernameValidate) {
_printMsgError(
"Les champs renseigné ne sont pas valide");
return;
}
Tuple2<bool, String> result = await util.createUser(
controllerTextEmail.text,
controllerUsername.text,
controllerTextPassword.text);
if (result.item1) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const LoginView()));
} else {
_printMsgError(result.item2);
}
}),
SizedBox(
height: media.width * 0.04,
),
SizedBox(
height: media.width * 0.04,
),
TextButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const LoginView()));
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Vous avez déjà un compte ? ",
style: TextStyle(
color: TColor.black, color: TColor.black,
fontSize: 14, fontSize: 14,
), fontWeight: FontWeight.w700),
), )
Text( ],
"Se connecter",
style: TextStyle(
color: TColor.black,
fontSize: 14,
fontWeight: FontWeight.w700),
)
],
),
),
SizedBox(
height: media.width * 0.04,
), ),
], ),
), SizedBox(
height: media.width * 0.04,
),
],
), ),
), ),
), ),

Loading…
Cancel
Save