Showing
2 changed files
with
29 additions
and
0 deletions
@@ -14,6 +14,10 @@ | @@ -14,6 +14,10 @@ | ||
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | +import 'package:pdf/widgets.dart'; | ||
18 | + | ||
19 | +import 'src/fonts/gfonts.dart'; | ||
20 | + | ||
17 | export 'src/asset_utils.dart'; | 21 | export 'src/asset_utils.dart'; |
18 | export 'src/cache.dart'; | 22 | export 'src/cache.dart'; |
19 | export 'src/callback.dart'; | 23 | export 'src/callback.dart'; |
@@ -25,3 +29,27 @@ export 'src/printing.dart'; | @@ -25,3 +29,27 @@ export 'src/printing.dart'; | ||
25 | export 'src/printing_info.dart'; | 29 | export 'src/printing_info.dart'; |
26 | export 'src/raster.dart'; | 30 | export 'src/raster.dart'; |
27 | export 'src/widget_wrapper.dart'; | 31 | export 'src/widget_wrapper.dart'; |
32 | + | ||
33 | +Future<void> pdfDefaultTheme() async { | ||
34 | + if (ThemeData.buildThemeData != null) { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + final base = await PdfGoogleFonts.openSansRegular(); | ||
39 | + final bold = await PdfGoogleFonts.openSansBold(); | ||
40 | + final italic = await PdfGoogleFonts.openSansItalic(); | ||
41 | + final boldItalic = await PdfGoogleFonts.openSansBoldItalic(); | ||
42 | + final emoji = await PdfGoogleFonts.notoColorEmoji(); | ||
43 | + final icons = await PdfGoogleFonts.materialIcons(); | ||
44 | + | ||
45 | + ThemeData.buildThemeData = () { | ||
46 | + return ThemeData.withFont( | ||
47 | + base: base, | ||
48 | + bold: bold, | ||
49 | + italic: italic, | ||
50 | + boldItalic: boldItalic, | ||
51 | + icons: icons, | ||
52 | + fontFallback: [emoji, base], | ||
53 | + ); | ||
54 | + }; | ||
55 | +} |
-
Please register or login to post a comment