se añadio un modelo y el menu de modo profesional
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:firebase_storage/firebase_storage.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||
import 'package:prosappco/src/components/drawer_professional.dart';
|
||||
|
||||
class PruebaScreen extends StatefulWidget {
|
||||
const PruebaScreen({super.key});
|
||||
|
||||
@override
|
||||
State<PruebaScreen> createState() => _PruebaScreenState();
|
||||
}
|
||||
|
||||
class _PruebaScreenState extends State<PruebaScreen> {
|
||||
File? imagen_to_upload;
|
||||
|
||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||
|
||||
late final FirebaseAuth _auth;
|
||||
final FirebaseStorage storage = FirebaseStorage.instance;
|
||||
var photoTemp = '';
|
||||
var _ciudad = '...';
|
||||
var _photo = '...';
|
||||
var _estado = '...';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||
_auth = FirebaseAuth.instance;
|
||||
|
||||
final currentUser = _auth.currentUser;
|
||||
|
||||
if (_ciudad == '...') {
|
||||
AuthenticationRepository.instance
|
||||
.getCity(uid.toString())
|
||||
.then((String s) => setState(() {
|
||||
_ciudad = s;
|
||||
}));
|
||||
}
|
||||
|
||||
if (_photo == '...') {
|
||||
AuthenticationRepository.instance
|
||||
.getPhoto(uid.toString())
|
||||
.then((String s) => setState(() {
|
||||
_photo = s;
|
||||
}));
|
||||
}
|
||||
if (_estado == '...') {
|
||||
AuthenticationRepository.instance
|
||||
.getState(uid.toString())
|
||||
.then((String s) => setState(() {
|
||||
_estado = s;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final User? user = FirebaseAuth.instance.currentUser;
|
||||
String city = _ciudad.toString();
|
||||
String state = _estado.toString();
|
||||
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.white,
|
||||
iconTheme: const IconThemeData(
|
||||
color: Colors.black,
|
||||
),
|
||||
title: const Text(
|
||||
'Perfil',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
drawer: DrawerProfessional(
|
||||
ref: storage.ref().child(_photo),
|
||||
userName: user?.displayName ?? '',
|
||||
userPhoneNumber: user?.phoneNumber ?? '',
|
||||
userCity: city,
|
||||
userState: state),
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user