Resolve merge conflicts: README + ignore IDE files
This commit is contained in:
22
lib/models/calendar_event_entry.dart
Normal file
22
lib/models/calendar_event_entry.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
class CalendarEventEntry {
|
||||
const CalendarEventEntry({
|
||||
required this.date,
|
||||
required this.title,
|
||||
required this.description,
|
||||
required this.category,
|
||||
});
|
||||
|
||||
final DateTime date;
|
||||
final String title;
|
||||
final String description;
|
||||
final String category;
|
||||
|
||||
factory CalendarEventEntry.fromJson(Map<String, dynamic> json) {
|
||||
return CalendarEventEntry(
|
||||
date: DateTime.parse(json['date'].toString()),
|
||||
title: json['title'].toString(),
|
||||
description: json['description'].toString(),
|
||||
category: json['category'].toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
19
lib/models/colony_route.dart
Normal file
19
lib/models/colony_route.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
class ColonyRoute {
|
||||
const ColonyRoute({
|
||||
required this.colonia,
|
||||
required this.routeId,
|
||||
required this.horarioEstimado,
|
||||
});
|
||||
|
||||
final String colonia;
|
||||
final String routeId;
|
||||
final String horarioEstimado;
|
||||
|
||||
factory ColonyRoute.fromJson(Map<String, dynamic> json) {
|
||||
return ColonyRoute(
|
||||
colonia: json['colonia'].toString(),
|
||||
routeId: json['routeId'].toString(),
|
||||
horarioEstimado: json['horarioEstimado'].toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
25
lib/models/demo_profile.dart
Normal file
25
lib/models/demo_profile.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
class DemoProfile {
|
||||
const DemoProfile({
|
||||
required this.name,
|
||||
required this.email,
|
||||
required this.password,
|
||||
required this.colonia,
|
||||
required this.routeId,
|
||||
});
|
||||
|
||||
final String name;
|
||||
final String email;
|
||||
final String password;
|
||||
final String colonia;
|
||||
final String routeId;
|
||||
|
||||
factory DemoProfile.fromJson(Map<String, dynamic> json) {
|
||||
return DemoProfile(
|
||||
name: json['name'].toString(),
|
||||
email: json['email'].toString(),
|
||||
password: json['password'].toString(),
|
||||
colonia: json['colonia'].toString(),
|
||||
routeId: json['routeId'].toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
30
lib/models/route_guide_entry.dart
Normal file
30
lib/models/route_guide_entry.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
class RouteGuideEntry {
|
||||
const RouteGuideEntry({
|
||||
required this.routeId,
|
||||
required this.wasteType,
|
||||
required this.schedule,
|
||||
required this.days,
|
||||
required this.note,
|
||||
});
|
||||
|
||||
final String routeId;
|
||||
final String wasteType;
|
||||
final String schedule;
|
||||
final List<String> days;
|
||||
final String note;
|
||||
|
||||
factory RouteGuideEntry.fromJson(Map<String, dynamic> json) {
|
||||
final daysJson = json['days'];
|
||||
final days = daysJson is List
|
||||
? daysJson.map((day) => day.toString()).toList(growable: false)
|
||||
: <String>[];
|
||||
|
||||
return RouteGuideEntry(
|
||||
routeId: json['routeId'].toString(),
|
||||
wasteType: json['wasteType'].toString(),
|
||||
schedule: json['schedule'].toString(),
|
||||
days: days,
|
||||
note: json['note'].toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
26
lib/models/route_notification.dart
Normal file
26
lib/models/route_notification.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
class RouteNotification {
|
||||
const RouteNotification({
|
||||
required this.triggerEvent,
|
||||
required this.condition,
|
||||
required this.title,
|
||||
required this.body,
|
||||
});
|
||||
|
||||
final String triggerEvent;
|
||||
final String condition;
|
||||
final String title;
|
||||
final String body;
|
||||
|
||||
factory RouteNotification.fromJson(Map<String, dynamic> json) {
|
||||
final payload = json['pushPayload'] is Map<String, dynamic>
|
||||
? json['pushPayload'] as Map<String, dynamic>
|
||||
: <String, dynamic>{};
|
||||
|
||||
return RouteNotification(
|
||||
triggerEvent: json['triggerEvent'].toString(),
|
||||
condition: json['condition'].toString(),
|
||||
title: payload['title']?.toString() ?? '',
|
||||
body: payload['body']?.toString() ?? '',
|
||||
);
|
||||
}
|
||||
}
|
||||
25
lib/models/route_position.dart
Normal file
25
lib/models/route_position.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
class RoutePosition {
|
||||
const RoutePosition({
|
||||
required this.positionId,
|
||||
required this.lat,
|
||||
required this.lng,
|
||||
required this.speed,
|
||||
required this.timestamp,
|
||||
});
|
||||
|
||||
final int positionId;
|
||||
final double lat;
|
||||
final double lng;
|
||||
final double speed;
|
||||
final DateTime timestamp;
|
||||
|
||||
factory RoutePosition.fromJson(Map<String, dynamic> json) {
|
||||
return RoutePosition(
|
||||
positionId: (json['positionId'] as num).toInt(),
|
||||
lat: (json['lat'] as num).toDouble(),
|
||||
lng: (json['lng'] as num).toDouble(),
|
||||
speed: (json['speed'] as num).toDouble(),
|
||||
timestamp: DateTime.parse(json['timestamp'].toString()),
|
||||
);
|
||||
}
|
||||
}
|
||||
35
lib/models/truck_route.dart
Normal file
35
lib/models/truck_route.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
import 'route_position.dart';
|
||||
|
||||
class TruckRoute {
|
||||
const TruckRoute({
|
||||
required this.routeId,
|
||||
required this.name,
|
||||
required this.truckId,
|
||||
required this.status,
|
||||
required this.positions,
|
||||
});
|
||||
|
||||
final String routeId;
|
||||
final String name;
|
||||
final int truckId;
|
||||
final String status;
|
||||
final List<RoutePosition> positions;
|
||||
|
||||
factory TruckRoute.fromJson(Map<String, dynamic> json) {
|
||||
final positionsJson = json['positions'];
|
||||
final positions = positionsJson is List
|
||||
? positionsJson
|
||||
.whereType<Map<String, dynamic>>()
|
||||
.map(RoutePosition.fromJson)
|
||||
.toList(growable: false)
|
||||
: <RoutePosition>[];
|
||||
|
||||
return TruckRoute(
|
||||
routeId: json['routeId'].toString(),
|
||||
name: json['name'].toString(),
|
||||
truckId: (json['truckId'] as num).toInt(),
|
||||
status: json['status'].toString(),
|
||||
positions: positions,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user