Nuno - #2
Open
nunofaria11 wants to merge 7 commits into
Open
Conversation
nunofaria11
commented
May 27, 2025
- Implementing Description and Image for Todos
- Study the API response to understand the structure
- Add description and imageUrl fields to TodoDTO and TodoModel
- Update TodoRemoteDataSource, TodoRepository and TodoCubit to handle the new fields
- Modify the UI to display changes: Show the imageurl as a thumbnail and limit the description to max two lines
- Implementing "Complete" Feature
- Modify the necessary layers, files, and classes to capture the isDone status from the API.
- Add the functionality to toggle a todo in the UI and also update the data in the backend to reflect those changes.
- Bonus: Additional improvements (pick the ones you want)
- Improve the TodoFormScreen, so the user optionally can add description and imageUrl to their Todo when they create one
- Implement the "Favourite" feature, where you can locally save the favorited todos. Tip: You can use TodoLocalDataSource.
- Implement a todo detail page when the user taps on a todo to show the image bigger and with the full description.
- Implement a delete Todo functionality, where the user can delete todos on the list and also update the data in the backend to reflect those changes.
…related classes and UI
…lity in TodoRemoteDataSource and TodoRepository; update UI to reflect changes
…ggle to onToggled in TodoItem for clarity
…nctions and enhancing error message display
…lds; update related classes and UI components accordingly
sobimor
requested changes
Jun 11, 2025
sobimor
left a comment
There was a problem hiding this comment.
Well done @nunofaria11 👏🏾
There are just a few minor comments, but overall, it was really good.
Comment on lines
+36
to
+43
| final newTodo = { | ||
| 'id': generateId(), | ||
| 'title': title, | ||
| 'description': description, | ||
| 'imageUrl': imageUrl, | ||
| 'createdAtSeconds': DateTime.now().millisecondsSinceEpoch ~/ 1000, | ||
| 'isDone': false, | ||
| }; |
There was a problem hiding this comment.
suggestion (non-blocking): You could have request body DTO with a to json method to avoid creating/parsing JSON directly here
Comment on lines
+36
to
+43
| final updatedTodos = | ||
| todos | ||
| .map( | ||
| (todo) => todo.id == id ? todo.copyWith(isDone: isDone) : todo, | ||
| ) | ||
| .toList(); | ||
| emit(TodosLoaded(todos: updatedTodos)); | ||
| await _repository.updateTodo(id, isDone); |
There was a problem hiding this comment.
issue: If the API call fails for any reason, we display an incorrect state to the user. In the catch block, you need to revert the state.
Comment on lines
+16
to
+17
| final _descriptionController = TextEditingController(); | ||
| final _imageUrlController = TextEditingController(); |
There was a problem hiding this comment.
issue: Please dispose of all controllers in the dispose method. (failing to dispose of it can lead to memory leaks)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.