This commit is contained in:
Felipe
2023-08-23 14:41:18 -05:00
parent 1270f3a6b5
commit 52855f8c3e
5 changed files with 499 additions and 456 deletions
+1 -1
View File
@@ -170,7 +170,7 @@ class _CalendarScreenState extends State<CalendarScreen> {
content: StatefulBuilder( content: StatefulBuilder(
builder: (BuildContext context, StateSetter setStateDialog) { builder: (BuildContext context, StateSetter setStateDialog) {
return SizedBox( return SizedBox(
height: 350, height: 800,
child: Column( child: Column(
children: [ children: [
Padding( Padding(
+27 -15
View File
@@ -234,11 +234,13 @@ class _CitaScreenState extends State<CitaScreen> {
], ],
), ),
), ),
Container( widget.evento.userId == widget.evento.professionalId
? const SizedBox()
: Container(
margin: const EdgeInsets.only( margin: const EdgeInsets.only(
left: 40, right: 40, top: 20, bottom: 20), left: 40, right: 40, top: 20, bottom: 20),
padding: padding: const EdgeInsets.symmetric(
const EdgeInsets.symmetric(horizontal: 20, vertical: 15), horizontal: 20, vertical: 15),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0xFFD6F4FF), color: const Color(0xFFD6F4FF),
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
@@ -262,13 +264,13 @@ class _CitaScreenState extends State<CitaScreen> {
widget.evento.ubicacion != 'sitio' widget.evento.ubicacion != 'sitio'
? const Text( ? const Text(
'Servicio a domicilio.', 'Servicio a domicilio.',
style: style: TextStyle(
TextStyle(color: Colors.black, fontSize: 14), color: Colors.black, fontSize: 14),
) )
: const Text( : const Text(
'Servicio en su sitio / consultorio', 'Servicio en su sitio / consultorio',
style: style: TextStyle(
TextStyle(color: Colors.black, fontSize: 14), color: Colors.black, fontSize: 14),
), ),
], ],
), ),
@@ -293,7 +295,9 @@ class _CitaScreenState extends State<CitaScreen> {
style: const TextStyle( style: const TextStyle(
color: Colors.grey, fontStyle: FontStyle.italic), color: Colors.grey, fontStyle: FontStyle.italic),
), ),
widget.evento.status == 'terminado' widget.evento.userId == widget.evento.professionalId
? const SizedBox()
: widget.evento.status == 'terminado'
? const SizedBox(height: 10) ? const SizedBox(height: 10)
: const Padding( : const Padding(
padding: EdgeInsets.symmetric(vertical: 20), padding: EdgeInsets.symmetric(vertical: 20),
@@ -302,7 +306,9 @@ class _CitaScreenState extends State<CitaScreen> {
style: TextStyle(color: Color(0xFF2BA4EC)), style: TextStyle(color: Color(0xFF2BA4EC)),
), ),
), ),
widget.evento.status == 'terminado' widget.evento.userId == widget.evento.professionalId
? const SizedBox()
: widget.evento.status == 'terminado'
? pro == true ? pro == true
? widget.evento.professionalScored == true ? widget.evento.professionalScored == true
? const SizedBox() ? const SizedBox()
@@ -324,9 +330,11 @@ class _CitaScreenState extends State<CitaScreen> {
); );
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF2BA4EC), backgroundColor:
const Color(0xFF2BA4EC),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50), borderRadius:
BorderRadius.circular(50),
), ),
elevation: 0, elevation: 0,
minimumSize: const Size(230, 60), minimumSize: const Size(230, 60),
@@ -362,9 +370,11 @@ class _CitaScreenState extends State<CitaScreen> {
); );
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF2BA4EC), backgroundColor:
const Color(0xFF2BA4EC),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50), borderRadius:
BorderRadius.circular(50),
), ),
elevation: 0, elevation: 0,
minimumSize: const Size(230, 60), minimumSize: const Size(230, 60),
@@ -416,7 +426,8 @@ class _CitaScreenState extends State<CitaScreen> {
final chatSnapshot = await chatDoc.get(); final chatSnapshot = await chatDoc.get();
if (!chatSnapshot.exists || if (!chatSnapshot.exists ||
chatSnapshot.data()!['message'] == null) { chatSnapshot.data()!['message'] ==
null) {
await chatDoc.set( await chatDoc.set(
{ {
'professional_id': 'professional_id':
@@ -478,7 +489,8 @@ class _CitaScreenState extends State<CitaScreen> {
), ),
elevation: 8.0, elevation: 8.0,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0), borderRadius:
BorderRadius.circular(10.0),
), ),
); );
+35 -5
View File
@@ -87,6 +87,7 @@ class _MyServicesScreenState extends State<MyServicesScreen> {
try { try {
eventos.addAll(snapshot.data!); eventos.addAll(snapshot.data!);
eventos.sort((a, b) => a.range1Hour1.compareTo(b.range1Hour1));
} catch (e) { } catch (e) {
print("Error" + e.toString()); print("Error" + e.toString());
} }
@@ -100,8 +101,33 @@ class _MyServicesScreenState extends State<MyServicesScreen> {
return Column( return Column(
children: [ children: [
...eventos.map( ...eventos
(event) => ListTile( .where((event) => event.professionalId != event.userId)
.map(
(event) => FutureBuilder<DocumentSnapshot>(
future: FirebaseFirestore.instance
.collection('users')
.doc(event.professionalId)
.get(),
builder: (BuildContext context,
AsyncSnapshot<DocumentSnapshot> profSnapshot) {
if (profSnapshot.connectionState ==
ConnectionState.waiting) {
return const CircularProgressIndicator();
}
if (profSnapshot.hasError) {
return const Text(
'Error al obtener los datos del profesional',
// Aquí puedes agregar un estilo de texto apropiado
);
}
final professionalData = profSnapshot.data;
final professionalName =
professionalData?['name'] ?? 'N/D';
return ListTile(
tileColor: event.status == 'denegado' tileColor: event.status == 'denegado'
? Colors.red[100] ? Colors.red[100]
: Colors.blue[100], : Colors.blue[100],
@@ -148,7 +174,7 @@ class _MyServicesScreenState extends State<MyServicesScreen> {
text: TextSpan( text: TextSpan(
children: [ children: [
TextSpan( TextSpan(
text: '${event.title}, ', text: '${professionalName}, ',
style: const TextStyle( style: const TextStyle(
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@@ -172,7 +198,8 @@ class _MyServicesScreenState extends State<MyServicesScreen> {
Row( Row(
children: [ children: [
RatingBar.builder( RatingBar.builder(
initialRating: event.scoresModel?.average ?? 0, initialRating:
event.scoresModel?.average ?? 0,
minRating: 1, minRating: 1,
direction: Axis.horizontal, direction: Axis.horizontal,
allowHalfRating: true, allowHalfRating: true,
@@ -195,11 +222,14 @@ class _MyServicesScreenState extends State<MyServicesScreen> {
), ),
Text( Text(
'" ${event.description}"', '" ${event.description}"',
style: const TextStyle(fontStyle: FontStyle.italic), style:
const TextStyle(fontStyle: FontStyle.italic),
), ),
], ],
), ),
trailing: const Icon(Icons.keyboard_arrow_right), trailing: const Icon(Icons.keyboard_arrow_right),
);
},
), ),
), ),
], ],
+4 -4
View File
@@ -34,7 +34,8 @@ class _MyServicesProScreenState extends State<MyServicesProScreen> {
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
}, },
label: 'Mis servicios'), label: 'Mis servicios',
),
drawer: DrawerProfessional(), drawer: DrawerProfessional(),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Column( child: Column(
@@ -82,6 +83,7 @@ class _MyServicesProScreenState extends State<MyServicesProScreen> {
try { try {
eventos.addAll(snapshot.data!); eventos.addAll(snapshot.data!);
eventos.sort((a, b) => a.range1Hour1.compareTo(b.range1Hour1));
} catch (e) { } catch (e) {
print("Error" + e.toString()); print("Error" + e.toString());
} }
@@ -96,9 +98,7 @@ class _MyServicesProScreenState extends State<MyServicesProScreen> {
return Column( return Column(
children: [ children: [
...eventos.map( ...eventos.map(
(event) => event.userId == event.professionalId (event) => ListTile(
? const SizedBox()
: ListTile(
tileColor: event.status == 'denegado' tileColor: event.status == 'denegado'
? Colors.red[100] ? Colors.red[100]
: Colors.blue[100], : Colors.blue[100],
+1
View File
@@ -75,6 +75,7 @@ class SolicitudScreen extends StatelessWidget {
try { try {
eventos.addAll(snapshot.data!); eventos.addAll(snapshot.data!);
eventos.sort((a, b) => a.range1Hour1.compareTo(b.range1Hour1));
} catch (e) { } catch (e) {
print("Error" + e.toString()); print("Error" + e.toString());
} }