No Description

event.dart 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import 'package:firebase_helpers/firebase_helpers.dart';
  2. //En esta Area definimos todas las variables y parametros utilizadas en las
  3. //funciones de los otros files.
  4. //Son las mismas variables usadas para enviar al servidor y recibir de vuelta
  5. // a la aplicacion.
  6. class EventModel extends DatabaseItem{
  7. final String id;
  8. final String title;
  9. final String description;
  10. final DateTime eventDate;
  11. final String name;
  12. final String number;
  13. final String reason;
  14. final DateTime eventTime;
  15. EventModel({this.id,this.title, this.description, this.eventDate, this.name, this.number, this.reason, this.eventTime}):super(id);
  16. factory EventModel.fromMap(Map data) {
  17. return EventModel(
  18. title: data['title'],
  19. description: data['description'],
  20. name: data['name'],
  21. number: data['number'],
  22. reason: data['reason'],
  23. eventDate: data['event_date'],
  24. eventTime: data['event_time'],
  25. );
  26. }
  27. factory EventModel.fromDS(String id, Map<String,dynamic> data) {
  28. return EventModel(
  29. id: id,
  30. title: data['title'],
  31. description: data['description'],
  32. number: data['number'],
  33. reason: data['reason'],
  34. eventDate: data['event_date'].toDate(),
  35. eventTime: data['event_time'].toTime(),
  36. );
  37. }
  38. final Map<DateTime, List> _holidays = {
  39. DateTime(2020, 11, 6): ['No Hay Citas'],
  40. DateTime(2020, 11, 3): ['Dia Elecciones'],
  41. DateTime(2020, 12, 25): ['Chrismas'],
  42. DateTime(2020, 12, 31): ['Despedida del anyo nuevo'],
  43. };
  44. Map<String,dynamic> toMap() {
  45. return {
  46. "title":title,
  47. "description": description,
  48. "event_date":eventDate,
  49. "id":id,
  50. "name":name,
  51. "number":number,
  52. "reason":reason,
  53. "event_time":eventTime,
  54. };
  55. }
  56. }