getBody method
Implementation
Widget getBody(BoxBorder border) {
bool hasImage = false;
if (widget.node.getImage().isNotEmpty) {
hasImage = isValidBase64Image(widget.node.getImage());
}
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);
},
),
)
: (hasImage
? (widget.node.getImagePosition() ==
MindMapNodeImagePosition.left
? (Row(
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(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(),
))),
);
}