-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added auto hide functionality for header and footer
- Loading branch information
Showing
3 changed files
with
439 additions
and
392 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
packages/hms_room_kit/lib/src/meeting/meeting_navigation_visibility_controller.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
} | ||
} |
Oops, something went wrong.