fix(mobile): use key on video controls (#27512)

The widget is not recreated correctly when videoPlayName changes, which
can cause weird behaviour with hooks and timers (like timers not firing
when they should do). Using a key forces flutter to recreate the widget
properly and allow the assumptions in build to work correctly.
This commit is contained in:
Thomas 2026-04-05 03:54:34 +01:00 committed by GitHub
parent 960be0c27a
commit 776b9cbad5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -74,7 +74,7 @@ class ViewerBottomBar extends ConsumerWidget {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (asset.isVideo) VideoControls(videoPlayerName: asset.heroTag),
if (asset.isVideo) VideoControls(key: ValueKey(asset.heroTag), videoPlayerName: asset.heroTag),
if (!isReadonlyModeEnabled)
Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: actions),
],