cpdf_reader_widget_dark_theme_example.dart 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
  2. //
  3. // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  4. // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
  5. // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
  6. // This notice may not be removed from this file.
  7. import 'package:compdfkit_flutter/configuration/cpdf_configuration.dart';
  8. import 'package:compdfkit_flutter/configuration/cpdf_options.dart';
  9. import 'package:compdfkit_flutter/widgets/cpdf_reader_widget.dart';
  10. import 'package:compdfkit_flutter_example/theme/themes.dart';
  11. import 'package:flutter/material.dart';
  12. class CPDFDarkThemeExample extends StatefulWidget {
  13. final String documentPath;
  14. const CPDFDarkThemeExample({super.key, required this.documentPath});
  15. @override
  16. State<CPDFDarkThemeExample> createState() => _CPDFDarkThemeExampleState();
  17. }
  18. class _CPDFDarkThemeExampleState extends State<CPDFDarkThemeExample> {
  19. @override
  20. Widget build(BuildContext context) {
  21. return MaterialApp(
  22. theme: darkTheme,
  23. home: Scaffold(
  24. resizeToAvoidBottomInset: false,
  25. appBar: AppBar(
  26. title: const Text('Dark Theme Example'),
  27. ),
  28. body: CPDFReaderWidget(
  29. document: widget.documentPath,
  30. configuration: CPDFConfiguration(
  31. toolbarConfig: const CPDFToolbarConfig(
  32. iosLeftBarAvailableActions: [CPDFToolbarAction.thumbnail]),
  33. globalConfig: const CPDFGlobalConfig(themeMode: CPDFThemeMode.dark)
  34. ),
  35. onCreated: (controller) {},
  36. )));
  37. }
  38. }