Initial commit
This commit is contained in:
34
flutter_app/lib/models/announcement.dart
Normal file
34
flutter_app/lib/models/announcement.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
class Announcement {
|
||||
final String id;
|
||||
final String title;
|
||||
final String content;
|
||||
final int priority;
|
||||
final bool active;
|
||||
|
||||
const Announcement({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.content,
|
||||
required this.priority,
|
||||
required this.active,
|
||||
});
|
||||
|
||||
factory Announcement.fromJson(Map<String, dynamic> json) {
|
||||
return Announcement(
|
||||
id: json["_id"] as String? ?? "",
|
||||
title: json["title"] as String? ?? "",
|
||||
content: json["content"] as String? ?? "",
|
||||
priority: (json["priority"] as num?)?.toInt() ?? 0,
|
||||
active: json["active"] as bool? ?? true,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
"title": title,
|
||||
"content": content,
|
||||
"priority": priority,
|
||||
"active": active,
|
||||
};
|
||||
}
|
||||
}
|
||||
34
flutter_app/lib/models/bible_verse.dart
Normal file
34
flutter_app/lib/models/bible_verse.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
class BibleVerse {
|
||||
final String id;
|
||||
final String text;
|
||||
final String reference;
|
||||
final String? date;
|
||||
final bool active;
|
||||
|
||||
const BibleVerse({
|
||||
required this.id,
|
||||
required this.text,
|
||||
required this.reference,
|
||||
required this.date,
|
||||
required this.active,
|
||||
});
|
||||
|
||||
factory BibleVerse.fromJson(Map<String, dynamic> json) {
|
||||
return BibleVerse(
|
||||
id: json["_id"] as String? ?? "",
|
||||
text: json["text"] as String? ?? "",
|
||||
reference: json["reference"] as String? ?? "",
|
||||
date: json["date"] as String?,
|
||||
active: json["active"] as bool? ?? true,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
"text": text,
|
||||
"reference": reference,
|
||||
"date": date,
|
||||
"active": active,
|
||||
};
|
||||
}
|
||||
}
|
||||
29
flutter_app/lib/models/family_member.dart
Normal file
29
flutter_app/lib/models/family_member.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
class FamilyMember {
|
||||
final String id;
|
||||
final String name;
|
||||
final String emoji;
|
||||
final String color;
|
||||
final int order;
|
||||
|
||||
const FamilyMember({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.emoji,
|
||||
required this.color,
|
||||
required this.order,
|
||||
});
|
||||
|
||||
factory FamilyMember.fromJson(Map<String, dynamic> json) {
|
||||
return FamilyMember(
|
||||
id: json["_id"] as String? ?? "",
|
||||
name: json["name"] as String? ?? "",
|
||||
emoji: json["emoji"] as String? ?? "",
|
||||
color: json["color"] as String? ?? "",
|
||||
order: (json["order"] as num?)?.toInt() ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {"name": name, "emoji": emoji, "color": color, "order": order};
|
||||
}
|
||||
}
|
||||
26
flutter_app/lib/models/photo.dart
Normal file
26
flutter_app/lib/models/photo.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
class Photo {
|
||||
final String id;
|
||||
final String url;
|
||||
final String caption;
|
||||
final bool active;
|
||||
|
||||
const Photo({
|
||||
required this.id,
|
||||
required this.url,
|
||||
required this.caption,
|
||||
required this.active,
|
||||
});
|
||||
|
||||
factory Photo.fromJson(Map<String, dynamic> json) {
|
||||
return Photo(
|
||||
id: json["_id"] as String? ?? "",
|
||||
url: json["url"] as String? ?? "",
|
||||
caption: json["caption"] as String? ?? "",
|
||||
active: json["active"] as bool? ?? true,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {"url": url, "caption": caption, "active": active};
|
||||
}
|
||||
}
|
||||
45
flutter_app/lib/models/schedule_item.dart
Normal file
45
flutter_app/lib/models/schedule_item.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
class ScheduleItem {
|
||||
final String id;
|
||||
final String title;
|
||||
final String description;
|
||||
final DateTime startDate;
|
||||
final DateTime endDate;
|
||||
final String familyMemberId;
|
||||
final bool isAllDay;
|
||||
|
||||
const ScheduleItem({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.description,
|
||||
required this.startDate,
|
||||
required this.endDate,
|
||||
required this.familyMemberId,
|
||||
required this.isAllDay,
|
||||
});
|
||||
|
||||
factory ScheduleItem.fromJson(Map<String, dynamic> json) {
|
||||
return ScheduleItem(
|
||||
id: json["_id"] as String? ?? "",
|
||||
title: json["title"] as String? ?? "",
|
||||
description: json["description"] as String? ?? "",
|
||||
startDate:
|
||||
DateTime.tryParse(json["startDate"] as String? ?? "") ??
|
||||
DateTime.now(),
|
||||
endDate:
|
||||
DateTime.tryParse(json["endDate"] as String? ?? "") ?? DateTime.now(),
|
||||
familyMemberId: json["familyMemberId"] as String? ?? "",
|
||||
isAllDay: json["isAllDay"] as bool? ?? false,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
"title": title,
|
||||
"description": description,
|
||||
"startDate": startDate.toIso8601String(),
|
||||
"endDate": endDate.toIso8601String(),
|
||||
"familyMemberId": familyMemberId,
|
||||
"isAllDay": isAllDay,
|
||||
};
|
||||
}
|
||||
}
|
||||
36
flutter_app/lib/models/todo_item.dart
Normal file
36
flutter_app/lib/models/todo_item.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
class TodoItem {
|
||||
final String id;
|
||||
final String familyMemberId;
|
||||
final String title;
|
||||
final bool completed;
|
||||
final DateTime? dueDate;
|
||||
|
||||
const TodoItem({
|
||||
required this.id,
|
||||
required this.familyMemberId,
|
||||
required this.title,
|
||||
required this.completed,
|
||||
required this.dueDate,
|
||||
});
|
||||
|
||||
factory TodoItem.fromJson(Map<String, dynamic> json) {
|
||||
return TodoItem(
|
||||
id: json["_id"] as String? ?? "",
|
||||
familyMemberId: json["familyMemberId"] as String? ?? "",
|
||||
title: json["title"] as String? ?? "",
|
||||
completed: json["completed"] as bool? ?? false,
|
||||
dueDate: json["dueDate"] != null
|
||||
? DateTime.tryParse(json["dueDate"] as String)
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
"familyMemberId": familyMemberId,
|
||||
"title": title,
|
||||
"completed": completed,
|
||||
"dueDate": dueDate?.toIso8601String(),
|
||||
};
|
||||
}
|
||||
}
|
||||
25
flutter_app/lib/models/weather_info.dart
Normal file
25
flutter_app/lib/models/weather_info.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
class WeatherInfo {
|
||||
final String description;
|
||||
final double temperature;
|
||||
final String icon;
|
||||
final String city;
|
||||
|
||||
const WeatherInfo({
|
||||
required this.description,
|
||||
required this.temperature,
|
||||
required this.icon,
|
||||
required this.city,
|
||||
});
|
||||
|
||||
factory WeatherInfo.fromJson(Map<String, dynamic> json) {
|
||||
final weather = (json["weather"] as List<dynamic>? ?? []).isNotEmpty
|
||||
? json["weather"][0] as Map<String, dynamic>
|
||||
: {};
|
||||
return WeatherInfo(
|
||||
description: weather["description"] as String? ?? "",
|
||||
temperature: (json["main"]?["temp"] as num?)?.toDouble() ?? 0,
|
||||
icon: weather["icon"] as String? ?? "",
|
||||
city: json["name"] as String? ?? "",
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user