-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
50 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
part of 'tasks_cubit.dart'; | ||
|
||
final class TasksState extends Equatable { | ||
final List<Task> tasks; | ||
final bool showDoneTasks; | ||
final bool isInitialized; | ||
|
||
const TasksState( | ||
this.tasks, { | ||
required this.showDoneTasks, | ||
this.isInitialized = false, | ||
}); | ||
|
||
List<Task> get tasksToDisplay => | ||
showDoneTasks ? tasks : tasks.where((task) => !task.isDone).toList(); | ||
|
||
int get doneTaskCount => | ||
tasks.fold(0, (acc, task) => acc + (task.isDone ? 1 : 0)); | ||
|
||
TasksState copyWith({ | ||
List<Task>? tasks, | ||
bool? showDoneTasks, | ||
bool? isInitialized, | ||
}) { | ||
return TasksState( | ||
tasks ?? this.tasks, | ||
showDoneTasks: showDoneTasks ?? this.showDoneTasks, | ||
isInitialized: isInitialized ?? this.isInitialized, | ||
); | ||
} | ||
|
||
@override | ||
List<Object?> get props => [tasks, showDoneTasks, isInitialized]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
lib/presentation/screens/home_screen/widgets/tasks_visibility_button.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters