getPageFontFamily method

String getPageFontFamily(
  1. String name,
  2. SizeType type
)

Implementation

String getPageFontFamily(String name, SizeType type) {
  RixaPage? page = searchPage(name);
  if (page != null) {
    switch (type) {
      case SizeType.small:
        String? fontFamily;
        if (page.fonts != null) {
          fontFamily = page.fonts!.fontFamily_small ??
              (page.parent != null
                  ? _searchParentFontFamily(page.parent!, SizeType.small)
                  : null);
        }
        return fontFamily ?? Get.find<AppFonts>().defaultFontFamily;
      case SizeType.medium:
        String? fontFamily;
        if (page.fonts != null) {
          fontFamily = page.fonts!.fontFamily_medium ??
              (page.parent != null
                  ? _searchParentFontFamily(page.parent!, SizeType.medium)
                  : null);
        }
        return fontFamily ?? Get.find<AppFonts>().defaultFontFamily;
      case SizeType.large:
        String? fontFamily;
        if (page.fonts != null) {
          fontFamily = page.fonts!.fontFamily_large ??
              (page.parent != null
                  ? _searchParentFontFamily(page.parent!, SizeType.large)
                  : null);
        }
        return fontFamily ?? Get.find<AppFonts>().defaultFontFamily;
      case SizeType.mega:
        String? fontFamily;
        if (page.fonts != null) {
          fontFamily = page.fonts!.fontFamily_mega ??
              (page.parent != null
                  ? _searchParentFontFamily(page.parent!, SizeType.mega)
                  : null);
        }
        return fontFamily ?? Get.find<AppFonts>().defaultFontFamily;
    }
  }
  return Get.find<AppFonts>().defaultFontFamily;
}