Orientação gerada a partir de informações públicas. Apenas para referência.
Uma ListView infinita e performática que permite rolagem programática instantânea para qualquer item por índice. Ideal para grandes conjuntos de dados onde a navegação rápida é essencial. O widget renderiza apenas os itens visíveis de forma eficiente, mantendo um desempenho suave em todas as plataformas. Suporta integração sem problemas com aplicativos Flutter existentes e é otimizado para conteúdo dinâmico. Projetado para desenvolvedores que buscam interações responsivas em listas sem comprometer velocidade ou uso de memória.
Casos de uso
Grandes listas de dados com navegação instantânea baseada em índice
Atualizações dinâmicas de conteúdo em tempo real
Rolagem de alto desempenho em aplicativos móveis e da web
Renderização eficiente de listas infinitas
Experiência do usuário suave em interfaces com muitos dados
Principais recursos
Pulo instantâneo para qualquer item da lista por índice
Renderização otimizada para grandes conjuntos de dados
Suporta rolagem infinita com sobrecarga mínima de memória
Compatibilidade multiplataforma
Otimizações de desempenho embutidas
Integração fácil com projetos Flutter existentes
Indicado para
Desenvolvedores de aplicativos intensivos em dados
Aplicativos que exigem navegação rápida em listas
Equipes direcionadas para múltiplas plataformas
Projetos com listas grandes ou dinamicamente atualizadas
Usuários que precisam de interações de interface responsivas
Considerações
Requer gerenciamento cuidadoso dos índices de itens
Pode ser necessário lógica adicional para layouts de itens complexos
Não ideal para listas estáticas e pequenas
O desempenho depende da complexidade do item
Mais adequado para cenários com saltos frequentes de índice
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
indexed_list_view
Similar to a ListView, but:
Lets you programmatically jump to any item, by index.
The jump happens instantly, no matter if you have millions of items.
It can also animate the scroll, instead of jumping.
Limitations
The list is always infinite both to positive and negative indexes.
In other words, it can be scrolled indefinitely both to the top and to the bottom.
In special, this is useful for implementing calendars, where you want to be able to
jump to specific dates, as calendars can be scrolled indefinitely, both to the past and
future dates.
You can define index bounds by giving it a minItemCount and maxItemCount, but this
will not prevent the list from scrolling indefinitely. When showing items out of the index
bounds, or when your itemBuilder returns null, it will ask the emptyItemBuilder to
create an "empty" item to be displayed instead. As default, this will return empty
containers.
Usage
First, create an indexed scroll controller:
var controller = IndexedScrollController();
Optionally, you may setup an initial index and/or initial scroll offset:
var controller = IndexedScrollController(
initialIndex: 75,
initialScrollOffset : 30.0);
Then, create the indexed list view, and pass it the controller:
To jump, use the controller methods like jumpToIndex :
controller.jumpToIndex(10000);
Details
The IndexedScrollController has not only an offset in pixels, but also an origin-index
that indicates which item is considered to be at the offset position 0.0.
So there are two ways for you to move the list programmatically:
You can change only the offset, or else change the originIndex and the offset at the
same time.
To change the originIndex you make an "index jump". This jump is cheap, since it doesn't
need to build all widgets between the old and new positions. It will just change the
origin.
If you want to move the list programmatically you must create a scroll controller of
type IndexedScrollController and pass it in the list constructor. However, if all you
need is an infinite list without jumps, then there is no need to even create a controller.
You move the list programmatically by calling the controller methods.
Controller Methods
jumpToIndex(index)
This is the most common method for you to use. It jumps the origin-index to the given
index, and the scroll-position to 0.0.
jumpToIndexAndOffset(index, offset)
Jumps the origin-index to the given index, and the scroll-position to offset, without
animation.
animateToIndex(index)
If the current origin-index is already the same as the given index, animates the
position from its current value to the offset position relative to the origin-index.
However, if the current origin-index is different from the given index, this will jump
to the new index, without any animation. In general, there are never animations when
the index changes.
animateToIndexAndOffset(index, offset)
Same as animateToIndex() but also lets you specify the new offset.
jumpTo(offset)
Goes to origin-index "0", and then jumps the scroll position from its current value to
the given offset, without animation.
animateTo(offset)
If the current origin-index is already "0", animates the position from its current
value to the offset position.
However, if the current origin-index is different from "0", this will jump to index "0"
and the given offset, without any animation. In general, there are never animations
when the index changes.
jumpToWithSameOriginIndex(offset)
Jumps the offset, relative to the current origin-index.
animateToWithSameOriginIndex(offset)
Animates the offset, relative to the current origin-index.
jumpToRelative(offset)
Jumps the offset, adding or subtracting from the current offset. It keeps the same
origin-index.
animateToRelative(offset)
Animates the offset, adding or subtracting from the current offset. It keeps the same
origin-index.
Don't forget to check
the example tab. It
shows an infinite list of items of different heights, and you may tap buttons to run some
of the methods explained above.