showMenu method

dynamic showMenu(
  1. BuildContext context
)

Shows the selection menu

Implementation

showMenu(BuildContext context) async {
  // final size = MediaQuery.of(context).size;
  final width = this.width ?? context.size?.width;

  // final PopupMenuThemeData popupMenuTheme = PopupMenuTheme.of(context);
  final RenderBox buttonRenderBox = context.findRenderObject()! as RenderBox;
  final RenderBox overlay =
      Navigator.of(context).overlay!.context.findRenderObject()! as RenderBox;
  final Offset offset;
  offset = const Offset(0.0, -.5);

  final RelativeRect position = RelativeRect.fromRect(
    Rect.fromPoints(
      buttonRenderBox.localToGlobal(offset, ancestor: overlay),
      buttonRenderBox.localToGlobal(
          buttonRenderBox.size.bottomRight(Offset.zero) + offset,
          ancestor: overlay),
    ),
    Offset.zero & overlay.size,
  );
  await Navigator.of(context).push(_SelectingButtonRouter(
    position: RelativeRect.fromLTRB(
        position.left,
        position.top + (this.offset?.dy ?? 0) + (overlay.size.height * 0.056),
        position.right,
        position.bottom),
    elevation: 0,
    barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
    // shape: popupMenuTheme.shape,
    // color: popupMenuTheme.color,
    capturedThemes: InheritedTheme.capture(
        from: context, to: Navigator.of(context).context),
    child: LayoutBuilder(builder: (context, cnt) {
      return DecoratedBox(
        decoration: decoration,
        child: Material(
          color: Colors.transparent,
          child: _BoxPage<T>(
            fullLoadingWidgetPlaceHolder: fullLoadingWidgetPlaceHolder,
            loadMoreWidgetPlaceHolder: loadMoreWidgetPlaceHolder,
            isLoadingMore: isLoadingMore,
            width: width,
            height: height,
            searchBar: searchBar,
            itemBuilder: itemBuilder,
            onSelect: onSelect,
            listNotifier: listNotifier,
            isLoadingAll: isLoadingAll,
            selectedValue: selectedValue,
          ),
        ),
      );
    }),
  ));
}