show method

void show()

Implementation

void show() async {
  assert(context != null, "Context must not be null");
  await showDialog(
  context: context!,
  anchorPoint: offset,
  builder: (ctx) {
    _localContext = ctx;
    return AlertDialog(
      alignment: alignment ?? Alignment.center,
      key: UniqueKey(),
      clipBehavior: Clip.antiAliasWithSaveLayer,
      contentPadding: padding,
      titlePadding: EdgeInsets.zero,
      title: (showClose)
          ? Flex(
        direction: Axis.horizontal,
        mainAxisAlignment: MainAxisAlignment.end,
        crossAxisAlignment: CrossAxisAlignment.end,
        children: [
          IconButton(
              onPressed: () {
                onClose?.call();
                ctx.closeDialog;
              },
              icon: Icon(
                Icons.close_rounded,
                color: Theme.of(ctx).cardColor,
              ))
        ],
      )
          : null,
      elevation: elevation,
      backgroundColor: backgroundColor,
      content: (enableKeyListener) ? RawKeyboardListener(
        key: UniqueKey(),
        focusNode: FocusNode(),
        autofocus: true,
        onKey: (val) {
          if (val.isKeyPressed(LogicalKeyboardKey.escape)) {
            close();
          }
        },
        child: child,
      ) : child,
    );
  },
  barrierDismissible: (barrierDismissible),
  useSafeArea: true);
}