Код: Выделить всё
/**
* Adds a [count] of items.
*
* @param count the items count
* @param key a factory of stable and unique keys representing the item. Using the same key
* for multiple items in the list is not allowed. Type of the key should be saveable
* via Bundle on Android. If null is passed the position in the list will represent the key.
* When you specify the key the scroll position will be maintained based on the key, which
* means if you add/remove items before the current visible item the item with the given key
* will be kept as the first visible one. This can be overridden by calling
* 'requestScrollToItem' on the 'LazyListState'.
* @param contentType a factory of the content types for the item. The item compositions of
* the same type could be reused more efficiently. Note that null is a valid type and items of such
* type will be considered compatible.
* @param itemContent the content displayed by a single item
*/
fun items(
count: Int,
key: ((index: Int) -> Any)? = null,
contentType: (index: Int) -> Any? = { null },
itemContent: @Composable LazyItemScope.(index: Int) -> Unit
) {
error("The method is not implemented")
}
< /code>
Я на самом деле не уверен, как это работает, учитывая это просто ошибки. Я полагаю, что это может быть плагин компилятора, но здесь не фокус. Эти перегородки различаются в зависимости от того, какой тип элемента списка представлен перед ними. Поэтому мне нужно «обнаружить» тип типа списка, чтобы отобразить правильный делитель. что может быть изменение в одна такая категория элементов, и мне бы действительно пришлось принять запечатанный класс itemtype (val actualtype: inese?) Подумал эти вопросы, заставило меня начать задаваться вопросом, что в целом следует рассматривать элементы того же типа? Что это за оптимизация, которую сочиняет внутренне, и когда она выигрывает от ContentType ? Когда я могу сделать вещи только хуже, когда ContentType может быть одинаковым для элементов, которые немного различаются?
Подробнее здесь: https://stackoverflow.com/questions/795 ... ontenttype
Мобильная версия