getBody method

Widget getBody(
  1. BoxBorder border
)

Implementation

Widget getBody(BoxBorder border) {
  return FutureBuilder(
    future: loadImage(),
    builder: (context, snapshot) {
      return Container(
        padding: widget.node.getPadding(),
        decoration: BoxDecoration(
          color: widget.node.getBackgroundColor(),
          border: border,
          borderRadius: widget.node.getBorderRadius(),
          boxShadow: widget.node.getShadow(),
          gradient: widget.node.getGradient(),
        ),
        constraints: BoxConstraints(minWidth: 30),
        child:
            widget.node.getChild() ??
            (!(widget.node.getMindMap()?.getReadOnly() ?? true) &&
                    (widget.node.getMindMap()?.hasTextField() ?? false) &&
                    widget.node.getSelected() &&
                    !(widget.node.getMindMap()?.getIsScaling() ?? false)
                ? Container(
                    constraints: BoxConstraints(
                      maxWidth: widget.node.getSize() != null
                          ? ((widget.node.getSize()!.width -
                                        (widget.node.getPadding() == null
                                            ? 0
                                            : (widget.node
                                                      .getPadding()!
                                                      .left +
                                                  widget.node
                                                      .getPadding()!
                                                      .right))) <
                                    30
                                ? 30
                                : widget.node.getSize()!.width -
                                      (widget.node.getPadding() == null
                                          ? 0
                                          : (widget.node.getPadding()!.left +
                                                widget.node
                                                    .getPadding()!
                                                    .right)))
                          : 100,
                    ),
                    child: TextField(
                      autofocus: true,
                      focusNode: widget.node._focusNode,
                      controller: _editingController,
                      style: widget.node.getTextStyle(),
                      scrollPadding: EdgeInsets.zero,
                      decoration: InputDecoration(
                        isCollapsed: true,
                        border: InputBorder.none,
                        contentPadding: EdgeInsets.zero,
                      ),
                      onChanged: (value) {
                        widget.node.setTitle(_editingController.text);
                      },
                    ),
                  )
                : (image != null
                      ? (widget.node.getImagePosition() ==
                                MindMapNodeImagePosition.left
                            ? (Row(
                                mainAxisAlignment: MainAxisAlignment.start,
                                crossAxisAlignment: CrossAxisAlignment.center,
                                children: [
                                  Image.memory(
                                    image!,
                                    width: widget.node.getImageWidth(),
                                    height: widget.node.getImageHeight(),
                                    fit: BoxFit.fill,
                                  ),
                                  SizedBox(
                                    width: widget.node.getImageSpace(),
                                  ),
                                  Text(
                                    widget.node.getTitle(),
                                    style: widget.node.getTextStyle(),
                                  ),
                                ],
                              ))
                            : (widget.node.getImagePosition() ==
                                      MindMapNodeImagePosition.right
                                  ? (Row(
                                      mainAxisAlignment:
                                          MainAxisAlignment.start,
                                      crossAxisAlignment:
                                          CrossAxisAlignment.center,
                                      children: [
                                        Text(
                                          widget.node.getTitle(),
                                          style: widget.node.getTextStyle(),
                                        ),
                                        SizedBox(
                                          width: widget.node.getImageSpace(),
                                        ),
                                        Image.memory(
                                          Base64Decoder().convert(
                                            widget.node.getImage(),
                                          ),
                                          width: widget.node.getImageWidth(),
                                          height: widget.node
                                              .getImageHeight(),
                                          fit: BoxFit.fill,
                                        ),
                                      ],
                                    ))
                                  : (widget.node.getImagePosition() ==
                                            MindMapNodeImagePosition.top
                                        ? (Column(
                                            mainAxisAlignment:
                                                MainAxisAlignment.start,
                                            crossAxisAlignment:
                                                CrossAxisAlignment.center,
                                            children: [
                                              Image.memory(
                                                Base64Decoder().convert(
                                                  widget.node.getImage(),
                                                ),
                                                width: widget.node
                                                    .getImageWidth(),
                                                height: widget.node
                                                    .getImageHeight(),
                                                fit: BoxFit.fill,
                                              ),
                                              SizedBox(
                                                height: widget.node
                                                    .getImageSpace(),
                                              ),
                                              Text(
                                                widget.node.getTitle(),
                                                style: widget.node
                                                    .getTextStyle(),
                                              ),
                                            ],
                                          ))
                                        : (Column(
                                            mainAxisAlignment:
                                                MainAxisAlignment.start,
                                            crossAxisAlignment:
                                                CrossAxisAlignment.center,
                                            children: [
                                              Text(
                                                widget.node.getTitle(),
                                                style: widget.node
                                                    .getTextStyle(),
                                              ),
                                              SizedBox(
                                                height: widget.node
                                                    .getImageSpace(),
                                              ),
                                              Image.memory(
                                                Base64Decoder().convert(
                                                  widget.node.getImage(),
                                                ),
                                                width: widget.node
                                                    .getImageWidth(),
                                                height: widget.node
                                                    .getImageHeight(),
                                                fit: BoxFit.fill,
                                              ),
                                            ],
                                          )))))
                      : Text(
                          widget.node.getTitle(),
                          style: widget.node.getTextStyle(),
                        ))),
      );
    },
  );
}