onHalf method

void onHalf(
  1. bool left
)

Implementation

void onHalf(bool left) {
  showHalf = false;
  timer?.cancel();
  timer = Timer(const Duration(seconds: 2), () {
    if (!mounted) return;
    if (left) {
      xPosition = -(widget.width ?? 0) / 2;
    } else {
      xPosition = ScreenUtil().screenWidth - (widget.width ?? 0) / 2;
    }
    showHalf = true;
    setState(() {});
  });
}