David PHAM-VAN

Add a default theme initializer

... ... @@ -8,6 +8,7 @@
- Fix TTF font parser for NewsCycle-Regular.ttf
- Fix AssetManifest
- Update Google Fonts
- Add a default theme initializer
## 5.6.6
... ...
... ... @@ -14,6 +14,10 @@
* limitations under the License.
*/
import 'package:pdf/widgets.dart';
import 'src/fonts/gfonts.dart';
export 'src/asset_utils.dart';
export 'src/cache.dart';
export 'src/callback.dart';
... ... @@ -25,3 +29,27 @@ export 'src/printing.dart';
export 'src/printing_info.dart';
export 'src/raster.dart';
export 'src/widget_wrapper.dart';
Future<void> pdfDefaultTheme() async {
if (ThemeData.buildThemeData != null) {
return;
}
final base = await PdfGoogleFonts.openSansRegular();
final bold = await PdfGoogleFonts.openSansBold();
final italic = await PdfGoogleFonts.openSansItalic();
final boldItalic = await PdfGoogleFonts.openSansBoldItalic();
final emoji = await PdfGoogleFonts.notoColorEmoji();
final icons = await PdfGoogleFonts.materialIcons();
ThemeData.buildThemeData = () {
return ThemeData.withFont(
base: base,
bold: bold,
italic: italic,
boldItalic: boldItalic,
icons: icons,
fontFallback: [emoji, base],
);
};
}
... ...