toDocument method

  1. @override
Map<String, Object?> toDocument()
override

Implementation

@override
Map<String, Object?> toDocument() {
  final Map<String, dynamic>? shadowMap =
      shadow != null ? shadow!.toDocument() : null;
  final List<Map<String?, dynamic>>? decorationColorsListMap =
      decorationColors != null
          ? decorationColors!.map((item) => item.toDocument()).toList()
          : null;
  final Map<String, dynamic>? borderRadiusMap =
      borderRadius != null ? borderRadius!.toDocument() : null;
  final Map<String, dynamic>? paddingMap =
      padding != null ? padding!.toDocument() : null;
  final Map<String, dynamic>? marginMap =
      margin != null ? margin!.toDocument() : null;

  Map<String, Object?> theDocument = HashMap();
  if (backgroundImageId != null) {
    theDocument["backgroundImageId"] = backgroundImageId;
  } else {
    theDocument["backgroundImageId"] = null;
  }
  if (useProfilePhotoAsBackground != null) {
    theDocument["useProfilePhotoAsBackground"] = useProfilePhotoAsBackground;
  } else {
    theDocument["useProfilePhotoAsBackground"] = null;
  }
  if (beginGradientPosition != null) {
    theDocument["beginGradientPosition"] = beginGradientPosition;
  } else {
    theDocument["beginGradientPosition"] = null;
  }
  if (endGradientPosition != null) {
    theDocument["endGradientPosition"] = endGradientPosition;
  } else {
    theDocument["endGradientPosition"] = null;
  }
  if (shadow != null) {
    theDocument["shadow"] = shadowMap;
  } else {
    theDocument["shadow"] = null;
  }
  if (decorationColors != null) {
    theDocument["decorationColors"] = decorationColorsListMap;
  } else {
    theDocument["decorationColors"] = null;
  }
  if (borderRadius != null) {
    theDocument["borderRadius"] = borderRadiusMap;
  } else {
    theDocument["borderRadius"] = null;
  }
  if (border != null) {
    theDocument["border"] = border;
  } else {
    theDocument["border"] = null;
  }
  if (padding != null) {
    theDocument["padding"] = paddingMap;
  } else {
    theDocument["padding"] = null;
  }
  if (margin != null) {
    theDocument["margin"] = marginMap;
  } else {
    theDocument["margin"] = null;
  }
  return theDocument;
}