SfPdfViewerThemeData constructor

SfPdfViewerThemeData({
  1. Brightness? brightness,
  2. Color? backgroundColor,
  3. Color? progressBarColor,
  4. PdfScrollStatusStyle? scrollStatusStyle,
  5. PdfScrollHeadStyle? scrollHeadStyle,
  6. PdfBookmarkViewStyle? bookmarkViewStyle,
  7. PdfPaginationDialogStyle? paginationDialogStyle,
  8. PdfHyperlinkDialogStyle? hyperlinkDialogStyle,
  9. PdfPasswordDialogStyle? passwordDialogStyle,
})

Creating an argument constructor of SfPdfViewerThemeData class.

Implementation

factory SfPdfViewerThemeData(
    {Brightness? brightness,
    Color? backgroundColor,
    Color? progressBarColor,
    PdfScrollStatusStyle? scrollStatusStyle,
    PdfScrollHeadStyle? scrollHeadStyle,
    PdfBookmarkViewStyle? bookmarkViewStyle,
    PdfPaginationDialogStyle? paginationDialogStyle,
    PdfHyperlinkDialogStyle? hyperlinkDialogStyle,
    PdfPasswordDialogStyle? passwordDialogStyle}) {
  brightness = brightness ?? Brightness.light;
  final bool isLight = brightness == Brightness.light;
  backgroundColor ??=
      isLight ? const Color(0xFFD6D6D6) : const Color(0xFF303030);
  scrollHeadStyle ??= PdfScrollHeadStyle(
      backgroundColor:
          isLight ? const Color(0xFFFAFAFA) : const Color(0xFF424242),
      pageNumberTextStyle: TextStyle(
        fontSize: 12,
        color: isLight
            ? Colors.black.withOpacity(0.87)
            : Colors.white.withOpacity(0.87),
      ));
  bookmarkViewStyle ??= PdfBookmarkViewStyle(
    backgroundColor: isLight ? Colors.white : const Color(0xFF212121),
    headerTextStyle: TextStyle(
      fontSize: 16,
      fontFamily: 'Roboto',
      fontWeight: FontWeight.normal,
      color: isLight
          ? Colors.black.withOpacity(0.87)
          : Colors.white.withOpacity(0.87),
    ),
    closeIconColor: isLight
        ? Colors.black.withOpacity(0.54)
        : Colors.white.withOpacity(0.54),
    backIconColor: isLight
        ? Colors.black.withOpacity(0.54)
        : Colors.white.withOpacity(0.54),
    headerBarColor:
        isLight ? const Color(0xFFFAFAFA) : const Color(0xFF424242),
    navigationIconColor: isLight
        ? Colors.black.withOpacity(0.54)
        : Colors.white.withOpacity(0.54),
    selectionColor: isLight
        ? const Color.fromRGBO(0, 0, 0, 0.08)
        : const Color.fromRGBO(255, 255, 255, 0.12),
    titleSeparatorColor: isLight
        ? const Color.fromRGBO(0, 0, 0, 0.16)
        : const Color.fromRGBO(255, 255, 255, 0.16),
    titleTextStyle: TextStyle(
      fontSize: 14,
      color: isLight
          ? Colors.black.withOpacity(0.87)
          : Colors.white.withOpacity(0.87),
      fontFamily: 'Roboto',
      fontWeight: FontWeight.normal,
    ),
  );
  paginationDialogStyle ??= PdfPaginationDialogStyle(
    backgroundColor: isLight ? Colors.white : const Color(0xFF424242),
    headerTextStyle: TextStyle(
      fontFamily: 'Roboto',
      fontSize: 20,
      fontWeight: FontWeight.w500,
      color: isLight
          ? Colors.black.withOpacity(0.87)
          : Colors.white.withOpacity(0.87),
    ),
    hintTextStyle: TextStyle(
      fontFamily: 'Roboto',
      fontSize: 16,
      fontWeight: FontWeight.w400,
      color: isLight
          ? Colors.black.withOpacity(0.6)
          : Colors.white.withOpacity(0.6),
    ),
    pageInfoTextStyle: TextStyle(
      fontFamily: 'Roboto',
      fontSize: 12,
      color: isLight
          ? Colors.black.withOpacity(0.6)
          : Colors.white.withOpacity(0.6),
    ),
    inputFieldTextStyle: TextStyle(
      fontFamily: 'Roboto',
      fontSize: 16,
      color: isLight
          ? Colors.black.withOpacity(0.87)
          : Colors.white.withOpacity(0.87),
    ),
    validationTextStyle: const TextStyle(
      fontFamily: 'Roboto',
      fontSize: 12,
    ),
    okTextStyle: const TextStyle(
        fontFamily: 'Roboto', fontSize: 14, fontWeight: FontWeight.w500),
    cancelTextStyle: const TextStyle(
        fontFamily: 'Roboto', fontSize: 14, fontWeight: FontWeight.w500),
  );
  hyperlinkDialogStyle ??= PdfHyperlinkDialogStyle(
    backgroundColor: isLight ? Colors.white : const Color(0xFF424242),
    headerTextStyle: TextStyle(
      fontFamily: 'Roboto',
      fontSize: 20,
      fontWeight: FontWeight.w500,
      letterSpacing: 0.15,
      color: isLight
          ? Colors.black.withOpacity(0.87)
          : Colors.white.withOpacity(0.87),
    ),
    contentTextStyle: TextStyle(
      fontFamily: 'Roboto',
      fontSize: 14,
      fontWeight: FontWeight.w400,
      letterSpacing: 0.25,
      color: isLight
          ? Colors.black.withOpacity(0.87)
          : Colors.white.withOpacity(0.87),
    ),
    openTextStyle: const TextStyle(
      fontFamily: 'Roboto',
      fontSize: 14,
      fontWeight: FontWeight.w500,
      letterSpacing: 1.25,
    ),
    cancelTextStyle: TextStyle(
      fontFamily: 'Roboto',
      fontSize: 14,
      fontWeight: FontWeight.w500,
      letterSpacing: 1.25,
      color: isLight
          ? Colors.black.withOpacity(0.6)
          : Colors.white.withOpacity(0.6),
    ),
    closeIconColor: isLight
        ? Colors.black.withOpacity(0.6)
        : Colors.white.withOpacity(0.6),
  );
  passwordDialogStyle ??= PdfPasswordDialogStyle(
    backgroundColor: isLight ? Colors.white : const Color(0xFF424242),
    headerTextStyle: TextStyle(
      fontFamily: 'Roboto',
      fontSize: 20,
      fontWeight: FontWeight.w500,
      color: isLight
          ? Colors.black.withOpacity(0.87)
          : Colors.white.withOpacity(0.87),
    ),
    inputFieldTextStyle: TextStyle(
      fontFamily: 'Roboto',
      fontSize: 17,
      fontWeight: FontWeight.w400,
      color: isLight
          ? Colors.black.withOpacity(0.87)
          : Colors.white.withOpacity(0.87),
    ),
    closeIconColor: isLight
        ? Colors.black.withOpacity(0.6)
        : Colors.white.withOpacity(0.6),
    visibleIconColor: isLight
        ? Colors.black.withOpacity(0.6)
        : Colors.white.withOpacity(0.6),
    contentTextStyle: TextStyle(
      fontFamily: 'Roboto',
      fontSize: 16,
      fontWeight: FontWeight.w400,
      color: isLight
          ? Colors.black.withOpacity(0.6)
          : Colors.white.withOpacity(0.6),
    ),
    errorTextStyle: const TextStyle(
      fontFamily: 'Roboto',
      fontSize: 14,
      fontWeight: FontWeight.w500,
    ),
    inputFieldHintTextStyle: TextStyle(
      fontFamily: 'Roboto',
      fontSize: 16,
      fontWeight: FontWeight.w400,
      color: isLight
          ? Colors.black.withOpacity(0.6)
          : Colors.white.withOpacity(0.6),
    ),
    inputFieldLabelTextStyle: TextStyle(
      fontFamily: 'Roboto',
      fontSize: 18,
      fontWeight: FontWeight.w500,
      color: isLight
          ? Colors.black.withOpacity(0.87)
          : Colors.white.withOpacity(0.87),
    ),
    openTextStyle: const TextStyle(
      fontFamily: 'Roboto',
      fontSize: 14,
      fontWeight: FontWeight.w500,
    ),
    cancelTextStyle: const TextStyle(
      fontFamily: 'Roboto',
      fontSize: 14,
      fontWeight: FontWeight.w500,
    ),
  );
  return SfPdfViewerThemeData.raw(
      brightness: brightness,
      backgroundColor: backgroundColor,
      progressBarColor: progressBarColor,
      scrollStatusStyle: scrollStatusStyle,
      scrollHeadStyle: scrollHeadStyle,
      bookmarkViewStyle: bookmarkViewStyle,
      paginationDialogStyle: paginationDialogStyle,
      hyperlinkDialogStyle: hyperlinkDialogStyle,
      passwordDialogStyle: passwordDialogStyle);
}