export method
export the runtime widget to json
Implementation
@override
Map<String, dynamic>? export(Widget? widget, BuildContext? buildContext) {
var realWidget = widget as ElevatedButton;
var color = realWidget.style?.foregroundColor != null
? realWidget.style?.foregroundColor
?.resolve(MaterialState.values.toSet())
: null;
var backgroundColor = realWidget.style?.backgroundColor != null
? realWidget.style?.backgroundColor
?.resolve(MaterialState.values.toSet())
: null;
var overlayColor = realWidget.style?.overlayColor != null
? realWidget.style?.overlayColor?.resolve(MaterialState.values.toSet())
: null;
var shadowColor = realWidget.style?.shadowColor != null
? realWidget.style?.shadowColor?.resolve(MaterialState.values.toSet())
: null;
var elevation = realWidget.style?.elevation != null
? realWidget.style?.elevation?.resolve(MaterialState.values.toSet())
: null;
var edgeInsetsGeometry = realWidget.style?.padding != null
? realWidget.style?.padding?.resolve(MaterialState.values.toSet())
as EdgeInsets?
: null;
var textStyle2 = realWidget.style?.textStyle != null
? realWidget.style?.textStyle?.resolve(MaterialState.values.toSet())
: null;
return <String, dynamic>{
"type": widgetName,
"foregroundColor": color != null ? color.value.toRadixString(16) : null,
"backgroundColor": backgroundColor != null
? backgroundColor.value.toRadixString(16)
: null,
"overlayColor":
overlayColor != null ? overlayColor.value.toRadixString(16) : null,
"shadowColor":
shadowColor != null ? shadowColor.value.toRadixString(16) : null,
"elevation": elevation,
"padding": edgeInsetsGeometry != null
? "${edgeInsetsGeometry.left},${edgeInsetsGeometry.top},${edgeInsetsGeometry.right},${edgeInsetsGeometry.bottom}"
: null,
"textStyle": exportTextStyle(textStyle2),
"child": DynamicWidgetBuilder.export(realWidget.child, buildContext)
};
}