buildPopupMenuLayout method

LayoutBuilder buildPopupMenuLayout(
  1. Offset offset
)

Implementation

LayoutBuilder buildPopupMenuLayout(Offset offset) {
  return LayoutBuilder(builder: (context, constraints) {
    return GestureDetector(
      behavior: HitTestBehavior.translucent,
      onTap: () {
        if (widget.dismissOnClickAway) {
          dismiss();
        }
      },
      onVerticalDragStart: (DragStartDetails details) {
        if (widget.dismissOnClickAway) {
          dismiss();
        }
      },
      onHorizontalDragStart: (DragStartDetails details) {
        if (widget.dismissOnClickAway) {
          dismiss();
        }
      },
      child: Stack(
        children: <Widget>[
          // triangle arrow
          Positioned(
            left: _showRect.left + _showRect.width / 2.0 - 7.5,
            top: _isDown
                ? offset.dy + menuHeight
                : offset.dy - PopupMenuControl.arrowHeight,
            child: CustomPaint(
              size: Size(15.0, PopupMenuControl.arrowHeight),
              painter: TrianglePainter(
                  isDown: _isDown,
                  color: widget.backgroundColor ??
                      Theme.of(context).colorScheme.background),
            ),
          ),
          // menu content
          Positioned(
            left: offset.dx,
            top: offset.dy,
            child: SizedBox(
              width: menuWidth,
              height: menuHeight,
              child: Column(
                children: <Widget>[
                  ClipRRect(
                    borderRadius: BorderRadius.circular(10.0),
                    child: Container(
                      width: menuWidth,
                      height: menuHeight,
                      decoration: BoxDecoration(
                        color: widget.backgroundColor ??
                            Theme.of(context).colorScheme.background,
                        borderRadius: BorderRadius.circular(10.0),
                      ),
                      child: Column(
                        children: _createRows(),
                      ),
                    ),
                  ),
                ],
              ),
            ),
          )
        ],
      ),
    );
  });
}