main.dart 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 'dart:io';
  8. import 'package:compdfkit_flutter/compdfkit.dart';
  9. import 'package:compdfkit_flutter_example/examples.dart';
  10. import 'package:compdfkit_flutter_example/theme/themes.dart';
  11. import 'package:compdfkit_flutter_example/widgets/cpdf_app_bar.dart';
  12. import 'package:flutter/material.dart';
  13. var androidLicenseKey = "c4r34cNxld6pdUSsM2EgGQ9purMEZN7JuumHbNx9w+OJ6lYqF7WRYAFV0jvA5CEEX7J1+wGrF68mo8YP3qL5b6lmS60TMw2/wJ+TPtmeKkJMRMaiQ2nF2pwSevBj2HIHbnTLfr2btYHL/TRKFbfG0SUp/tZVjUwOC91rcrlaLkThWpc13/3SOi/34uHyjQszJ6PmDeg8X+qxfNheOBX/JZofPOjKpWpAAXXKT9kgtbZKKc6VAmMPAdRth7FnJjPieXkHkvW3fX2kNcgX6cb8IBnu/7Q3C4776P6IVIQKlDItMGNJIV7IPMADRnsLMqdC9FZcF3mV0laocg8qlFuKdmu0lH1oY17eVN2TRW5amzrVRSqpTOyx2LGvW1Ilra90nzlp2dEBHH+rU3Jo93jy94eWecFWMwgKBD5sABvhJFteiZTpP6NufkmmJm5UhS1bbWwQ3416ecpKs8D9TAlLLO+rbIocuxdoPE2dxWFYLq6zF8kJV3z7dKYtAwQKdoQiS08ryGXVZybCx2GjZp97I7zNemiorRWKQUrxpNk0vCLwL1yz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ecpKs8D9TAlLLO+rbIocuxdoPE2dxWFYLq6zF8kJV3z7dKYtAwQKdoQiS08ryGXVZybCx2GjZp97I7zNemiorRWKQUrxpNk0vCLwL1yz7NzjlB6YQ8UxvmTkX/GU7T7Ubg9LoyZuVo4tLHLplMSlHIcA4guqZL7JbQ6/jomhcJGFpGo+X7tbrCvMTnbvjZoxJRlcNN1+9x100WEfF4A2XbJZEjcpxV9tk1rTt+jS8dkX803ij16yHI1THSycP2aKkWjgDAsAUt98KJfMhDVdBtIWgg2xXbvUdZdPA+MDYbxOt/kTCqmTNMCBL4i4/N1Dqxvl8Me6vei5LeecqlBZbInEmA+87xsmNJ+d5MxP+EIac9+yqaQ0YIYE4wnAzUkp/0SfANyT5mw/EcTvSxlFmdNPXMpAygK4Q1n/S3QjnpAZJCMhg6hUDQi1TPHJO1WCWdGg50xVd4e9cvnNaN633IvvL9TFBGBu4xx7FHUdlWeiIkfzaiP8Y+58lPpC7x05cs28uc/hwXiZGx2KvdF+199pSLVUIrj85m/7+SqS01Dz6t4RwV7CZ/nQ4KOAyptnYBkUNyyOx7Q7j3CUXnxUN5HL5Yhqq2FFaD/HTTVwcjun3kBQWAiUV1AWYY/lHA5ERHysKmgUkhba8MlQCnsGD2o4KGBScfS0N2kQ3Eg6AtwSRVmQZHRUOuFrRzDh6w9DqXG/2btsFdOOfQ==";
  15. void main() {
  16. runApp(const MyApp());
  17. }
  18. class MyApp extends StatelessWidget {
  19. const MyApp({super.key});
  20. @override
  21. Widget build(BuildContext context) {
  22. return MaterialApp(
  23. title: 'ComPDFKit SDK for Flutter',
  24. theme: lightTheme,
  25. darkTheme: darkTheme,
  26. themeMode: ThemeMode.system,
  27. home: const HomePage(),
  28. );
  29. }
  30. }
  31. class HomePage extends StatefulWidget {
  32. const HomePage({super.key});
  33. @override
  34. State<HomePage> createState() => _HomePageState();
  35. }
  36. class _HomePageState extends State<HomePage> {
  37. @override
  38. void initState() {
  39. super.initState();
  40. _init();
  41. }
  42. void _init() async {
  43. // online license auth
  44. // Please replace it with your ComPDFKit license
  45. // ComPDFKit.initialize(androidOnlineLicense: 'IVTAsbJCW0X45qIy5cTEuzxZzKpYIpJe6WPY7uCPIiI=',iosOnlineLicense: 'lkw3Gr0HuD5pV1/+DVRSxp7qBlvK+Izo3mOKyAEHXz4=');
  46. // offline license auth
  47. ComPDFKit.init(Platform.isAndroid ? androidLicenseKey : iosLicenseKey);
  48. }
  49. @override
  50. Widget build(BuildContext context) {
  51. return Scaffold(
  52. appBar: const CAppBar(),
  53. body: ExampleListView(widgets: examples(context)));
  54. }
  55. }
  56. class ExampleListView extends StatelessWidget {
  57. final List<Widget> widgets;
  58. const ExampleListView({super.key, required this.widgets});
  59. @override
  60. Widget build(BuildContext context) {
  61. return Padding(
  62. padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
  63. child: ListView.builder(
  64. itemCount: widgets.length,
  65. itemBuilder: (context, index) {
  66. return widgets[index];
  67. }));
  68. }
  69. }