export method
export the runtime widget to json
Implementation
@override
Map<String, dynamic>? export(Widget? widget, BuildContext? buildContext) {
if (widget != null && widget is Card) {
final EdgeInsets? margin = widget.margin as EdgeInsets?;
final String? color =
widget.color != null ? widget.color!.value.toRadixString(16) : null;
final String? shadowColor = widget.shadowColor != null
? widget.shadowColor!.value.toRadixString(16)
: null;
final double? elevation = widget.elevation;
final bool borderOnForeground = widget.borderOnForeground;
final String? clipBehavior = widget.clipBehavior != null
? exportClipBehavior(widget.clipBehavior!)
: null;
final String? strMargin = margin != null
? "${margin.left},${margin.top},${margin.right},${margin.bottom},"
: null;
final bool semanticContainer = widget.semanticContainer;
final Map<String, dynamic>? childMap =
DynamicWidgetBuilder.export(widget.child, buildContext);
final Map<String, dynamic>? shape;
if (widget.shape != null && widget.shape is RoundedRectangleBorder) {
shape = RoundedRectangleBorderParser.export(
widget.shape as RoundedRectangleBorder);
} else
shape = null;
final Map<String, dynamic> map = {
"type": widgetName,
};
if (color != null) map['color'] = color;
if (shadowColor != null) map['shadowColor'] = shadowColor;
if (elevation != null) map['elevation'] = elevation.toDouble();
map['borderOnForeground'] = borderOnForeground;
if (clipBehavior != null) map['clipBehavior'] = clipBehavior;
if (strMargin != null) map['margin'] = strMargin;
map['semanticContainer'] = semanticContainer;
if (childMap != null) map['child'] = childMap;
if (shape != null) map['shape'] = shape;
return map;
}
return null;
}