[mob][photos] Fix state issue with video loop toggle button

This commit is contained in:
ashilkn
2024-08-30 18:13:46 +05:30
parent f8593255ac
commit c6ec5cf645

View File

@@ -57,6 +57,7 @@ class FileAppBarState extends State<FileAppBar> {
late final StreamSubscription<GuestViewEvent> _guestViewEventSubscription;
bool isGuestView = false;
bool shouldLoopVideo = Configuration.instance.shouldLoopVideo();
bool _reloadActions = false;
@override
void didUpdateWidget(FileAppBar oldWidget) {
@@ -89,8 +90,9 @@ class FileAppBarState extends State<FileAppBar> {
//When the widget is initialized, the actions are not available.
//Cannot call _getActions() in initState.
if (_actions.isEmpty) {
if (_actions.isEmpty || _reloadActions) {
_getActions();
_reloadActions = false;
}
final isTrashedFile = widget.file is TrashFile;
@@ -372,6 +374,7 @@ class FileAppBarState extends State<FileAppBar> {
_onToggleVideoLoop() {
Configuration.instance.setShouldLoopVideo(!shouldLoopVideo);
setState(() {
_reloadActions = true;
shouldLoopVideo = !shouldLoopVideo;
});
}