mapa perfil profesional

This commit is contained in:
Juan Felipe Duarte
2023-04-22 19:02:24 -05:00
parent 03bd8401b5
commit 4f900db559
6 changed files with 320 additions and 128 deletions
+38 -92
View File
@@ -13,6 +13,7 @@ import 'package:prosappco/src/components/primary_btn.dart';
import 'package:prosappco/src/components/schedule_picker.dart';
import 'package:prosappco/src/screens/horario.dart';
import 'package:prosappco/src/screens/professional.dart';
import 'package:prosappco/src/screens/professional_direccion.dart';
import 'package:prosappco/src/services/select_image_profile.dart';
class ProfilePro extends StatefulWidget {
@@ -33,6 +34,8 @@ class _ProfileProState extends State<ProfilePro> {
var photoTemp = '';
var _photo = '...';
var _direccion = '...';
Map<String, Schedule>? _horarios;
@override
@@ -46,7 +49,6 @@ class _ProfileProState extends State<ProfilePro> {
(String s) => setState(
() {
_photo = s;
print('HOLA $s');
},
),
);
@@ -61,6 +63,14 @@ class _ProfileProState extends State<ProfilePro> {
),
);
}
if (_direccion == '...') {
AuthenticationRepository.instance
.getAddress(uid.toString())
.then((String s) => setState(() {
_direccion = s;
}));
}
}
Future<void> updateInfo() async {
@@ -77,94 +87,6 @@ class _ProfileProState extends State<ProfilePro> {
}
}
// Future<Widget> downloadImage(Reference ref) async {
// try {
// if (_photo == '...' || _photo.isEmpty) {
// return GestureDetector(
// onTap: () {
// _showChoiceDialog(context);
// },
// child: Container(
// margin: EdgeInsets.symmetric(vertical: 50),
// width: 100,
// height: 100,
// decoration: BoxDecoration(
// color: Color(0xFF2BA4EC),
// borderRadius: BorderRadius.circular(50),
// ),
// child: Icon(
// Icons.person,
// color: Colors.white,
// size: 90,
// ),
// ),
// );
// } else {
// final imageData = await ref.getData();
// if (imageData != null) {
// final widgetImage = GestureDetector(
// onTap: () {
// _showChoiceDialog(context);
// },
// child: Container(
// margin: const EdgeInsets.symmetric(vertical: 50),
// child: ClipOval(
// child: Image.memory(
// imageData,
// width: 60,
// height: 60,
// fit: BoxFit.cover,
// ),
// ),
// ),
// );
// return widgetImage;
// } else {
// return GestureDetector(
// onTap: () {
// _showChoiceDialog(context);
// },
// child: Container(
// margin: const EdgeInsets.symmetric(vertical: 50),
// width: 100,
// height: 100,
// decoration: BoxDecoration(
// color: const Color(0xFF2BA4EC),
// borderRadius: BorderRadius.circular(50),
// ),
// child: const Icon(
// Icons.person,
// color: Colors.white,
// size: 90,
// ),
// ),
// );
// }
// }
// } catch (e) {
// print('XD $e');
// return GestureDetector(
// onTap: () {
// _showChoiceDialog(context);
// },
// child: Container(
// margin: const EdgeInsets.symmetric(vertical: 50),
// width: 100,
// height: 100,
// decoration: BoxDecoration(
// color: const Color(0xFF2BA4EC),
// borderRadius: BorderRadius.circular(50),
// ),
// child: const Icon(
// Icons.person,
// color: Colors.white,
// size: 90,
// ),
// ),
// );
// }
// }
Future<void> updateImage(image) async {
try {
await FirebaseFirestore.instance
@@ -257,6 +179,8 @@ class _ProfileProState extends State<ProfilePro> {
@override
Widget build(BuildContext context) {
String address = _direccion.toString();
return SafeArea(
child: Scaffold(
appBar: AppBar(
@@ -317,9 +241,31 @@ class _ProfileProState extends State<ProfilePro> {
children: [
TextFormField(
// controller: _emailController,
decoration: const InputDecoration(
prefixIcon: Icon(Icons.near_me),
hintText: 'Dirección'),
readOnly: true,
onTap: () async {
final String? direccion = await Navigator.push(
context,
CupertinoPageRoute(
builder: (BuildContext context) {
return const ProfessionalDireccionScreen();
},
),
) as String?;
if (direccion != null) {
setState(() {
_direccion = direccion;
});
}
},
decoration: InputDecoration(
prefixIcon: const Icon(Icons.near_me),
hintStyle: address == ''
? const TextStyle()
: const TextStyle(color: Colors.black87),
hintText:
address == '' ? 'Dirección' : address),
),
const SizedBox(height: 10),
TextFormField(