mirror of
https://github.com/FoggedLens/deflock-app.git
synced 2026-02-12 16:52:51 +00:00
Materialize options iterable to list in optionsViewBuilder
Avoids repeated iteration of the lazy .where().take() iterable on each call to .length and .elementAt() in ListView.builder. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -143,6 +143,7 @@ class _NSITagValueFieldState extends State<NSITagValueField> {
|
||||
AutocompleteOnSelected<String> onSelected,
|
||||
Iterable<String> options,
|
||||
) {
|
||||
final optionList = options.toList(growable: false);
|
||||
return Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Material(
|
||||
@@ -153,9 +154,9 @@ class _NSITagValueFieldState extends State<NSITagValueField> {
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.zero,
|
||||
shrinkWrap: true,
|
||||
itemCount: options.length,
|
||||
itemCount: optionList.length,
|
||||
itemBuilder: (context, index) {
|
||||
final option = options.elementAt(index);
|
||||
final option = optionList[index];
|
||||
return ListTile(
|
||||
dense: true,
|
||||
title: Text(option, style: const TextStyle(fontSize: 14)),
|
||||
|
||||
Reference in New Issue
Block a user