fromMap static method

MonaStyleAttributesEntity? fromMap(
  1. Object? o, {
  2. Map<String, String>? newDocumentIds,
})

Implementation

static MonaStyleAttributesEntity? fromMap(Object? o,
    {Map<String, String>? newDocumentIds}) {
  if (o == null) return null;
  var map = o as Map<String, dynamic>;

  var formBackgroundFromMap = map['formBackground'];
  if (formBackgroundFromMap != null) {
    formBackgroundFromMap = BackgroundEntity.fromMap(formBackgroundFromMap,
        newDocumentIds: newDocumentIds);
  }
  var appBackgroundFromMap = map['appBackground'];
  if (appBackgroundFromMap != null) {
    appBackgroundFromMap = BackgroundEntity.fromMap(appBackgroundFromMap,
        newDocumentIds: newDocumentIds);
  }
  var formGroupTitleColorFromMap = map['formGroupTitleColor'];
  if (formGroupTitleColorFromMap != null) {
    formGroupTitleColorFromMap = RgbEntity.fromMap(formGroupTitleColorFromMap,
        newDocumentIds: newDocumentIds);
  }
  var formFieldTextColorFromMap = map['formFieldTextColor'];
  if (formFieldTextColorFromMap != null) {
    formFieldTextColorFromMap = RgbEntity.fromMap(formFieldTextColorFromMap,
        newDocumentIds: newDocumentIds);
  }
  var formFieldHeaderColorFromMap = map['formFieldHeaderColor'];
  if (formFieldHeaderColorFromMap != null) {
    formFieldHeaderColorFromMap = RgbEntity.fromMap(
        formFieldHeaderColorFromMap,
        newDocumentIds: newDocumentIds);
  }
  var formFieldFocusColorFromMap = map['formFieldFocusColor'];
  if (formFieldFocusColorFromMap != null) {
    formFieldFocusColorFromMap = RgbEntity.fromMap(formFieldFocusColorFromMap,
        newDocumentIds: newDocumentIds);
  }
  var listBackgroundFromMap = map['listBackground'];
  if (listBackgroundFromMap != null) {
    listBackgroundFromMap = BackgroundEntity.fromMap(listBackgroundFromMap,
        newDocumentIds: newDocumentIds);
  }
  var listTextItemColorFromMap = map['listTextItemColor'];
  if (listTextItemColorFromMap != null) {
    listTextItemColorFromMap = RgbEntity.fromMap(listTextItemColorFromMap,
        newDocumentIds: newDocumentIds);
  }
  var floatingButtonForegroundColorFromMap =
      map['floatingButtonForegroundColor'];
  if (floatingButtonForegroundColorFromMap != null) {
    floatingButtonForegroundColorFromMap = RgbEntity.fromMap(
        floatingButtonForegroundColorFromMap,
        newDocumentIds: newDocumentIds);
  }
  var floatingButtonBackgroundColorFromMap =
      map['floatingButtonBackgroundColor'];
  if (floatingButtonBackgroundColorFromMap != null) {
    floatingButtonBackgroundColorFromMap = RgbEntity.fromMap(
        floatingButtonBackgroundColorFromMap,
        newDocumentIds: newDocumentIds);
  }
  var dividerColorFromMap = map['dividerColor'];
  if (dividerColorFromMap != null) {
    dividerColorFromMap = RgbEntity.fromMap(dividerColorFromMap,
        newDocumentIds: newDocumentIds);
  }
  var topicContainerBackgroundFromMap = map['topicContainerBackground'];
  if (topicContainerBackgroundFromMap != null) {
    topicContainerBackgroundFromMap = BackgroundEntity.fromMap(
        topicContainerBackgroundFromMap,
        newDocumentIds: newDocumentIds);
  }
  var actionContainerBackgroundFromMap = map['actionContainerBackground'];
  if (actionContainerBackgroundFromMap != null) {
    actionContainerBackgroundFromMap = BackgroundEntity.fromMap(
        actionContainerBackgroundFromMap,
        newDocumentIds: newDocumentIds);
  }
  var appBarBGFromMap = map['appBarBG'];
  if (appBarBGFromMap != null) {
    appBarBGFromMap = BackgroundEntity.fromMap(appBarBGFromMap,
        newDocumentIds: newDocumentIds);
  }
  var appBarIconColorFromMap = map['appBarIconColor'];
  if (appBarIconColorFromMap != null) {
    appBarIconColorFromMap = RgbEntity.fromMap(appBarIconColorFromMap,
        newDocumentIds: newDocumentIds);
  }
  var appBarSelectedIconColorFromMap = map['appBarSelectedIconColor'];
  if (appBarSelectedIconColorFromMap != null) {
    appBarSelectedIconColorFromMap = RgbEntity.fromMap(
        appBarSelectedIconColorFromMap,
        newDocumentIds: newDocumentIds);
  }
  var appBarMenuBackgroundColorFromMap = map['appBarMenuBackgroundColor'];
  if (appBarMenuBackgroundColorFromMap != null) {
    appBarMenuBackgroundColorFromMap = RgbEntity.fromMap(
        appBarMenuBackgroundColorFromMap,
        newDocumentIds: newDocumentIds);
  }
  var bottomNavigationBarBGFromMap = map['bottomNavigationBarBG'];
  if (bottomNavigationBarBGFromMap != null) {
    bottomNavigationBarBGFromMap = BackgroundEntity.fromMap(
        bottomNavigationBarBGFromMap,
        newDocumentIds: newDocumentIds);
  }
  var drawerBGFromMap = map['drawerBG'];
  if (drawerBGFromMap != null) {
    drawerBGFromMap = BackgroundEntity.fromMap(drawerBGFromMap,
        newDocumentIds: newDocumentIds);
  }
  var drawerHeaderBGFromMap = map['drawerHeaderBG'];
  if (drawerHeaderBGFromMap != null) {
    drawerHeaderBGFromMap = BackgroundEntity.fromMap(drawerHeaderBGFromMap,
        newDocumentIds: newDocumentIds);
  }
  var profileDrawerBGFromMap = map['profileDrawerBG'];
  if (profileDrawerBGFromMap != null) {
    profileDrawerBGFromMap = BackgroundEntity.fromMap(profileDrawerBGFromMap,
        newDocumentIds: newDocumentIds);
  }
  var profileDrawerHeaderBGFromMap = map['profileDrawerHeaderBG'];
  if (profileDrawerHeaderBGFromMap != null) {
    profileDrawerHeaderBGFromMap = BackgroundEntity.fromMap(
        profileDrawerHeaderBGFromMap,
        newDocumentIds: newDocumentIds);
  }
  var backgroundColorHomeMenuFromMap = map['backgroundColorHomeMenu'];
  if (backgroundColorHomeMenuFromMap != null) {
    backgroundColorHomeMenuFromMap = RgbEntity.fromMap(
        backgroundColorHomeMenuFromMap,
        newDocumentIds: newDocumentIds);
  }
  var h1FromMap = map['h1'];
  if (h1FromMap != null) {
    h1FromMap = FontEntity.fromMap(h1FromMap, newDocumentIds: newDocumentIds);
  }
  var h2FromMap = map['h2'];
  if (h2FromMap != null) {
    h2FromMap = FontEntity.fromMap(h2FromMap, newDocumentIds: newDocumentIds);
  }
  var h3FromMap = map['h3'];
  if (h3FromMap != null) {
    h3FromMap = FontEntity.fromMap(h3FromMap, newDocumentIds: newDocumentIds);
  }
  var h4FromMap = map['h4'];
  if (h4FromMap != null) {
    h4FromMap = FontEntity.fromMap(h4FromMap, newDocumentIds: newDocumentIds);
  }
  var h5FromMap = map['h5'];
  if (h5FromMap != null) {
    h5FromMap = FontEntity.fromMap(h5FromMap, newDocumentIds: newDocumentIds);
  }
  var textFieldHeaderFromMap = map['textFieldHeader'];
  if (textFieldHeaderFromMap != null) {
    textFieldHeaderFromMap = FontEntity.fromMap(textFieldHeaderFromMap,
        newDocumentIds: newDocumentIds);
  }
  var fontTextFromMap = map['fontText'];
  if (fontTextFromMap != null) {
    fontTextFromMap =
        FontEntity.fromMap(fontTextFromMap, newDocumentIds: newDocumentIds);
  }
  var fontSmallTextFromMap = map['fontSmallText'];
  if (fontSmallTextFromMap != null) {
    fontSmallTextFromMap = FontEntity.fromMap(fontSmallTextFromMap,
        newDocumentIds: newDocumentIds);
  }
  var fontHighlight1FromMap = map['fontHighlight1'];
  if (fontHighlight1FromMap != null) {
    fontHighlight1FromMap = FontEntity.fromMap(fontHighlight1FromMap,
        newDocumentIds: newDocumentIds);
  }
  var fontHighlight2FromMap = map['fontHighlight2'];
  if (fontHighlight2FromMap != null) {
    fontHighlight2FromMap = FontEntity.fromMap(fontHighlight2FromMap,
        newDocumentIds: newDocumentIds);
  }
  var fontLinkFromMap = map['fontLink'];
  if (fontLinkFromMap != null) {
    fontLinkFromMap =
        FontEntity.fromMap(fontLinkFromMap, newDocumentIds: newDocumentIds);
  }
  var dialogBackgroundColorFromMap = map['dialogBackgroundColor'];
  if (dialogBackgroundColorFromMap != null) {
    dialogBackgroundColorFromMap = RgbEntity.fromMap(
        dialogBackgroundColorFromMap,
        newDocumentIds: newDocumentIds);
  }
  var dialogSeperatorColorFromMap = map['dialogSeperatorColor'];
  if (dialogSeperatorColorFromMap != null) {
    dialogSeperatorColorFromMap = RgbEntity.fromMap(
        dialogSeperatorColorFromMap,
        newDocumentIds: newDocumentIds);
  }
  var popupMenuButtonColorFromMap = map['popupMenuButtonColor'];
  if (popupMenuButtonColorFromMap != null) {
    popupMenuButtonColorFromMap = RgbEntity.fromMap(
        popupMenuButtonColorFromMap,
        newDocumentIds: newDocumentIds);
  }
  var textBubbleBackgroundColorFromMap = map['textBubbleBackgroundColor'];
  if (textBubbleBackgroundColorFromMap != null) {
    textBubbleBackgroundColorFromMap = RgbEntity.fromMap(
        textBubbleBackgroundColorFromMap,
        newDocumentIds: newDocumentIds);
  }
  var dropdownButtonnColorFromMap = map['dropdownButtonnColor'];
  if (dropdownButtonnColorFromMap != null) {
    dropdownButtonnColorFromMap = RgbEntity.fromMap(
        dropdownButtonnColorFromMap,
        newDocumentIds: newDocumentIds);
  }
  var listTileColorFromMap = map['listTileColor'];
  if (listTileColorFromMap != null) {
    listTileColorFromMap = RgbEntity.fromMap(listTileColorFromMap,
        newDocumentIds: newDocumentIds);
  }

  return MonaStyleAttributesEntity(
    appId: map['appId'],
    formBackground: formBackgroundFromMap,
    appBackground: appBackgroundFromMap,
    formGroupTitleColor: formGroupTitleColorFromMap,
    formFieldTextColor: formFieldTextColorFromMap,
    formFieldHeaderColor: formFieldHeaderColorFromMap,
    formFieldFocusColor: formFieldFocusColorFromMap,
    listBackground: listBackgroundFromMap,
    listTextItemColor: listTextItemColorFromMap,
    floatingButtonForegroundColor: floatingButtonForegroundColorFromMap,
    floatingButtonBackgroundColor: floatingButtonBackgroundColorFromMap,
    dividerColor: dividerColorFromMap,
    topicContainerBackground: topicContainerBackgroundFromMap,
    actionContainerBackground: actionContainerBackgroundFromMap,
    appBarBG: appBarBGFromMap,
    appBarIconColor: appBarIconColorFromMap,
    appBarSelectedIconColor: appBarSelectedIconColorFromMap,
    appBarMenuBackgroundColor: appBarMenuBackgroundColorFromMap,
    bottomNavigationBarBG: bottomNavigationBarBGFromMap,
    drawerBG: drawerBGFromMap,
    drawerHeaderBG: drawerHeaderBGFromMap,
    profileDrawerBG: profileDrawerBGFromMap,
    profileDrawerHeaderBG: profileDrawerHeaderBGFromMap,
    backgroundColorHomeMenu: backgroundColorHomeMenuFromMap,
    h1: h1FromMap,
    h2: h2FromMap,
    h3: h3FromMap,
    h4: h4FromMap,
    h5: h5FromMap,
    textFieldHeader: textFieldHeaderFromMap,
    fontText: fontTextFromMap,
    fontSmallText: fontSmallTextFromMap,
    fontHighlight1: fontHighlight1FromMap,
    fontHighlight2: fontHighlight2FromMap,
    fontLink: fontLinkFromMap,
    routeBuilder: map['routeBuilder'],
    routeAnimationDuration:
        int.tryParse(map['routeAnimationDuration'].toString()),
    dialogBackgroundColor: dialogBackgroundColorFromMap,
    dialogSeperatorColor: dialogSeperatorColorFromMap,
    popupMenuButtonColor: popupMenuButtonColorFromMap,
    textBubbleBackgroundColor: textBubbleBackgroundColorFromMap,
    dropdownButtonnColor: dropdownButtonnColorFromMap,
    listTileColor: listTileColorFromMap,
  );
}