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),
  );
  bookmarkViewStyle ??= PdfBookmarkViewStyle(
    backgroundColor: isLight ? Colors.white : const Color(0xFF212121),
    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),
  );
  paginationDialogStyle ??= PdfPaginationDialogStyle(
    backgroundColor: isLight ? Colors.white : const Color(0xFF424242),
  );
  hyperlinkDialogStyle ??= PdfHyperlinkDialogStyle(
    backgroundColor: isLight ? Colors.white : const Color(0xFF424242),
    closeIconColor: isLight
        ? Colors.black.withOpacity(0.6)
        : Colors.white.withOpacity(0.6),
  );
  passwordDialogStyle ??= PdfPasswordDialogStyle(
    backgroundColor: isLight ? Colors.white : const Color(0xFF424242),
    closeIconColor: isLight
        ? Colors.black.withOpacity(0.6)
        : Colors.white.withOpacity(0.6),
    visibleIconColor: isLight
        ? Colors.black.withOpacity(0.6)
        : Colors.white.withOpacity(0.6),
  );
  return SfPdfViewerThemeData.raw(
      brightness: brightness,
      backgroundColor: backgroundColor,
      progressBarColor: progressBarColor,
      scrollStatusStyle: scrollStatusStyle,
      scrollHeadStyle: scrollHeadStyle,
      bookmarkViewStyle: bookmarkViewStyle,
      paginationDialogStyle: paginationDialogStyle,
      hyperlinkDialogStyle: hyperlinkDialogStyle,
      passwordDialogStyle: passwordDialogStyle);
}