45 lines
958 B
Dart
45 lines
958 B
Dart
import 'package:happy_camper_proto/task.dart';
|
|
|
|
class Preplist {
|
|
Preplist({required this.name, required this.tasks});
|
|
|
|
String name;
|
|
List<Task> tasks;
|
|
|
|
int get count {
|
|
return tasks.length;
|
|
}
|
|
|
|
int get countIncomplete {
|
|
return tasks.where((task) => !task.complete).length;
|
|
}
|
|
|
|
int get countComplete {
|
|
return tasks.where((task) => task.complete).length;
|
|
}
|
|
|
|
static List<Preplist> exampleData() => [
|
|
Preplist(
|
|
name: "example 1",
|
|
tasks: [
|
|
Task(text: "test 1", complete: true),
|
|
Task(text: "test 2"),
|
|
Task(text: "test 3"),
|
|
Task(text: "test 4", complete: true),
|
|
],
|
|
),
|
|
Preplist(
|
|
name: "example 2",
|
|
tasks: [
|
|
Task(text: "test 5"),
|
|
],
|
|
),
|
|
Preplist(
|
|
name: "example 3",
|
|
tasks: [
|
|
Task(text: "test 6", complete: true),
|
|
],
|
|
),
|
|
];
|
|
}
|