fix(mobile): fix stale refs in use timer

The timer hook preserved the values of the original local variables,
which caused issues when hiding controls for videos. The callback can be
changed so that it always sees the latest value with useRef, and it can
be simplified significantly using a function rather than state class.
This commit is contained in:
Thomas Way
2026-04-05 04:03:32 +01:00
parent 776b9cbad5
commit 0651612d46
2 changed files with 14 additions and 33 deletions
@@ -74,7 +74,7 @@ class ViewerBottomBar extends ConsumerWidget {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (asset.isVideo) VideoControls(key: ValueKey(asset.heroTag), videoPlayerName: asset.heroTag),
if (asset.isVideo) VideoControls(videoPlayerName: asset.heroTag),
if (!isReadonlyModeEnabled)
Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: actions),
],