main.dart 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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/compdfkit.dart';
  8. import 'package:compdfkit_flutter_example/examples.dart';
  9. import 'package:compdfkit_flutter_example/theme/themes.dart';
  10. import 'package:compdfkit_flutter_example/widgets/cpdf_app_bar.dart';
  11. import 'package:flutter/material.dart';
  12. void main() {
  13. runApp(const MyApp());
  14. }
  15. class MyApp extends StatelessWidget {
  16. const MyApp({super.key});
  17. @override
  18. Widget build(BuildContext context) {
  19. return MaterialApp(
  20. title: 'ComPDFKit SDK for Flutter',
  21. theme: lightTheme,
  22. darkTheme: darkTheme,
  23. themeMode: ThemeMode.system,
  24. home: const HomePage(),
  25. );
  26. }
  27. }
  28. class HomePage extends StatefulWidget {
  29. const HomePage({super.key});
  30. @override
  31. State<HomePage> createState() => _HomePageState();
  32. }
  33. class _HomePageState extends State<HomePage> {
  34. @override
  35. void initState() {
  36. super.initState();
  37. _init();
  38. }
  39. void _init() async {
  40. // online license auth
  41. // Please replace it with your ComPDFKit license
  42. // ComPDFKit.initialize(androidOnlineLicense: 'IVTAsbJCW0X45qIy5cTEuzxZzKpYIpJe6WPY7uCPIiI=',iosOnlineLicense: 'lkw3Gr0HuD5pV1/+DVRSxp7qBlvK+Izo3mOKyAEHXz4=');
  43. // offline license auth
  44. ComPDFKit.init('2sAQ0T0o6skMlaNcW3NnvLzUkm0a4CRoLrGDn0hKWgA2mW0XKNrWyFCbZqOJYP1QvHdbvE0csBGDrW7YT9vFJmGUoq3aIG7RJ+cmlXKHjcNRDlgv4qIG2MhVfTEmsB9Lsc2mH/BujGPDpo3JSBoABnio5cPXRvE858U4efCS7UnFz9bqKdNi7B+DRj30Ui3KhldHWIuUinkT6S2LZHZsx5SZfiRGtyyercpc74s84g5GlrWMm46cW2OBM9uGjfulxkMNFTLz4O7qlOxL9u1ROv5fc3EcbdHfPaeYgb/5TpaZ7yW0fNIxPJACN8I7eZtAEHCSxklwmwwW4yW9hhKufmu0lH1oY17eVN2TRW5amzpB3o9Gv+C0tPjp0J9GPbwKFd4UTWTj+qL37c8z0wtqvjYLZS0cDUPbg/l5ttIFvIGwx28KqccOZf0KmJnr5wZY/8bAGTYd5CLpwzQNn5AwQauS9afPfcUGq+rjkosh+J2TB1tqD8sfrA+BnnzAnHCnMHKCmfr/bVJrB8v4xXHuTzwgKcSV5Qq+m6om/GPvFe1zOUAtlBN0tEFLst0PxTg2JncW78J+U3I+d463EB6bxNqIRD0SBgOViddx+fqNVReUDyqhZA0Tml3uXiGXxYPQZjak+LNVIYREQcg/YIzFdh5fzGj9lUQZLc0h6vgUtekkIZd4ydh2DHg9mlQPC4jq4PEVvGakmxVyNmP0RDKvrdBylpuGnyxMiQ4IvoDZ+R81lOdvuohwamNg3Md+towSUhZVjYFuRdFDbw1P3qQ0HRmUlnRwtVifJlbFpoQpCBU=');
  45. }
  46. @override
  47. Widget build(BuildContext context) {
  48. return Scaffold(
  49. appBar: const CAppBar(),
  50. body: ExampleListView(widgets: examples(context)));
  51. }
  52. }
  53. class ExampleListView extends StatelessWidget {
  54. final List<Widget> widgets;
  55. const ExampleListView({super.key, required this.widgets});
  56. @override
  57. Widget build(BuildContext context) {
  58. return Padding(
  59. padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
  60. child: ListView.builder(
  61. itemCount: widgets.length,
  62. itemBuilder: (context, index) {
  63. return widgets[index];
  64. }));
  65. }
  66. }