professional profile
This commit is contained in:
@@ -20,8 +20,6 @@ class ProfileScreen extends StatefulWidget {
|
||||
class _ProfileScreenState extends State<ProfileScreen> {
|
||||
File? imagen_to_upload;
|
||||
|
||||
bool _mostrarMenuDesplegable = true;
|
||||
|
||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
final controller = Get.put(NameEmailCityController());
|
||||
@@ -38,8 +36,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||
_auth = FirebaseAuth.instance;
|
||||
final Reference ref = storage.ref().child(_photo);
|
||||
|
||||
final currentUser = _auth.currentUser;
|
||||
|
||||
@@ -103,7 +101,12 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
Future<bool> uploadImage(File image) async {
|
||||
final String namefile = image.path.split('/').last;
|
||||
|
||||
Reference ref = storage.ref().child('profile').child(namefile);
|
||||
Reference ref = storage
|
||||
.ref()
|
||||
.child('users')
|
||||
.child(uid!)
|
||||
.child('profile')
|
||||
.child(namefile);
|
||||
|
||||
final UploadTask uploadTask = ref.putFile(image);
|
||||
|
||||
@@ -242,7 +245,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
|
||||
if (currentUser?.email != newEmail) {
|
||||
AuthCredential credential =
|
||||
EmailAuthProvider.credential(email: newEmail, password: '654321');
|
||||
EmailAuthProvider.credential(email: newEmail, password: '');
|
||||
try {
|
||||
await FirebaseAuth.instance.currentUser!.updateEmail(newEmail);
|
||||
await FirebaseFirestore.instance.collection('users').doc(uid).update({
|
||||
@@ -274,6 +277,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
} else {
|
||||
final uploaded = await uploadImage(imagen_to_upload!);
|
||||
updateImage(photoTemp);
|
||||
//image
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error al actualizar la imagen de perfil $e');
|
||||
@@ -297,7 +301,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
onTap: () async {
|
||||
final imagen = await getImage(1);
|
||||
setState(() {
|
||||
imagen_to_upload = File(imagen!.path);
|
||||
imagen_to_upload = File(imagen[0]!.path);
|
||||
});
|
||||
},
|
||||
),
|
||||
@@ -311,7 +315,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
onTap: () async {
|
||||
final imagen = await getImage(2);
|
||||
setState(() {
|
||||
imagen_to_upload = File(imagen!.path);
|
||||
imagen_to_upload = File(imagen[0]!.path);
|
||||
});
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user