puntaje pro

This commit is contained in:
Juan Felipe Duarte
2023-04-26 16:55:58 -05:00
parent 0a70d40d2d
commit c1747a45b9
12 changed files with 781 additions and 436 deletions
+78 -63
View File
@@ -1,11 +1,10 @@
import 'dart:ffi';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:prosappco/src/authentication/authentication_repository.dart';
import 'package:prosappco/src/components/pop_appbar.dart';
import 'package:prosappco/src/components/primary_btn.dart';
import 'package:prosappco/src/models/event_model.dart';
import 'package:prosappco/src/screens/cita.dart';
import 'package:table_calendar/table_calendar.dart';
import 'package:intl/intl.dart';
@@ -90,64 +89,62 @@ class _CalendarScreenState extends State<CalendarScreen> {
// DateTime firstDay = today.subtract(Duration(days: 365));
DateTime lastDay = today.add(const Duration(days: 365));
return SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: PopAppbar(
onPressed: () {
Navigator.pop(context);
},
label: 'Calendario',
),
body: Column(
children: [
Container(
color: const Color.fromARGB(255, 224, 247, 255),
child: TableCalendar(
locale: 'es_MX',
firstDay: DateTime.utc(2010, 10, 16),
lastDay: lastDay,
focusedDay: today,
availableGestures: AvailableGestures.all,
onDaySelected: _onDaySelected,
selectedDayPredicate: (day) => isSameDay(day, today),
calendarFormat: _calendarFormat,
onFormatChanged: _onFormatChange,
eventLoader: (date) {
return events
.where((element) {
DateTime day = DateTime.parse(element.day ?? "");
return (date.year == day.year &&
date.month == day.month &&
date.day == day.day);
})
.map((e) => e.description)
.toList();
},
availableCalendarFormats: const {
CalendarFormat.month: 'Mes',
CalendarFormat.week: 'Semana',
CalendarFormat.twoWeeks: '2 Semanas',
},
),
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: PopAppbar(
onPressed: () {
Navigator.pop(context);
},
label: 'Calendario',
),
body: Column(
children: [
Container(
color: const Color.fromARGB(255, 224, 247, 255),
child: TableCalendar(
locale: 'es_MX',
firstDay: DateTime.utc(2010, 10, 16),
lastDay: lastDay,
focusedDay: today,
availableGestures: AvailableGestures.all,
onDaySelected: _onDaySelected,
selectedDayPredicate: (day) => isSameDay(day, today),
calendarFormat: _calendarFormat,
onFormatChanged: _onFormatChange,
eventLoader: (date) {
return events
.where((element) {
DateTime day = DateTime.parse(element.day ?? "");
return (date.year == day.year &&
date.month == day.month &&
date.day == day.day);
})
.map((e) => e.description)
.toList();
},
availableCalendarFormats: const {
CalendarFormat.month: 'Mes',
CalendarFormat.week: 'Semana',
CalendarFormat.twoWeeks: '2 Semanas',
},
),
SizedBox(
width: double.infinity,
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 15, vertical: 8),
child: Text(DateFormat('dd MMMM yyyy', 'es').format(today)),
)),
const Divider(
height: 0,
),
_eventList()
],
),
floatingActionButton: FloatingActionButton(
onPressed: _showDialog,
child: const Icon(Icons.add),
),
),
SizedBox(
width: double.infinity,
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 15, vertical: 8),
child: Text(DateFormat('dd MMMM yyyy', 'es').format(today)),
)),
const Divider(
height: 0,
),
_eventList()
],
),
floatingActionButton: FloatingActionButton(
onPressed: _showDialog,
child: const Icon(Icons.add),
),
);
}
@@ -329,7 +326,7 @@ class _CalendarScreenState extends State<CalendarScreen> {
try {
eventos.addAll(snapshot.data!);
} catch (e) {
print("Hola" + e.toString());
print("Error" + e.toString());
}
if (eventos.isEmpty) {
@@ -339,6 +336,24 @@ class _CalendarScreenState extends State<CalendarScreen> {
children: [
...eventos.map(
(e) => ListTile(
onTap: () {
final evento = Event(
day: e.day,
description: e.description,
userId: e.userId,
range1Hour1: e.range1Hour1,
range1Hour2: e.range1Hour2,
title: e.title,
);
Navigator.push(
context,
CupertinoPageRoute(
builder: (BuildContext context) {
return CitaScreen(evento: evento);
},
),
);
},
leading: Text('${e.range1Hour1}'),
title: RichText(
text: TextSpan(
@@ -354,8 +369,8 @@ class _CalendarScreenState extends State<CalendarScreen> {
TextSpan(
text: DateFormat('dd MMM', 'es')
.format(DateTime.parse(e.day!)),
style: TextStyle(
color: Colors.grey[400],
style: const TextStyle(
color: Colors.grey,
fontSize: 16,
),
),