settings_page.dart 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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:flutter/gestures.dart';
  10. import 'package:flutter/material.dart';
  11. import 'package:flutter_svg/flutter_svg.dart';
  12. import 'package:url_launcher/url_launcher.dart';
  13. class SettingsPage extends StatelessWidget {
  14. const SettingsPage({super.key});
  15. @override
  16. Widget build(BuildContext context) {
  17. return Scaffold(
  18. appBar: AppBar(
  19. elevation: 4,
  20. excludeHeaderSemantics: true,
  21. titleSpacing: 0,
  22. title: const Text('Settings'),
  23. ),
  24. body: Column(
  25. children: [
  26. Column(
  27. children: [
  28. head(context, 'SDK Information'),
  29. item(context, 'Versions',
  30. trailing: FutureBuilder(
  31. future: ComPDFKit.getVersionCode(),
  32. builder: (context, snap) {
  33. return Text(snap.data == null ? '' : 'ComPDFKit ${snap.data} for ${Platform.operatingSystem}',
  34. style: Theme.of(context).textTheme.bodyMedium);
  35. })),
  36. head(context, 'Company Information'),
  37. item(context,
  38. 'https://www.compdf.com/',
  39. onTap: () => launchUrl(Uri.parse('https://www.compdf.com/'))),
  40. item(context, 'About ComPDFKit',
  41. onTap: () => launchUrl(Uri.parse(
  42. 'https://www.compdf.com/company/about'))),
  43. item(context, 'Technical Support',
  44. onTap: () => launchUrl(Uri.parse('https://www.compdf.com/support'))),
  45. item(context, 'Contact Sales',
  46. onTap: () => launchUrl(Uri.parse('https://www.compdf.com/contact-sales'))),
  47. item(context, 'support@compdf.com',
  48. onTap: () {
  49. launchUrl(Uri.parse(
  50. 'mailto:support@compdf.com?subject=Technical Support'));
  51. }),
  52. ],
  53. ),
  54. Expanded(
  55. child: SafeArea(
  56. child: Padding(
  57. padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
  58. child: Column(
  59. mainAxisAlignment: MainAxisAlignment.end,
  60. children: [
  61. Text(
  62. '© 2014-2024 PDF Technologies, Inc. All Rights Reserved.',
  63. style: Theme.of(context)
  64. .textTheme
  65. .bodySmall
  66. ?.copyWith(fontSize: 11),
  67. textAlign: TextAlign.center,
  68. ),
  69. const Padding(padding: EdgeInsets.only(top: 8)),
  70. Text.rich(TextSpan(children: [
  71. TextSpan(
  72. text: 'Privacy Policy',
  73. style: Theme.of(context).textTheme.bodySmall?.copyWith(
  74. fontSize: 11, color: const Color(0xFF1460F3)),
  75. recognizer: TapGestureRecognizer()
  76. ..onTap = () => launchUrl(
  77. Uri.parse('https://www.compdf.com/privacy-policy'),
  78. )),
  79. const TextSpan(text: ' | '),
  80. TextSpan(
  81. text: 'Terms of Service',
  82. style: Theme.of(context).textTheme.bodySmall?.copyWith(
  83. fontSize: 11, color: const Color(0xFF1460F3)),
  84. recognizer: TapGestureRecognizer()
  85. ..onTap = () => launchUrl(
  86. Uri.parse('https://www.compdf.com/terms-of-service'),
  87. )),
  88. ])),
  89. ],
  90. ),
  91. )))
  92. ],
  93. ));
  94. }
  95. Widget head(BuildContext context, String title) {
  96. return Container(
  97. width: double.infinity,
  98. padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
  99. color: Theme.of(context).brightness == Brightness.dark
  100. ? const Color(0xFF303238)
  101. : const Color(0xFFF2F2F2),
  102. child: Text(title, style: Theme.of(context).textTheme.bodySmall),
  103. );
  104. }
  105. Widget item(BuildContext context, String title,
  106. {Widget? trailing, GestureTapCallback? onTap}) {
  107. return ListTile(
  108. onTap: onTap,
  109. title: Text(title, style: Theme.of(context).textTheme.bodyMedium),
  110. trailing: trailing ??
  111. SvgPicture.asset(
  112. 'images/ic_syasarrow.svg'
  113. ));
  114. }
  115. }