MIF_E31222656/lib/domain/entities/crop_schedule.dart

44 lines
908 B
Dart

import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
class CropSchedule extends Equatable {
final String id;
final String cropName;
final DateTime startDate;
final DateTime endDate;
final int plot;
final String? fieldId;
final String? status;
final String? notes;
final Color color;
const CropSchedule({
required this.id,
required this.cropName,
required this.startDate,
required this.endDate,
required this.plot,
required this.fieldId,
this.status,
this.notes,
required this.color,
});
static Color generateColor(String id) {
final hash = id.codeUnits.fold(0, (a, b) => a + b);
return Colors.primaries[hash % Colors.primaries.length];
}
@override
List<Object?> get props => [
id,
cropName,
startDate,
endDate,
plot,
fieldId,
status,
notes,
color
];
}