handleKeyEvent method

bool handleKeyEvent(
  1. KeyEvent event
)

Implementation

bool handleKeyEvent(KeyEvent event) {
  if (event is KeyDownEvent &&
      (event.logicalKey == LogicalKeyboardKey.arrowRight)) {
    if (isRotationedit.value) return true;

    if (currentIndex.value >= rxmedia.value!.length - 1) return true;
    if (videoWidget != null) {
      videoWidget!.dispose();
      videoWidget == null;
    }
    if (currentIndex.value < media.length - 1) {
      currentIndex.value++;
      pageController.animateToPage(
        currentIndex.value,
        duration: Duration(milliseconds: 300),
        curve: Curves.easeInOut,
      );
      log.log("sağa geçildi: ${currentIndex.value}");
    }
    return true;
  }
  if (event is KeyDownEvent &&
      (event.logicalKey == LogicalKeyboardKey.arrowLeft)) {
    if (isRotationedit.value) return true;

    if (0 > currentIndex.value - 1) return true;
    if (videoWidget != null) {
      videoWidget!.dispose();
      videoWidget == null;
    }
    if (currentIndex.value > 0) {
      currentIndex.value--;
      pageController.animateToPage(
        currentIndex.value,
        duration: Duration(milliseconds: 300),
        curve: Curves.easeInOut,
      );
      log.log("sola geçildi: ${currentIndex.value}");
    }

    return true;
  }

  return false;
}