Compare commits
3 Commits
83c65be610
...
0f40c3e225
Author | SHA1 | Date | |
---|---|---|---|
0f40c3e225 | |||
30b9be35ef | |||
db3cb20255 |
@ -3,6 +3,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import '../pages/EditProfile.dart';
|
import '../pages/EditProfile.dart';
|
||||||
|
import '../pages/ListItemMenu.dart';
|
||||||
import 'alert.dart';
|
import 'alert.dart';
|
||||||
|
|
||||||
import '../variable/globals.dart' as globals;
|
import '../variable/globals.dart' as globals;
|
||||||
@ -94,7 +95,10 @@ class MyDrawer extends StatelessWidget with ShowAlertDialog {
|
|||||||
leading: Icon(Icons.home),
|
leading: Icon(Icons.home),
|
||||||
title: Text('Home'),
|
title: Text('Home'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context); // Close the drawer
|
Navigator.pushReplacement(
|
||||||
|
context, MaterialPageRoute(builder: (_) => ListItemMenu()));
|
||||||
|
|
||||||
|
/// Close the drawer
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
|
@ -96,10 +96,12 @@ class _EditProfileState extends State<EditProfile>
|
|||||||
var confirmedPassword = inputPasswordConfirmed.text;
|
var confirmedPassword = inputPasswordConfirmed.text;
|
||||||
var birth = DateTime.parse(formatDate(inputBirth.text));
|
var birth = DateTime.parse(formatDate(inputBirth.text));
|
||||||
|
|
||||||
|
if ((password.isNotEmpty) && (confirmedPassword.isNotEmpty)) {
|
||||||
if (password != confirmedPassword) {
|
if (password != confirmedPassword) {
|
||||||
showAlertDialog(context, "Erreur", "Mot de passe different");
|
showAlertDialog(context, "Erreur", "Mot de passe different");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var urlPut = Uri.parse("${globals.api}/users/me");
|
var urlPut = Uri.parse("${globals.api}/users/me");
|
||||||
|
|
||||||
@ -118,11 +120,14 @@ class _EditProfileState extends State<EditProfile>
|
|||||||
'firstName': firstName,
|
'firstName': firstName,
|
||||||
'password': password,
|
'password': password,
|
||||||
'email': email,
|
'email': email,
|
||||||
'birth': birth
|
'roles': '',
|
||||||
|
'birth': birth.toString()
|
||||||
}));
|
}));
|
||||||
print(responsePut.statusCode);
|
print(responsePut.statusCode);
|
||||||
if (responsePut.statusCode == 200) {
|
if (responsePut.statusCode == 200) {
|
||||||
showEventDialog(context, "Votre utilisateur a été modifié");
|
showEventDialog(context, "Votre utilisateur a été modifié");
|
||||||
|
Navigator.pushReplacement(
|
||||||
|
context, MaterialPageRoute(builder: (_) => EditProfile()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,7 +326,7 @@ class _EditProfileState extends State<EditProfile>
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'Ajouter',
|
'Modifier le profil',
|
||||||
style: TextStyle(color: Colors.white, fontSize: 25),
|
style: TextStyle(color: Colors.white, fontSize: 25),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user