Implementation
Map<String, dynamic> get dictionary {
final entries = {
"alignment": alignmentState?.toJson(StyleParser.alignmentToJson),
"backgroundColor": backgroundColorState?.toJson(StyleParser.colorToHex),
"blendMode": blendModeState?.toJson(StyleParser.enumToJson),
"blur": blurState?.toJson((e) => e),
"border": borderState?.toJson(StyleParser.borderToJson),
"borderRadius": borderRadiusState?.toJson(StyleParser.borderRadiusToJson),
"boxShadow": boxShadowState?.toJson(StyleParser.boxShadowToJson),
"center": centerState?.toJson((e) => e),
"color": colorState?.toJson(StyleParser.colorToHex),
"constraints": constraintsState?.toJson(StyleParser.boxConstraintsToJson),
"contentAlignment":
contentAlignmentState?.toJson(StyleParser.alignmentToJson),
"duration": durationState?.toJson((e) => e),
"expanded": expandedState?.toJson((e) => e),
"fitted": fittedState?.toJson((e) => e),
"flex": flexState?.toJson((e) => e),
"foregroundColor": foregroundColorState?.toJson(StyleParser.colorToHex),
"foregroundGradient":
foregroundGradientState?.toJson(StyleParser.gradientToJson),
"gradient": gradientState?.toJson(StyleParser.gradientToJson),
"height": heightState?.toJson(StyleParser.safeEncodableDouble),
"heightPercentage": heightPercentageState?.toJson((e) => e),
"image": imageState?.toJson((e) => e),
"imageOpacity": imageOpacityState?.toJson((e) => e),
"imageScale": imageScaleState?.toJson((e) => e),
"layout": layoutState?.toJson(StyleParser.enumToJson),
"layoutAlignment":
layoutAlignmentState?.toJson(StyleParser.alignmentToJson),
"layoutClipBehavior":
layoutClipBehaviorState?.toJson(StyleParser.enumToJson),
"layoutCrossAxisAlignment":
layoutCrossAxisAlignmentState?.toJson(StyleParser.enumToJson),
"layoutDirection": layoutDirectionState?.toJson(StyleParser.enumToJson),
"layoutMainAxisAlignment":
layoutMainAxisAlignmentState?.toJson(StyleParser.enumToJson),
"layoutMainAxisSize":
layoutMainAxisSizeState?.toJson(StyleParser.enumToJson),
"layoutRunSpacing": layoutRunSpacingState?.toJson((e) => e),
"layoutSpacing": layoutSpacingState?.toJson((e) => e),
"layoutStackFit": layoutStackFitState?.toJson(StyleParser.enumToJson),
"layoutTextBaseline":
layoutTextBaselineState?.toJson(StyleParser.enumToJson),
"layoutVerticalDirection":
layoutVerticalDirectionState?.toJson(StyleParser.enumToJson),
"layoutWrapAlignment":
layoutWrapAlignmentState?.toJson(StyleParser.enumToJson),
"layoutWrapRunAlignment":
layoutWrapRunAlignmentState?.toJson(StyleParser.enumToJson),
"layoutWrapCrossAlignment":
layoutWrapCrossAlignmentState?.toJson(StyleParser.enumToJson),
"margin": marginState?.toJson(StyleParser.edgeInsetsToJson),
"maxLines": maxLinesState?.toJson((e) => e),
"opacity": opacityState?.toJson((e) => e),
"overflow": overflowState?.toJson((e) => e),
"padding": paddingState?.toJson(StyleParser.edgeInsetsToJson),
"position": positionState?.toJson((e) => e?.dictionary),
"scale": scaleState?.toJson((e) => e),
"size": sizeState?.toJson((e) => e),
"textAlign": textAlignState?.toJson(StyleParser.enumToJson),
"textStyle": textStyleState?.toJson(StyleParser.textStyleToJson),
"width": widthState?.toJson(StyleParser.safeEncodableDouble),
"widthPercentage": widthPercentageState?.toJson((e) => e),
}.entries.where((e) => e.value != null);
return Map.fromEntries(entries);
}