closeDrawer method

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

Implementation

closeDrawer(String? drawer, {cb}) {
  var constraints = widget.model.constraints;
  double h = constraints.maxHeight?? MediaQuery.of(context).size.height;
  double w = constraints.maxWidth ?? MediaQuery.of(context).size.width;
  var screenHeight = h;
  var screenWidth = w;
  if (drawer == 'top') {
    afterAnimation = cb;
    setState(() {
      animate = true;
      animatingClose = true;
      fromBottom = screenHeight;
    });
  }
  else if (drawer == 'bottom') {
    afterAnimation = cb;
    setState(() {
      animate = true;
      animatingClose = true;
      fromTop = screenHeight;
    });
  }
  else if (drawer == 'left') {
    afterAnimation = cb;
    setState(() {
      animate = true;
      animatingClose = true;
      fromRight = screenWidth;
    });
  }
  else if (drawer == 'right') {
    afterAnimation = cb;
    setState(() {
      animate = true;
      animatingClose = true;
      fromLeft = screenWidth;
    });
  }
}