Skip to content

Commit

Permalink
Added auto hide functionality for header and footer
Browse files Browse the repository at this point in the history
  • Loading branch information
Decoder07 committed Jan 13, 2024
1 parent a63e3eb commit 19b1de7
Show file tree
Hide file tree
Showing 3 changed files with 439 additions and 392 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,36 @@
///Dart imports
import 'dart:async';

///Package imports
import 'package:flutter/widgets.dart';

class MeetingNavigationVisibilityController extends ChangeNotifier {
bool showControls = true;

///This variable stores whether the timer is active or not
///
///This is done to avoid multiple timers running at the same time
bool _isTimerActive = false;

///This method toggles the visibility of the buttons
void toggleControlsVisibility() {
showControls = !showControls;

///If the controls are now visible and
///If the timer is not active, we start the timer
if (showControls && !_isTimerActive) {
startTimerToHideButtons();
}
notifyListeners();
}

///This method starts a timer for 5 seconds and then hides the buttons
void startTimerToHideButtons() {
_isTimerActive = true;
Timer(const Duration(seconds: 5), () {
showControls = false;
_isTimerActive = false;
notifyListeners();
});
}
}
Loading

0 comments on commit 19b1de7

Please sign in to comment.