first commit

This commit is contained in:
Courtney Arnold 2026-08-08 08:22:14 -05:00
commit e630f2a3ec
80 changed files with 3889 additions and 0 deletions

View file

@ -0,0 +1,39 @@
class FuelEntry {
final String id;
final String vehicleId;
final DateTime date;
final double gallons;
final double pricePerGallon;
final double totalCost;
final String? receiptImagePath;
FuelEntry({
required this.id,
required this.vehicleId,
required this.date,
required this.gallons,
required this.pricePerGallon,
required this.totalCost,
this.receiptImagePath,
});
Map<String, dynamic> toJson() => {
'id': id,
'vehicleId': vehicleId,
'date': date.toIso8601String(),
'gallons': gallons,
'pricePerGallon': pricePerGallon,
'totalCost': totalCost,
'receiptImagePath': receiptImagePath,
};
factory FuelEntry.fromJson(Map<String, dynamic> json) => FuelEntry(
id: json['id'] as String,
vehicleId: json['vehicleId'] as String,
date: DateTime.parse(json['date'] as String),
gallons: (json['gallons'] as num).toDouble(),
pricePerGallon: (json['pricePerGallon'] as num).toDouble(),
totalCost: (json['totalCost'] as num).toDouble(),
receiptImagePath: json['receiptImagePath'] as String?,
);
}

48
lib/models/vehicle.dart Normal file
View file

@ -0,0 +1,48 @@
class Vehicle {
final String id;
final String make;
final String model;
final String color;
final String licensePlate;
Vehicle({
required this.id,
required this.make,
required this.model,
required this.color,
required this.licensePlate,
});
String get displayName => '$color $make $model ($licensePlate)';
Vehicle copyWith({
String? make,
String? model,
String? color,
String? licensePlate,
}) {
return Vehicle(
id: id,
make: make ?? this.make,
model: model ?? this.model,
color: color ?? this.color,
licensePlate: licensePlate ?? this.licensePlate,
);
}
Map<String, dynamic> toJson() => {
'id': id,
'make': make,
'model': model,
'color': color,
'licensePlate': licensePlate,
};
factory Vehicle.fromJson(Map<String, dynamic> json) => Vehicle(
id: json['id'] as String,
make: json['make'] as String,
model: json['model'] as String,
color: json['color'] as String,
licensePlate: json['licensePlate'] as String,
);
}