closeDrawer method

dynamic closeDrawer(
  1. Drawers? drawer, {
  2. dynamic cb,
})

Implementation

closeDrawer(Drawers? drawer, {cb}) {

  double height = widget.model.constraints.maxHeight ?? 0;
  double width = widget.model.constraints.maxWidth ?? 0;


  if (drawer == Drawers.top) {
    afterAnimation = cb;
    setState(() {
      animate = true;
      animatingClose = true;
      fromBottom = height;
    });
  } else if (drawer == Drawers.bottom) {
    afterAnimation = cb;
    setState(() {
      animate = true;
      animatingClose = true;
      fromTop = height;
    });
  } else if (drawer == Drawers.left) {
    afterAnimation = cb;
    setState(() {
      animate = true;
      animatingClose = true;
      fromRight = width;
    });
  } else if (drawer == Drawers.right) {
    afterAnimation = cb;
    setState(() {
      animate = true;
      animatingClose = true;
      fromLeft = width;
    });
  }
}