serializeSingleColumnLayoutMetadata method

Map<String, dynamic> serializeSingleColumnLayoutMetadata(
  1. Map<String, dynamic> map
)

{ "width":213, "padding":-1,0,0,0,0 //-1 is EdgeInsets type , -2 is EdgeInsetsDirectional type. }

Implementation

Map<String, dynamic> serializeSingleColumnLayoutMetadata(
    Map<String, dynamic> map) {
  var width = map["width"]?.toString();
  var padding = (map["padding"] ?? EdgeInsets.zero);
  List<dynamic>? paddingInfo;
  if (padding is EdgeInsets) {
    paddingInfo = [
      -1,
      padding.left,
      padding.top,
      padding.right,
      padding.bottom
    ];
  }
  if (padding is EdgeInsetsDirectional) {
    paddingInfo = [
      -2,
      padding.start,
      padding.top,
      padding.end,
      padding.bottom
    ];
  }
  return {"width": width, "padding": paddingInfo};
}