deserializeSingleColumnLayoutMetadata method

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

Implementation

Map<String, dynamic> deserializeSingleColumnLayoutMetadata(
    Map<String, dynamic> map) {
  List<dynamic>? paddingInfo = map["padding"];
  EdgeInsetsGeometry padding = EdgeInsets.zero;
  if (paddingInfo != null) {
    if (paddingInfo[0] == -1) {
      padding = EdgeInsets.only(
          left: double.tryParse(paddingInfo[1].toString()) ?? 0,
          top: double.tryParse(paddingInfo[2].toString()) ?? 0,
          right: double.tryParse(paddingInfo[3].toString()) ?? 0,
          bottom: double.tryParse(paddingInfo[4].toString()) ?? 0);
    } else {
      padding = EdgeInsetsDirectional.only(
          start: double.tryParse(paddingInfo[1].toString()) ?? 0,
          top: double.tryParse(paddingInfo[2].toString()) ?? 0,
          end: double.tryParse(paddingInfo[3].toString()) ?? 0,
          bottom: double.tryParse(paddingInfo[4].toString()) ?? 0);
    }
  }
  return {"width": double.tryParse(map["width"]), "padding": padding};
}