convert_rtf_options_widget.dart 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import 'package:ConversionFlutterDemo/states/convert_options_provider.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:provider/provider.dart';
  4. /// convert_rtf_options_widget.dart
  5. /// Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
  6. ///
  7. /// THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  8. /// AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
  9. /// UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
  10. /// This notice may not be removed from this file.
  11. class ConvertRTFOptionsWidget extends StatefulWidget {
  12. const ConvertRTFOptionsWidget({Key? key}) : super(key: key);
  13. @override
  14. State<ConvertRTFOptionsWidget> createState() =>
  15. _ConvertRTFOptionsWidgetState();
  16. }
  17. class _ConvertRTFOptionsWidgetState extends State<ConvertRTFOptionsWidget> {
  18. @override
  19. Widget build(BuildContext context) {
  20. bool containImages = context.select<ConvertOptionsProvider, bool>(
  21. (value) => value.rtfOptions.containImages);
  22. bool containAnnotations = context.select<ConvertOptionsProvider, bool>(
  23. (value) => value.rtfOptions.containAnnotations);
  24. return Padding(
  25. padding: EdgeInsets.all(8),
  26. child: Column(
  27. mainAxisSize: MainAxisSize.min,
  28. children: [
  29. Row(
  30. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  31. children: [
  32. const Text('ContainImages'),
  33. Switch(
  34. value: containImages,
  35. onChanged: (value) {
  36. context
  37. .read<ConvertOptionsProvider>()
  38. .changeRTFOptions(containImages: value);
  39. })
  40. ],
  41. ),
  42. Row(
  43. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  44. children: [
  45. const Text('ContainAnnotations'),
  46. Switch(
  47. value: containAnnotations,
  48. onChanged: (value) {
  49. context
  50. .read<ConvertOptionsProvider>()
  51. .changeRTFOptions(containAnnotations: value);
  52. })
  53. ],
  54. )
  55. ],
  56. ));
  57. }
  58. }