Skip to content

Ashley - #3

Open
AshleyBekemeier wants to merge 4 commits into
getflip:mainfrom
AshleyBekemeier:Ashley
Open

Ashley#3
AshleyBekemeier wants to merge 4 commits into
getflip:mainfrom
AshleyBekemeier:Ashley

Conversation

@AshleyBekemeier

Copy link
Copy Markdown

No description provided.

@sobimor sobimor self-assigned this May 28, 2025

@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 @AshleyBekemeier 👏🏾
I’m really impressed with your code. There are just a few minor comments, but overall, it was really good.

Comment on lines +37 to +41
final newTodo = {
'title': title,
'description': description,
'createdAtSeconds': DateTime.now().millisecondsSinceEpoch ~/ 1000,
};

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: You could have request body DTO with a to json method to avoid creating/parsing JSON directly here

await remoteDataSource.deleteTodo(todoId);
} catch (e) {
log('Error deleting todo: $e');
// Optionally rethrow or handle error

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 an error occurs while calling the delete API, we don’t handle it at all. Instead, you can rethrow in the catch block, and handle it in Cubit (with another try catch), and emit an error state.

}

final todo = todos[index];
final isFavourited = favouritedIds.contains(todo.id);

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 offer a method in state to not have this contains call here in ui level.
something like below:

class TodosLoaded extends TodoState {
  final List<TodoModel> todos;
  final Set<String> favouritedIds;

  const TodosLoaded({required this.todos, required this.favouritedIds});

///new changes
  bool isTodoFavourited(String todoId) => favouritedIds.contains(todoId);
///new changes

  @override
  List<Object> get props => [todos, favouritedIds];
}

class TodoItem extends StatelessWidget {
final TodoModel todo;
final ValueChanged<bool?> onCheckboxChanged;
final VoidCallback onViewDetails;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nitpick (non-blocking): onTap or onPressed is better naming based on flutter naming convention/best practices

),
],
),
GestureDetector(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

chore: we don't need 2 GestureDetector for detecting onItemPressed event.
you can remove this one here and move the GestureDetector in line 40 to parent widget in this widget.

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