Skip to content

Commit

Permalink
Merge pull request #10 from jomazao/feature/hosted-by-section
Browse files Browse the repository at this point in the history
Hosted by section added and powered from Firebase, also event detail …
  • Loading branch information
jomazao authored Mar 13, 2024
2 parents ef24532 + 3560df2 commit 981b748
Show file tree
Hide file tree
Showing 6 changed files with 404 additions and 330 deletions.
10 changes: 8 additions & 2 deletions lib/src/models/event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Event {
final String calendarUrl;
final String locationUrl;
final List<String> attendees;
final List<String> speakers;

int get attendeesCount => attendees.length;

Expand All @@ -29,6 +30,7 @@ class Event {
required this.calendarUrl,
required this.locationUrl,
required this.attendees,
required this.speakers,
});

factory Event.fromJson({
Expand All @@ -37,13 +39,16 @@ class Event {
}) {
final dateTimeTimeStamp = json['dateTime'] as Timestamp;

final recommendations =
(json['recommendations'] as String ?? '').replaceAll("\\n", "\n");
final recommendations = (json['recommendations']).replaceAll("\\n", "\n");

final attendees = (json['attendees'] as List<dynamic>? ?? [])
.map<String>((uid) => '$uid')
.toList();

final speakers = (json['speakers'] as List<dynamic>? ?? [])
.map<String>((name) => '$name')
.toList();

return Event(
id: id,
title: json['title'] ?? '',
Expand All @@ -57,6 +62,7 @@ class Event {
calendarUrl: json['calendar_url'] ?? '',
recommendations: recommendations,
attendees: attendees,
speakers: speakers,
);
}
}
Loading

0 comments on commit 981b748

Please sign in to comment.