pick profesional
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:diacritic/diacritic.dart';
|
||||
import 'package:firebase_storage/firebase_storage.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||
import 'package:prosappco/src/components/photo_view.dart';
|
||||
import 'package:prosappco/src/components/pop_appbar.dart';
|
||||
@@ -31,6 +32,9 @@ class Professional {
|
||||
final String professionName;
|
||||
final String cityName;
|
||||
final String ubicacion;
|
||||
final String realAddress;
|
||||
final double latitude;
|
||||
final double longitude;
|
||||
final List<String> professionalEspecializado;
|
||||
final ScoresModel scores;
|
||||
|
||||
@@ -43,6 +47,9 @@ class Professional {
|
||||
required this.ubicacion,
|
||||
required this.professionalEspecializado,
|
||||
required this.scores,
|
||||
required this.realAddress,
|
||||
required this.latitude,
|
||||
required this.longitude,
|
||||
});
|
||||
|
||||
String getEspecializaciones() {
|
||||
@@ -57,6 +64,9 @@ class Professional {
|
||||
' professionName: $professionName,\n'
|
||||
' cityName: $cityName,\n'
|
||||
' ubicacion: $ubicacion,\n'
|
||||
' realAddress: $realAddress,\n'
|
||||
' latitude: $latitude,\n'
|
||||
' longitude: $longitude,\n'
|
||||
' professionalEspecializado: ${getEspecializaciones()}\n'
|
||||
'}';
|
||||
}
|
||||
@@ -88,6 +98,9 @@ class Professional {
|
||||
professionalRef: storage.ref().child(photo),
|
||||
professionalEspecializado: especializaciones,
|
||||
ubicacion: data['ubicacion'] ?? '',
|
||||
realAddress: data['address'] ?? '',
|
||||
latitude: data['latitude'] ?? 0,
|
||||
longitude: data['longitude'] ?? 0,
|
||||
scores: await ScoresModel.scoreFrom(uid, true, true),
|
||||
);
|
||||
return professional;
|
||||
@@ -100,6 +113,44 @@ class Professional {
|
||||
}
|
||||
|
||||
class _ProfessionalScreenState extends State<ProfessionalScreen> {
|
||||
Future<String?> _showChoiceDialog(BuildContext context) async {
|
||||
String? selectedOption = await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
content: SingleChildScrollView(
|
||||
child: ListBody(
|
||||
children: [
|
||||
GestureDetector(
|
||||
child: const Text(
|
||||
textAlign: TextAlign.center,
|
||||
"A domicilio",
|
||||
style: TextStyle(color: Color(0xFF2BA4EC)),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop("domicilio");
|
||||
},
|
||||
),
|
||||
const Divider(color: Colors.black54),
|
||||
GestureDetector(
|
||||
child: const Text(
|
||||
textAlign: TextAlign.center,
|
||||
"En sitio",
|
||||
style: TextStyle(color: Color(0xFF2BA4EC)),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop("sitio");
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
return selectedOption;
|
||||
}
|
||||
|
||||
List<Professional>? filteredProfessionals;
|
||||
|
||||
TextEditingController searchController = TextEditingController();
|
||||
@@ -136,6 +187,9 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
|
||||
professionalRef: storage.ref().child(_photo),
|
||||
professionalEspecializado: especializaciones,
|
||||
ubicacion: data['ubicacion'] ?? '',
|
||||
realAddress: data['address'] ?? '',
|
||||
latitude: data['latitude'] ?? 0,
|
||||
longitude: data['longitude'] ?? 0,
|
||||
scores: await ScoresModel.scoreTo(user.id, true, true),
|
||||
);
|
||||
professionals.add(professional);
|
||||
@@ -265,8 +319,39 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
subtitle: professionals[index].ubicacion == 'ambos'
|
||||
? const Text(
|
||||
'Disponibilidad a domicilio y en sitio',
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
)
|
||||
: professionals[index].ubicacion == 'sitio'
|
||||
? Text(
|
||||
'Disponibilidad en ${professionals[index].ubicacion}',
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'Disponibilidad a ${professionals[index].ubicacion}',
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(context, professionals[index]);
|
||||
if (professionals[index].ubicacion == 'ambos') {
|
||||
_showChoiceDialog(context).then((String? value) {
|
||||
if (value != null) {
|
||||
Navigator.pop(context, [professionals[index], value]);
|
||||
}
|
||||
});
|
||||
} else if (professionals[index].ubicacion == 'sitio') {
|
||||
Navigator.pop(context, [professionals[index], 'sitio']);
|
||||
} else {
|
||||
Navigator.pop(
|
||||
context, [professionals[index], 'domicilio']);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user