forked from eva/focus-flow
fix(project): clear dart analyzer issues
This commit is contained in:
parent
26db079846
commit
5b20e46987
3 changed files with 17 additions and 13 deletions
|
|
@ -1,7 +1,6 @@
|
|||
/// Public exports for the ADHD scheduling core.
|
||||
///
|
||||
/// Keep this file small. Implementation details belong in `lib/src/`.
|
||||
library adhd_scheduler_core;
|
||||
// Public exports for the ADHD scheduling core.
|
||||
//
|
||||
// Keep this file small. Implementation details belong in `lib/src/`.
|
||||
|
||||
export 'src/models.dart';
|
||||
export 'src/scheduling_engine.dart';
|
||||
|
|
|
|||
|
|
@ -181,7 +181,8 @@ class Task {
|
|||
final TaskStatistics stats;
|
||||
|
||||
bool get isFlexible => type == TaskType.flexible;
|
||||
bool get isRequiredVisible => type == TaskType.critical || type == TaskType.inflexible;
|
||||
bool get isRequiredVisible =>
|
||||
type == TaskType.critical || type == TaskType.inflexible;
|
||||
bool get isLocked => type == TaskType.locked;
|
||||
bool get isBacklog => status == TaskStatus.backlog;
|
||||
|
||||
|
|
@ -213,7 +214,8 @@ class Task {
|
|||
reward: reward ?? this.reward,
|
||||
difficulty: difficulty ?? this.difficulty,
|
||||
durationMinutes: durationMinutes ?? this.durationMinutes,
|
||||
scheduledStart: clearSchedule ? null : (scheduledStart ?? this.scheduledStart),
|
||||
scheduledStart:
|
||||
clearSchedule ? null : (scheduledStart ?? this.scheduledStart),
|
||||
scheduledEnd: clearSchedule ? null : (scheduledEnd ?? this.scheduledEnd),
|
||||
parentTaskId: parentTaskId ?? this.parentTaskId,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
|
|
@ -286,7 +288,7 @@ class TimeInterval {
|
|||
required this.start,
|
||||
required this.end,
|
||||
this.label,
|
||||
}) : assert(!end.isBefore(start), 'end must not be before start');
|
||||
});
|
||||
|
||||
final DateTime start;
|
||||
final DateTime end;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class SchedulingWindow {
|
|||
const SchedulingWindow({
|
||||
required this.start,
|
||||
required this.end,
|
||||
}) : assert(!end.isBefore(start), 'end must not be before start');
|
||||
});
|
||||
|
||||
final DateTime start;
|
||||
final DateTime end;
|
||||
|
|
@ -63,7 +63,9 @@ class SchedulingInput {
|
|||
}
|
||||
|
||||
List<Task> get requiredVisibleTasks {
|
||||
return tasks.where((task) => task.isRequiredVisible).toList(growable: false);
|
||||
return tasks
|
||||
.where((task) => task.isRequiredVisible)
|
||||
.toList(growable: false);
|
||||
}
|
||||
|
||||
List<TimeInterval> get flexibleIntervals {
|
||||
|
|
@ -312,7 +314,8 @@ class SchedulingEngine {
|
|||
required Duration duration,
|
||||
required List<TimeInterval> blocked,
|
||||
}) {
|
||||
final sortedBlocked = [...blocked]..sort((a, b) => a.start.compareTo(b.start));
|
||||
final sortedBlocked = [...blocked]
|
||||
..sort((a, b) => a.start.compareTo(b.start));
|
||||
var cursor = windowStart;
|
||||
|
||||
for (final interval in sortedBlocked) {
|
||||
|
|
@ -327,7 +330,8 @@ class SchedulingEngine {
|
|||
}
|
||||
|
||||
final candidateEnd = cursor.add(duration);
|
||||
if (candidateEnd.isBefore(windowEnd) || candidateEnd.isAtSameMomentAs(windowEnd)) {
|
||||
if (candidateEnd.isBefore(windowEnd) ||
|
||||
candidateEnd.isAtSameMomentAs(windowEnd)) {
|
||||
return TimeInterval(start: cursor, end: candidateEnd);
|
||||
}
|
||||
|
||||
|
|
@ -420,8 +424,7 @@ _BacklogInsertionPlan? _planBacklogInsertion({
|
|||
}
|
||||
|
||||
final startsBeforeWindow = interval.start.isBefore(input.window.start);
|
||||
final startsAfterWindow =
|
||||
interval.start.isAfter(input.window.end) ||
|
||||
final startsAfterWindow = interval.start.isAfter(input.window.end) ||
|
||||
interval.start.isAtSameMomentAs(input.window.end);
|
||||
|
||||
if (startsBeforeWindow || startsAfterWindow) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue