notify
continuous-integration/drone/push Build is passing Details

messagerie_lucas_test
Lucas DELANIER 3 years ago
parent af850b03ad
commit ba51e73079

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

@ -32,4 +32,9 @@ class Controller{
this.currentUser?.usernameDafl = newName; this.currentUser?.usernameDafl = newName;
} }
} }
void changePasswordCourant(String newPass){
if(newPass !=null){
this.currentUser?.passwDafl = newPass;
}
}
} }

@ -385,91 +385,166 @@ class _SplashState extends State<Splash> {
); );
} }
} }
Object Notify(int index, context, {bool isError = true}){
Object errorNotify(int index, context){
String message; String message;
switch(index){ if(isError == true){
case 0: { switch(index){
message = "Ce nom d'utilisateur existe déjà ! Veuillez réessayer."; case 0: {
break; message = "Ce nom d'utilisateur existe déjà ! Veuillez réessayer.";
} break;
case 1: { }
message = "Mots de passe différents ! Veuillez réessayer."; case 1: {
break; message = "Mots de passe différents ! Veuillez réessayer.";
} break;
case 2: { }
message = "Identifiant incorrect ! Veuillez réessayer."; case 2: {
break; message = "Identifiant incorrect ! Veuillez réessayer.";
} break;
case 3: { }
message = "Mot de passe incorrect ! Votre mot de passe doit contenir 8 caractères minimum."; case 3: {
break; message = "Mot de passe incorrect ! Votre mot de passe doit contenir 8 caractères minimum.";
} break;
case 4: { }
message = "Mot de passe incorrect ! Veuillez réessayer."; case 4: {
break; message = "Mot de passe incorrect ! Veuillez réessayer.";
break;
}
default:
message = "Une erreur est survenue pendant l'inscription. Veuillez réessayer.";
break;
} }
default: return ScaffoldMessenger.of(context).showSnackBar( SnackBar(
message = "Une erreur est survenue pendant l'inscription. Veuillez réessayer."; dismissDirection: DismissDirection.down,
break; behavior: SnackBarBehavior.floating,
backgroundColor: Colors.transparent,
elevation: 0,
content: Stack(
clipBehavior: Clip.none,
children: [
Container(
padding: EdgeInsets.all(16),
height: 90,
child: Row(
children: [
Container(
height: 48,
width: 48,
),
Expanded(child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Oh oh !", style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),),
Text(message,style: TextStyle(
),
overflow: TextOverflow.ellipsis,
maxLines: 2,),
],
),),
],
),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/backgroundNotify.png"),
fit: BoxFit.cover),
gradient: LinearGradient(colors: [Color(0xFF81052a),Color(0xFF810548)],begin: Alignment.topLeft, end: Alignment.bottomRight),
borderRadius: BorderRadius.all(Radius.circular(20)),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
blurRadius: 10,
offset: Offset(4, 8), // Shadow position
),
],
),
),
Positioned(
top: -50,
left: -20,
child: Container(
color: Colors.transparent,
height: 110,
width: 110,
child: riv.RiveAnimation.asset("assets/images/error_icon.riv"),)),
],
)
));
} }
return ScaffoldMessenger.of(context).showSnackBar( SnackBar( else{
dismissDirection: DismissDirection.down, switch(index){
behavior: SnackBarBehavior.floating, case 0: {
backgroundColor: Colors.transparent, message = "Vous avez changer votre identifiant avec succès";
elevation: 0, break;
content: Stack( }
clipBehavior: Clip.none, case 1: {
children: [ message = "Vous avez changer votre mot de passe avec succès";
break;
}
default:
message = "L'opération a bien été éxécutée";
break;
Container( }
padding: EdgeInsets.all(16), return ScaffoldMessenger.of(context).showSnackBar( SnackBar(
height: 90, dismissDirection: DismissDirection.down,
child: Row( behavior: SnackBarBehavior.floating,
children: [ backgroundColor: Colors.transparent,
Container( elevation: 0,
height: 48, content: Stack(
width: 48, clipBehavior: Clip.none,
), children: [
Expanded(child: Column(
crossAxisAlignment: CrossAxisAlignment.start, Container(
children: [ padding: EdgeInsets.all(16),
Text("Oh oh !", style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),), height: 90,
Text(message,style: TextStyle( child: Row(
), children: [
overflow: TextOverflow.ellipsis, Container(
maxLines: 2,), height: 48,
], width: 48,
),), ),
], Expanded(child: Column(
), crossAxisAlignment: CrossAxisAlignment.start,
decoration: BoxDecoration( children: [
image: DecorationImage( Text("Super !", style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),),
image: AssetImage("assets/images/backgroundNotify.png"), Text(message,style: TextStyle(
fit: BoxFit.cover), ),
gradient: LinearGradient(colors: [Color(0xFF81052a),Color(0xFF810548)],begin: Alignment.topLeft, end: Alignment.bottomRight), overflow: TextOverflow.ellipsis,
borderRadius: BorderRadius.all(Radius.circular(20)), maxLines: 2,),
boxShadow: [ ],
BoxShadow( ),),
color: Colors.black.withOpacity(0.3), ],
blurRadius: 10, ),
offset: Offset(4, 8), // Shadow position decoration: BoxDecoration(
), image: DecorationImage(
], image: AssetImage("assets/images/valid_background.png"),
fit: BoxFit.cover),
gradient: LinearGradient(colors: [Color(0xFF81052a),Color(0xFF810548)],begin: Alignment.topLeft, end: Alignment.bottomRight),
borderRadius: BorderRadius.all(Radius.circular(20)),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
blurRadius: 10,
offset: Offset(4, 8), // Shadow position
),
],
),
), ),
), Positioned(
Positioned( top: -50,
top: -50, left: -20,
left: -20, child: Container(
child: Container( color: Colors.transparent,
color: Colors.transparent, height: 110,
height: 110, width: 110,
width: 110, child: riv.RiveAnimation.asset("assets/images/valid_icon.riv"),)),
child: riv.RiveAnimation.asset("assets/images/error_icon.riv"),)), ],
], )
) ));
));
}
} }

@ -83,7 +83,10 @@ class _DiscoveryListState extends State<DiscoveryList> {
itemBuilder: (context, index){ itemBuilder: (context, index){
int itemCount = MyApp().controller.currentUser.Discovery.length ?? 0; int itemCount = MyApp().controller.currentUser.Discovery.length ?? 0;
int reversedIndex = itemCount - 1 - index; int reversedIndex = itemCount - 1 - index;
return Dismissible(key: Key(MyApp().controller.currentUser.Discovery[reversedIndex].name), child: Container( return Dismissible(
key: Key(MyApp().controller.currentUser.Discovery[reversedIndex].name),
direction: DismissDirection.startToEnd,
child: Container(
margin: EdgeInsets.fromLTRB(0, 10, 0, 0), margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
padding: EdgeInsets.fromLTRB(30, 0, 30, 0), padding: EdgeInsets.fromLTRB(30, 0, 30, 0),
child: Column( child: Column(
@ -124,9 +127,12 @@ class _DiscoveryListState extends State<DiscoveryList> {
) )
), onDismissed: (direction) { ), onDismissed: (direction) {
MyApp().controller.currentUser.Discovery.removeAt(reversedIndex); if(direction == DismissDirection.startToEnd)
MyApp().controller.currentUser.Discovery.removeAt(reversedIndex);
}, },
background: Container(color: Colors.red,),); background: Container(decoration: BoxDecoration(
image: DecorationImage(image: AssetImage("assets/images/delete_background.png"), fit: BoxFit.cover),
)),);
} }
), onRefresh: () async { ), onRefresh: () async {
refreshList(); refreshList();

@ -74,8 +74,8 @@ class _SettingsWidgetState extends State<SettingsWidget> {
Spacer(), Spacer(),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
MyApp().controller.changeUsernameCourant(userNameTextField.text); MyApp().controller.changeUsernameCourant(userNameTextField.text);
Notify(0,context,isError: false);
}, },
child: Padding(padding: EdgeInsets.fromLTRB(0, 0, 20, 0), child: Padding(padding: EdgeInsets.fromLTRB(0, 0, 20, 0),
child: Text('modifier', child: Text('modifier',
@ -128,6 +128,8 @@ class _SettingsWidgetState extends State<SettingsWidget> {
Spacer(), Spacer(),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
MyApp().controller.changePasswordCourant(passwordTextField.text);
Notify(1,context,isError: false);
}, },
child: Padding(padding: EdgeInsets.fromLTRB(0, 0, 20, 0), child: Padding(padding: EdgeInsets.fromLTRB(0, 0, 20, 0),
child: Text('modifier', child: Text('modifier',

@ -230,10 +230,10 @@ class _SignInPageState extends State<SignInPage> {
void checkInformations(String username,String password){ void checkInformations(String username,String password){
if(username ==""){ if(username ==""){
errorNotify(2, context); Notify(2, context);
} }
else if(password ==""){ else if(password ==""){
errorNotify(4, context); Notify(4, context);
} }
else{ else{
MyApp().controller.changeCurrentUser(MyApp().controller.createUser(userNameTextField.text, passwordTextField.text)); MyApp().controller.changeCurrentUser(MyApp().controller.createUser(userNameTextField.text, passwordTextField.text));

@ -299,16 +299,16 @@ class _SignUpPageState extends State<SignUpPage> {
void checkInformations(String username,String password, String confirmPassword){ void checkInformations(String username,String password, String confirmPassword){
if(username ==""){ if(username ==""){
errorNotify(2, context); Notify(2, context);
} }
else if(password =="" || confirmPassword == ""){ else if(password =="" || confirmPassword == ""){
errorNotify(4, context); Notify(4, context);
} }
else if(password.length <8){ else if(password.length <8){
errorNotify(2, context); Notify(2, context);
} }
else if(password != confirmPassword){ else if(password != confirmPassword){
errorNotify(1, context); Notify(1, context);
} }
else{ else{
MyApp().controller.createUser(userNameTextField.text, passwordConfirmTextField.text); MyApp().controller.createUser(userNameTextField.text, passwordConfirmTextField.text);

Loading…
Cancel
Save