Skip to content

Commit

Permalink
Move done items to the bottom of the list
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert221 committed Oct 2, 2020
1 parent 75f87da commit b811c95
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/store/items/selectors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ class ItemsSelectors {
static List<Item> currentListItems(Store<FastShoppingState> store) =>
store.state.items
.where((item) => item.shoppingListId == store.state.currentListId)
.toList();
.toList()
..sort((a, b) {
if (a.done == b.done) return 0;

return a.done ? 1 : -1;
});

static bool isCurrentListEveryItemDoneOrDeleted(
Store<FastShoppingState> store) =>
Expand Down

0 comments on commit b811c95

Please sign in to comment.