mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 16:18:22 +08:00
use findItemIndexCallback
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -34,12 +34,12 @@ class _SuperChatPanelState extends DebounceStreamState<SuperChatPanel, bool>
|
|||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
physics: const ClampingScrollPhysics(),
|
physics: const ClampingScrollPhysics(),
|
||||||
itemCount: widget.controller.superChatMsg.length,
|
itemCount: widget.controller.superChatMsg.length,
|
||||||
findChildIndexCallback: (key) {
|
findItemIndexCallback: (key) {
|
||||||
final index = widget.controller.superChatMsg.indexWhere(
|
final index = widget.controller.superChatMsg.indexWhere(
|
||||||
(i) => i.id == (key as ValueKey<int>).value,
|
(i) => i.id == (key as ValueKey<int>).value,
|
||||||
);
|
);
|
||||||
// Multiply by 2 to account for separators
|
// Return item index directly - no need to multiply by 2.
|
||||||
return index == -1 ? null : index * 2;
|
return index == -1 ? null : index;
|
||||||
},
|
},
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final item = widget.controller.superChatMsg[index];
|
final item = widget.controller.superChatMsg[index];
|
||||||
|
|||||||
Reference in New Issue
Block a user