Skip to content

Nuno - #2

Open
nunofaria11 wants to merge 7 commits into
mainfrom
workshop/nuno
Open

Nuno#2
nunofaria11 wants to merge 7 commits into
mainfrom
workshop/nuno

Conversation

@nunofaria11

Copy link
Copy Markdown
  1. 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
  1. 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.
  1. 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.

@nunofaria11 nunofaria11 changed the title Nuno (Flutter upskilling workshop) Draft: Nuno (Flutter upskilling workshop) May 27, 2025
@nunofaria11 nunofaria11 changed the title Draft: Nuno (Flutter upskilling workshop) Nuno May 27, 2025
@koraxis
koraxis requested a review from sobimor May 27, 2025 13:49

@sobimor sobimor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Please dispose of all controllers in the dispose method. (failing to dispose of it can lead to memory leaks)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants