Files
Tracker/lib/models/teaching_plan.dart

68 lines
1.3 KiB
Dart

import 'package:hive/hive.dart';
import 'package:uuid/uuid.dart';
part 'teaching_plan.g.dart';
@HiveType(typeId: 10)
class TeachingPlan {
@HiveField(0)
final String id;
@HiveField(1)
final String topic;
@HiveField(2)
final String scriptureReference;
@HiveField(3)
final String notes;
@HiveField(4)
final DateTime date;
@HiveField(5)
final bool isCompleted;
TeachingPlan({
required this.id,
required this.topic,
required this.scriptureReference,
required this.notes,
required this.date,
this.isCompleted = false,
});
TeachingPlan copyWith({
String? topic,
String? scriptureReference,
String? notes,
DateTime? date,
bool? isCompleted,
}) {
return TeachingPlan(
id: id,
topic: topic ?? this.topic,
scriptureReference: scriptureReference ?? this.scriptureReference,
notes: notes ?? this.notes,
date: date ?? this.date,
isCompleted: isCompleted ?? this.isCompleted,
);
}
factory TeachingPlan.create({
required String topic,
required String scriptureReference,
required String notes,
required DateTime date,
}) {
return TeachingPlan(
id: const Uuid().v4(),
topic: topic,
scriptureReference: scriptureReference,
notes: notes,
date: date,
isCompleted: false,
);
}
}