Skip to content

Commit 783b55f

Browse files
author
LokeshPalani
committed
Added missed file theme in the pdfviewer
1 parent 276c808 commit 783b55f

File tree

1 file changed

+181
-0
lines changed
  • packages/syncfusion_flutter_pdfviewer/lib/src/theme

1 file changed

+181
-0
lines changed
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:syncfusion_flutter_core/theme.dart';
3+
4+
/// Holds the default values if Material 3 is not enabled.
5+
class SfPdfViewerThemeDataM2 extends SfPdfViewerThemeData {
6+
/// Creates a [SfPdfViewerThemeDataM2] that holds the default values
7+
/// for [SfPdfViewer] when Material 3 is not enabled.
8+
SfPdfViewerThemeDataM2(this.context);
9+
10+
/// The [BuildContext] of the widget.
11+
final BuildContext context;
12+
13+
/// The [ColorScheme] of the widget.
14+
late final ColorScheme colorScheme = Theme.of(context).colorScheme;
15+
16+
late final PdfScrollHeadStyle _scrollHeadStyle = PdfScrollHeadStyle(
17+
backgroundColor: colorScheme.brightness == Brightness.light
18+
? const Color(0xFFFAFAFA)
19+
: const Color(0xFF424242),
20+
);
21+
22+
late final PdfBookmarkViewStyle _bookmarkViewStyle = PdfBookmarkViewStyle(
23+
backgroundColor: colorScheme.brightness == Brightness.light
24+
? Colors.white
25+
: const Color(0xFF212121),
26+
closeIconColor: colorScheme.brightness == Brightness.light
27+
? Colors.black.withOpacity(0.54)
28+
: Colors.white.withOpacity(0.54),
29+
backIconColor: colorScheme.brightness == Brightness.light
30+
? Colors.black.withOpacity(0.54)
31+
: Colors.white.withOpacity(0.54),
32+
headerBarColor: colorScheme.brightness == Brightness.light
33+
? const Color(0xFFFAFAFA)
34+
: const Color(0xFF424242),
35+
navigationIconColor: colorScheme.brightness == Brightness.light
36+
? Colors.black.withOpacity(0.54)
37+
: Colors.white.withOpacity(0.54),
38+
selectionColor: colorScheme.brightness == Brightness.light
39+
? const Color.fromRGBO(0, 0, 0, 0.08)
40+
: const Color.fromRGBO(255, 255, 255, 0.12),
41+
titleSeparatorColor: colorScheme.brightness == Brightness.light
42+
? const Color.fromRGBO(0, 0, 0, 0.16)
43+
: const Color.fromRGBO(255, 255, 255, 0.16),
44+
);
45+
46+
late final PdfPaginationDialogStyle _paginationDialogStyle =
47+
PdfPaginationDialogStyle(
48+
backgroundColor: colorScheme.brightness == Brightness.light
49+
? Colors.white
50+
: const Color(0xFF424242),
51+
);
52+
53+
late final PdfHyperlinkDialogStyle _hyperlinkDialogStyle =
54+
PdfHyperlinkDialogStyle(
55+
backgroundColor: colorScheme.brightness == Brightness.light
56+
? Colors.white
57+
: const Color(0xFF424242),
58+
closeIconColor: colorScheme.brightness == Brightness.light
59+
? Colors.black.withOpacity(0.6)
60+
: Colors.white.withOpacity(0.6),
61+
);
62+
63+
late final PdfPasswordDialogStyle _passwordDialogStyle =
64+
PdfPasswordDialogStyle(
65+
backgroundColor: colorScheme.brightness == Brightness.light
66+
? Colors.white
67+
: const Color(0xFF424242),
68+
closeIconColor: colorScheme.brightness == Brightness.light
69+
? Colors.black.withOpacity(0.6)
70+
: Colors.white.withOpacity(0.6),
71+
visibleIconColor: colorScheme.brightness == Brightness.light
72+
? Colors.black.withOpacity(0.6)
73+
: Colors.white.withOpacity(0.6),
74+
);
75+
76+
@override
77+
Color? get backgroundColor => colorScheme.brightness == Brightness.light
78+
? const Color(0xFFD6D6D6)
79+
: const Color(0xFF303030);
80+
81+
@override
82+
PdfScrollHeadStyle get scrollHeadStyle => _scrollHeadStyle;
83+
@override
84+
PdfBookmarkViewStyle get bookmarkViewStyle => _bookmarkViewStyle;
85+
86+
@override
87+
PdfPaginationDialogStyle get paginationDialogStyle => _paginationDialogStyle;
88+
89+
@override
90+
PdfHyperlinkDialogStyle get hyperlinkDialogStyle => _hyperlinkDialogStyle;
91+
92+
@override
93+
PdfPasswordDialogStyle get passwordDialogStyle => _passwordDialogStyle;
94+
}
95+
96+
/// Holds the default values if Material 3 is enabled.
97+
class SfPdfViewerThemeDataM3 extends SfPdfViewerThemeData {
98+
/// Creates a [SfPdfViewerThemeDataM3] that holds the default values
99+
/// for [SfPdfViewer] when Material 3 is enabled.
100+
SfPdfViewerThemeDataM3(this.context);
101+
102+
/// The [BuildContext] of the widget.
103+
final BuildContext context;
104+
105+
/// The [ColorScheme] of the widget.
106+
late final ColorScheme colorScheme = Theme.of(context).colorScheme;
107+
108+
late final PdfScrollHeadStyle _scrollHeadStyle = PdfScrollHeadStyle(
109+
backgroundColor: colorScheme.brightness == Brightness.light
110+
? const Color.fromRGBO(247, 242, 251, 1)
111+
: const Color.fromRGBO(37, 35, 42, 1),
112+
);
113+
114+
late final PdfScrollStatusStyle _scrollStatusStyle = PdfScrollStatusStyle(
115+
backgroundColor: colorScheme.inverseSurface,
116+
pageInfoTextStyle: TextStyle(color: colorScheme.onInverseSurface));
117+
118+
late final PdfBookmarkViewStyle _bookmarkViewStyle = PdfBookmarkViewStyle(
119+
backgroundColor: colorScheme.brightness == Brightness.light
120+
? const Color.fromRGBO(247, 242, 251, 1)
121+
: const Color.fromRGBO(37, 35, 42, 1),
122+
closeIconColor: colorScheme.onSurfaceVariant,
123+
backIconColor: colorScheme.onSurfaceVariant,
124+
headerBarColor: colorScheme.brightness == Brightness.light
125+
? const Color.fromRGBO(247, 242, 251, 1)
126+
: const Color.fromRGBO(37, 35, 42, 1),
127+
navigationIconColor: colorScheme.onSurfaceVariant,
128+
selectionColor: colorScheme.primaryContainer,
129+
titleSeparatorColor: colorScheme.outlineVariant,
130+
);
131+
132+
late final PdfPaginationDialogStyle _paginationDialogStyle =
133+
PdfPaginationDialogStyle(
134+
backgroundColor: colorScheme.brightness == Brightness.light
135+
? const Color.fromRGBO(238, 232, 244, 1)
136+
: const Color.fromRGBO(48, 45, 56, 1),
137+
);
138+
139+
late final PdfHyperlinkDialogStyle _hyperlinkDialogStyle =
140+
PdfHyperlinkDialogStyle(
141+
backgroundColor: colorScheme.brightness == Brightness.light
142+
? const Color.fromRGBO(238, 232, 244, 1)
143+
: const Color.fromRGBO(48, 45, 56, 1),
144+
closeIconColor: colorScheme.onSurfaceVariant,
145+
);
146+
147+
late final PdfPasswordDialogStyle _passwordDialogStyle =
148+
PdfPasswordDialogStyle(
149+
backgroundColor: colorScheme.brightness == Brightness.light
150+
? const Color.fromRGBO(238, 232, 244, 1)
151+
: const Color.fromRGBO(48, 45, 56, 1),
152+
closeIconColor: colorScheme.onSurfaceVariant,
153+
visibleIconColor: colorScheme.onSurfaceVariant,
154+
);
155+
156+
@override
157+
Color? get backgroundColor => colorScheme.brightness == Brightness.light
158+
? const Color.fromRGBO(237, 230, 243, 1)
159+
: const Color.fromRGBO(50, 46, 58, 1);
160+
161+
@override
162+
Color? get progressBarColor => colorScheme.primary;
163+
164+
@override
165+
PdfScrollHeadStyle get scrollHeadStyle => _scrollHeadStyle;
166+
167+
@override
168+
PdfScrollStatusStyle get scrollStatusStyle => _scrollStatusStyle;
169+
170+
@override
171+
PdfBookmarkViewStyle get bookmarkViewStyle => _bookmarkViewStyle;
172+
173+
@override
174+
PdfPaginationDialogStyle get paginationDialogStyle => _paginationDialogStyle;
175+
176+
@override
177+
PdfHyperlinkDialogStyle get hyperlinkDialogStyle => _hyperlinkDialogStyle;
178+
179+
@override
180+
PdfPasswordDialogStyle get passwordDialogStyle => _passwordDialogStyle;
181+
}

0 commit comments

Comments
 (0)