main.dart 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /// main.dart
  2. ///
  3. /// Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
  4. ///
  5. /// THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  6. /// AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
  7. /// UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
  8. /// This notice may not be removed from this file.
  9. import 'package:flutter/material.dart';
  10. import 'package:kmpdfkit_conversion_flutter/cpdf_converter.dart';
  11. import 'package:kmpdfkit_conversion_flutter_example/states/convert_options_provider.dart';
  12. import 'package:kmpdfkit_conversion_flutter_example/states/convert_task_queue_provider.dart';
  13. import 'package:kmpdfkit_conversion_flutter_example/widgets/conversion_sdk_info_widget.dart';
  14. import 'package:kmpdfkit_conversion_flutter_example/widgets/convert_options_widget.dart';
  15. import 'package:kmpdfkit_conversion_flutter_example/widgets/convert_list_widget.dart';
  16. import 'package:provider/provider.dart';
  17. void main() {
  18. runApp(MultiProvider(
  19. providers: [
  20. ChangeNotifierProvider(create: (_) => ConvertTaskQueueProvider()),
  21. ChangeNotifierProvider(create: (_) => ConvertOptionsProvider())
  22. ],
  23. child: const MyApp(),
  24. ));
  25. }
  26. class MyApp extends StatelessWidget {
  27. const MyApp({super.key});
  28. @override
  29. Widget build(BuildContext context) {
  30. return MaterialApp(
  31. title: 'ComPDFKitConversionDemo',
  32. theme: ThemeData(
  33. primarySwatch: Colors.blue,
  34. ),
  35. home: const MyHomePage(title: 'ComPDFKitConversionDemo'));
  36. }
  37. }
  38. class MyHomePage extends StatefulWidget {
  39. const MyHomePage({super.key, required this.title});
  40. final String title;
  41. @override
  42. State<MyHomePage> createState() => _MyHomePageState();
  43. }
  44. class _MyHomePageState extends State<MyHomePage> {
  45. @override
  46. void initState() {
  47. super.initState();
  48. CPDFConverter.init("HcEZS8HQrBctbJli1xlWOJZq3SAVyEJGiOLDVgu7TaSCTutQTwE7Ob0BHdoyyqeauYV5qpfpv+0sqREPobyjxMYPXPWgfR9tu1l8cBzY1aagCXmEmH52tqT11le1QLdQpIHuMEjl0kNKrrnXoZg5IXM+yK+zGPFZur+Sg36vEak=",
  49. "mG0c3O3Mzeu5dkZJW3gpqotjgd+APU/4fMqIHQR4gdwo2nT+JSjvjfOo8NxHMSkD++hxhwHCwPoJfrSZGObicXKC+c93UnqcfqUbcdY/oQKcM/fgvvcctF5rcqYAH1dpMv7C2jvq4o0q6sQtN3jR43QdIezW2vV5wIeyNjPTddUNBwTRKvRkQ75Y56jVVUcsWiExjnRPpqLnyppZAnYJ1tnsa41fJuMqWbPW2c3qJUemdtKP7E4eFYSl6tjgcetK");
  50. }
  51. @override
  52. Widget build(BuildContext context) {
  53. return Scaffold(
  54. appBar: AppBar(
  55. title: Text(widget.title),
  56. ),
  57. body: const Padding(
  58. padding: EdgeInsets.all(8),
  59. child: Column(
  60. crossAxisAlignment: CrossAxisAlignment.start,
  61. children: <Widget>[
  62. ConversionSdkInfoWidget(),//conversion sdk info widget
  63. ConvertConfigWidget(), //convert options widget,
  64. Expanded(child: ConvertListWidget())
  65. ],
  66. ),
  67. ));
  68. }
  69. }