This commit is contained in:
Felipe
2023-11-17 16:32:30 -05:00
parent 6fe88bf31c
commit ef58892c13
6 changed files with 41 additions and 47 deletions
+2 -2
View File
@@ -55,8 +55,8 @@ class ReferencePhoto extends StatelessWidget {
return SizedBox(
width: size,
height: size,
child: const Center(
child: CircularProgressIndicator(),
child: Center(
child: DefaultPhoto(),
),
);
} else if (snapshot.connectionState == ConnectionState.done &&
@@ -462,7 +462,7 @@ class ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
);
return;
}
if (imagen_to_upload == null) {
if (imagen_to_upload == null && _photo == '...') {
WarningSnackbar.show(
title: 'Sube una foto de perfil',
message: 'Para continuar debes subir una imagen de perfil',
@@ -248,9 +248,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
if (gender.isNotEmpty) {
try {
await FirebaseFirestore.instance.collection('users').doc(uid).set({
'gender': gender,
}, SetOptions(merge: true));
await FirebaseFirestore.instance
.collection('users')
.doc(uid)
.set({'gender': gender}, SetOptions(merge: true));
genderDb = gender;
} catch (e) {
@@ -260,9 +261,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
if (birthDate != null) {
try {
await FirebaseFirestore.instance.collection('users').doc(uid).set({
'birth_date': birthDate.toString(),
}, SetOptions(merge: true));
await FirebaseFirestore.instance
.collection('users')
.doc(uid)
.set({'birth_date': birthDate.toString()}, SetOptions(merge: true));
birthDateDb = birthDate.toString();
} catch (e) {
@@ -295,10 +297,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
if (currentUser?.displayName != newName) {
try {
await FirebaseAuth.instance.currentUser!.updateDisplayName(newName);
await FirebaseFirestore.instance.collection('users').doc(uid).update({
'name': newName,
'lowerName': newName.toLowerCase(),
});
await FirebaseFirestore.instance
.collection('users')
.doc(uid)
.update({'name': newName, 'lowerName': newName.toLowerCase()});
} catch (e) {
print('Error al actualizar el nombre: $e');
}
@@ -308,9 +310,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
if (kIsWeb) {
try {
await FirebaseFirestore.instance.collection('users').doc(uid).update({
'city': selectedCity,
});
await FirebaseFirestore.instance
.collection('users')
.doc(uid)
.update({'city': selectedCity});
} catch (e) {
print('Error al actualizar la ciudad: $e');
}
@@ -326,9 +329,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
await FirebaseFirestore.instance
.collection('users')
.doc(uid)
.update({
'email': newEmail,
});
.update({'email': newEmail});
} else {
return;
}
@@ -348,7 +349,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
.doc(uid)
.update({'phoneNumber': currentPhoneNumber});
} catch (e) {
print('e');
print('$e');
}
try {
@@ -488,8 +489,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
},
child: const Text(
'Guardar',
style:
TextStyle(color: Colors.blue, fontWeight: FontWeight.w600),
style: TextStyle(
color: Colors.blue,
fontWeight: FontWeight.w600,
),
),
),
],
@@ -950,7 +953,6 @@ class _ProfileScreenState extends State<ProfileScreen> {
await updateInfo();
}
}
await userProvider.updateUserDataAndScores();
},
text: 'Guardar',