toggleVisible function

void toggleVisible({
  1. int autoHideButtonTime = 5,
  2. required AgoraSettings value,
})

Function to auto hide the button class.

Implementation

void toggleVisible({
  int autoHideButtonTime = 5,
  required AgoraSettings value,
}) async {
  if (!(value.visible)) {
    value = value.copyWith(visible: !(value.visible));
    timer = Timer(Duration(seconds: autoHideButtonTime), () {
      if (!(value.visible)) return;
      value = value.copyWith(visible: !(value.visible));
    });
  } else {
    timer?.cancel();
    value = value.copyWith(visible: !(value.visible));
  }
}