Created
May 10, 2022 19:53
-
-
Save linean/2f58f425f30938f1360f684c17d0dfee to your computer and use it in GitHub Desktop.
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
var itemsOffsets by remember { mutableStateOf(mapOf<KEY, ItemOffset>()) } | |
key(itemKeys) { | |
itemsOffsets = items.mapIndexed { index, item -> | |
val key = itemKey(item) | |
key to when { | |
itemsOffsets.containsKey(key) -> itemsOffsets.getValue(key) | |
else -> ItemOffset(gridOffsets[index]) | |
} | |
}.toMap() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment