From b811c95e933aca6a89674717caa23c05bc7b8d44 Mon Sep 17 00:00:00 2001 From: Albert221 Date: Fri, 2 Oct 2020 21:33:15 +0200 Subject: [PATCH] Move done items to the bottom of the list --- lib/store/items/selectors.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/store/items/selectors.dart b/lib/store/items/selectors.dart index 7804bbf3..39a48dda 100644 --- a/lib/store/items/selectors.dart +++ b/lib/store/items/selectors.dart @@ -6,7 +6,12 @@ class ItemsSelectors { static List currentListItems(Store 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 store) =>