getModalBackgroundColor method

Color getModalBackgroundColor(
  1. SlideBarModalBackgroundColor modalBackgroundColor
)

Get modal background color

Implementation

Color getModalBackgroundColor(
    SlideBarModalBackgroundColor modalBackgroundColor) {
  double menuOffsetPercent =
      getIsMenuModalOpened() ? getMenuOpenPercent() : 0;
  double subMenuOffsetPercent =
      getIsSubMenuModalOpened() ? getSubMenuOpenPercent() : 0;
  double offsetPercent = max<double>(menuOffsetPercent, subMenuOffsetPercent);

  switch (modalBackgroundColor) {
    case SlideBarModalBackgroundColor.black:
      return Colors.black
          .withOpacity(widget.modalBackgroundOpacity * offsetPercent);
    case SlideBarModalBackgroundColor.white:
      return Colors.white
          .withOpacity(widget.modalBackgroundOpacity * offsetPercent);
    case SlideBarModalBackgroundColor.transparent:
    default:
      return Colors.transparent;
  }
}