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