vista
This commit is contained in:
@@ -24,8 +24,6 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
||||
final _titleController = TextEditingController();
|
||||
final _descriptionController = TextEditingController();
|
||||
|
||||
ScoresModel? scoresModel;
|
||||
|
||||
EventoService eventoService = EventoService();
|
||||
CalendarFormat _calendarFormat = CalendarFormat.month;
|
||||
DateTime today = DateTime.now();
|
||||
@@ -67,12 +65,6 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
||||
_events = value;
|
||||
}));
|
||||
}
|
||||
|
||||
if (scoresModel == null) {
|
||||
ScoresModel.scoreFrom(uid.toString(), true, false).then(
|
||||
(ScoresModel s) => setState(() => scoresModel = s),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _onDaySelected(DateTime day, DateTime focusedDay) {
|
||||
@@ -124,7 +116,7 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
||||
eventLoader: (date) {
|
||||
return events
|
||||
.where((element) {
|
||||
DateTime day = DateTime.parse(element.day ?? "");
|
||||
DateTime day = DateTime.parse(element.day);
|
||||
return (date.year == day.year &&
|
||||
date.month == day.month &&
|
||||
date.day == day.day);
|
||||
@@ -292,13 +284,16 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
||||
onPressed: () async {
|
||||
await eventoService
|
||||
.createEvent(
|
||||
_titleController.text,
|
||||
_descriptionController.text,
|
||||
today.toString(),
|
||||
_selectedTime1!.format(context).toString(),
|
||||
_selectedTime2!.format(context).toString(),
|
||||
uid.toString(),
|
||||
)
|
||||
_titleController.text,
|
||||
_descriptionController.text,
|
||||
today.toString(),
|
||||
_selectedTime1!.format(context).toString(),
|
||||
_selectedTime2!.format(context).toString(),
|
||||
uid.toString(),
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
0)
|
||||
.then((value) {
|
||||
Navigator.pop(context);
|
||||
_titleController.text = '';
|
||||
@@ -348,24 +343,16 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
||||
...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);
|
||||
return CitaScreen(evento: e);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
leading: Text('${e.range1Hour1}'),
|
||||
leading: Text(e.range1Hour1),
|
||||
title: RichText(
|
||||
text: TextSpan(
|
||||
children: [
|
||||
@@ -379,7 +366,7 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
||||
),
|
||||
TextSpan(
|
||||
text: DateFormat('dd MMM', 'es')
|
||||
.format(DateTime.parse(e.day!)),
|
||||
.format(DateTime.parse(e.day)),
|
||||
style: const TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 16,
|
||||
@@ -394,7 +381,7 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
||||
Row(
|
||||
children: [
|
||||
RatingBar.builder(
|
||||
initialRating: scoresModel?.average ?? 0,
|
||||
initialRating: e.scoresModel?.average ?? 0,
|
||||
minRating: 1,
|
||||
direction: Axis.horizontal,
|
||||
allowHalfRating: true,
|
||||
@@ -412,7 +399,7 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
'(${scoresModel?.total.toString()}) ${scoresModel?.average.toString()}'),
|
||||
'(${e.scoresModel?.total.toString()}) ${e.scoresModel?.average.toString()}'),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
|
||||
Reference in New Issue
Block a user