toJson method
转换为 JSON
Implementation
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (type != null) {
json['type'] = type!.toString().split('.').last;
}
if (_isFloatingSpecified) {
json['isFloating'] = isFloating;
}
if (_isDraggableSpecified) {
json['isDraggable'] = isDraggable;
}
if (_dragSnapToEdgeSpecified) {
json['dragSnapToEdge'] = dragSnapToEdge;
}
if (_hasAnimationSpecified) {
json['hasAnimation'] = hasAnimation;
}
if (_isCollapsibleSpecified) {
json['isCollapsible'] = isCollapsible;
}
if (_initiallyExpandedSpecified) {
json['initiallyExpanded'] = initiallyExpanded;
}
if (_animationDurationSpecified) {
json['animationDuration'] = animationDuration.inMilliseconds;
}
if (animationType != null) {
json['animationType'] = animationType!.toString().split('.').last;
}
if (width != null) {
json['width'] = width;
}
if (height != null) {
json['height'] = height;
}
if (top != null) {
json['top'] = top;
}
if (left != null) {
json['left'] = left;
}
if (bottom != null) {
json['bottom'] = bottom;
}
if (right != null) {
json['right'] = right;
}
if (margin != null) {
json['margin'] = {
'left': margin!.left,
'top': margin!.top,
'right': margin!.right,
'bottom': margin!.bottom,
};
}
if (padding != null) {
json['padding'] = {
'left': padding!.left,
'top': padding!.top,
'right': padding!.right,
'bottom': padding!.bottom,
};
}
if (customProps != null) {
json['customProps'] = customProps;
}
if (backgroundColor != null) {
json['backgroundColor'] = backgroundColor!.toARGB32();
}
if (_showToggleButtonSpecified) {
json['showToggleButton'] = showToggleButton;
}
if (_isShowSpecified) {
json['isShow'] = isShow;
}
return json;
}