fix(media): serialize browsing and metadata mutations

This commit is contained in:
edde746
2026-07-24 03:46:50 +02:00
parent 43a8fe020d
commit f8bfecf57d
30 changed files with 3088 additions and 465 deletions
+7 -2
View File
@@ -26,9 +26,14 @@ void scrollContextToCenter(BuildContext? context) {
/// then scrolls to `currentIndex * itemHeight`, clamped to max extent.
/// Call once after the first build; the callback is a no-op if the key or
/// controller aren't ready yet.
void scrollToCurrentItem(ScrollController controller, GlobalKey firstItemKey, int currentIndex) {
void scrollToCurrentItem(
ScrollController controller,
GlobalKey firstItemKey,
int currentIndex, {
bool Function()? isCurrent,
}) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (!controller.hasClients) return;
if (isCurrent?.call() == false || !controller.hasClients) return;
final itemHeight = (firstItemKey.currentContext?.findRenderObject() as RenderBox?)?.size.height;
if (itemHeight == null) return;
final maxExtent = controller.position.maxScrollExtent;