⚰️ remove useless SingleChidScrollView on login and signup

profile
remrem 1 year ago
parent 44c38bbdb7
commit 2aa6c43f5d

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

@ -91,230 +91,227 @@ class _MobileSignUpView extends State<MobileSignUpView> {
var media = MediaQuery.of(context).size;
return Scaffold(
backgroundColor: TColor.white,
body: SingleChildScrollView(
child: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"Bienvenue,",
style: TextStyle(color: TColor.gray, fontSize: 16),
),
Text(
"Créer un compte",
style: TextStyle(
color: TColor.black,
fontSize: 20,
fontWeight: FontWeight.w700),
),
SizedBox(
height: media.width * 0.05,
),
RoundTextField(
hitText: "Prénom",
icon: "assets/img/user_text.svg",
controller: controllerUsername,
),
SizedBox(
height: media.width * 0.04,
),
RoundTextField(
hitText: "Email",
icon: "assets/img/email.svg",
keyboardType: TextInputType.emailAddress,
controller: controllerTextEmail,
),
SizedBox(
height: media.width * 0.04,
),
RoundTextField(
hitText: "Mot de passe",
icon: "assets/img/lock.svg",
obscureText: _obscureText,
controller: controllerTextPassword,
rigtIcon: TextButton(
onPressed: _toggle,
child: Container(
alignment: Alignment.center,
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"Bienvenue,",
style: TextStyle(color: TColor.gray, fontSize: 16),
),
Text(
"Créer un compte",
style: TextStyle(
color: TColor.black,
fontSize: 20,
fontWeight: FontWeight.w700),
),
SizedBox(
height: media.width * 0.05,
),
RoundTextField(
hitText: "Prénom",
icon: "assets/img/user_text.svg",
controller: controllerUsername,
),
SizedBox(
height: media.width * 0.04,
),
RoundTextField(
hitText: "Email",
icon: "assets/img/email.svg",
keyboardType: TextInputType.emailAddress,
controller: controllerTextEmail,
),
SizedBox(
height: media.width * 0.04,
),
RoundTextField(
hitText: "Mot de passe",
icon: "assets/img/lock.svg",
obscureText: _obscureText,
controller: controllerTextPassword,
rigtIcon: TextButton(
onPressed: _toggle,
child: Container(
alignment: Alignment.center,
width: 20,
height: 20,
child: SvgPicture.asset(
"assets/img/show_password.svg",
width: 20,
height: 20,
child: SvgPicture.asset(
"assets/img/show_password.svg",
width: 20,
height: 20,
fit: BoxFit.contain,
))),
),
Row(
// crossAxisAlignment: CrossAxisAlignment.,
children: [
IconButton(
onPressed: () {
_check();
},
icon: Icon(
_isCheck
? Icons.check_box_outlined
: Icons.check_box_outline_blank_outlined,
color: TColor.gray,
size: 20,
),
fit: BoxFit.contain,
))),
),
Row(
// crossAxisAlignment: CrossAxisAlignment.,
children: [
IconButton(
onPressed: () {
_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),
),
)
],
),
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),
),
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),
),
Expanded(
child: Container(
height: 1,
color: TColor.gray.withOpacity(0.5),
)),
],
),
SizedBox(
height: media.width * 0.04,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GestureDetector(
onTap: () {},
)
],
),
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(
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,
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.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,
),
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/suunto.png",
width: 35,
height: 35,
),
SizedBox(
width: media.width * 0.04,
),
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),
),
)
],
),
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(
child: Image.asset(
"assets/img/suunto.png",
width: 35,
height: 35,
),
),
)
],
),
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,
fontSize: 14,
),
),
Text(
"Se connecter",
style: TextStyle(
color: TColor.black,
fontSize: 14,
),
),
Text(
"Se connecter",
style: TextStyle(
color: TColor.black,
fontSize: 14,
fontWeight: FontWeight.w700),
)
],
),
),
SizedBox(
height: media.width * 0.04,
fontWeight: FontWeight.w700),
)
],
),
],
),
),
SizedBox(
height: media.width * 0.04,
),
],
),
),
),

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

@ -90,159 +90,154 @@ class _WebSignUpView extends State<WebSignUpView> {
var media = MediaQuery.of(context).size;
return Scaffold(
backgroundColor: TColor.white,
body: SingleChildScrollView(
child: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 300),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: media.width * 0.04,
),
Text(
"Bienvenue,",
style: TextStyle(color: TColor.gray, fontSize: 16),
),
Text(
"Créer un compte",
style: TextStyle(
color: TColor.black,
fontSize: 20,
fontWeight: FontWeight.w700),
),
SizedBox(
height: media.width * 0.05,
),
RoundTextField(
hitText: "Prénom",
icon: "assets/img/user_text.svg",
controller: controllerUsername,
),
SizedBox(
height: media.width * 0.04,
),
RoundTextField(
hitText: "Email",
icon: "assets/img/email.svg",
keyboardType: TextInputType.emailAddress,
controller: controllerTextEmail,
),
SizedBox(
height: media.width * 0.04,
),
RoundTextField(
hitText: "Mot de passe",
icon: "assets/img/lock.svg",
obscureText: _obscureText,
controller: controllerTextPassword,
rigtIcon: TextButton(
onPressed: _toggle,
child: Container(
alignment: Alignment.center,
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 300),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: media.width * 0.04,
),
Text(
"Bienvenue,",
style: TextStyle(color: TColor.gray, fontSize: 16),
),
Text(
"Créer un compte",
style: TextStyle(
color: TColor.black,
fontSize: 20,
fontWeight: FontWeight.w700),
),
SizedBox(
height: media.width * 0.05,
),
RoundTextField(
hitText: "Prénom",
icon: "assets/img/user_text.svg",
controller: controllerUsername,
),
SizedBox(
height: media.width * 0.04,
),
RoundTextField(
hitText: "Email",
icon: "assets/img/email.svg",
keyboardType: TextInputType.emailAddress,
controller: controllerTextEmail,
),
SizedBox(
height: media.width * 0.04,
),
RoundTextField(
hitText: "Mot de passe",
icon: "assets/img/lock.svg",
obscureText: _obscureText,
controller: controllerTextPassword,
rigtIcon: TextButton(
onPressed: _toggle,
child: Container(
alignment: Alignment.center,
width: 20,
height: 20,
child: SvgPicture.asset(
"assets/img/show_password.svg",
width: 20,
height: 20,
child: SvgPicture.asset(
"assets/img/show_password.svg",
width: 20,
height: 20,
fit: BoxFit.contain,
))),
),
Row(
// crossAxisAlignment: CrossAxisAlignment.,
fit: BoxFit.contain,
))),
),
Row(
// crossAxisAlignment: CrossAxisAlignment.,
children: [
IconButton(
onPressed: () {
_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: [
IconButton(
onPressed: () {
_check();
},
icon: Icon(
_isCheck
? Icons.check_box_outlined
: Icons.check_box_outline_blank_outlined,
color: TColor.gray,
size: 20,
Text(
"Vous avez déjà un compte ? ",
style: TextStyle(
color: TColor.black,
fontSize: 14,
),
),
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: [
Text(
"Vous avez déjà un compte ? ",
style: TextStyle(
Text(
"Se connecter",
style: TextStyle(
color: TColor.black,
fontSize: 14,
),
),
Text(
"Se connecter",
style: TextStyle(
color: TColor.black,
fontSize: 14,
fontWeight: FontWeight.w700),
)
],
),
),
SizedBox(
height: media.width * 0.04,
fontWeight: FontWeight.w700),
)
],
),
],
),
),
SizedBox(
height: media.width * 0.04,
),
],
),
),
),

Loading…
Cancel
Save