/// Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved. /// /// THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW /// AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. /// UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. /// This notice may not be removed from this file. /// import 'package:compdfkit_flutter/compdfkit.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; class SettingsPage extends StatelessWidget { const SettingsPage({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( elevation: 4, excludeHeaderSemantics: true, titleSpacing: 0, title: Text(AppLocalizations.of(context)!.setting), ), body: Column( children: [ Column( children: [ head(context, AppLocalizations.of(context)!.sdk_information), item(context, AppLocalizations.of(context)!.versions, trailing: FutureBuilder( future: ComPDFKit.getVersionCode(), builder: (context, snap) { return Text(snap.data ?? "", style: Theme.of(context).textTheme.bodyMedium); })), head(context, AppLocalizations.of(context)!.company_information), item(context, AppLocalizations.of(context)!.compdf_official_website, onTap: () => launchUrl(Uri.parse(AppLocalizations.of(context)!.compdf_official_website))), item(context, AppLocalizations.of(context)!.about_us, onTap: () => launchUrl( Uri.parse(AppLocalizations.of(context)!.compdf_about_us_url))), item(context, AppLocalizations.of(context)!.technical_support, onTap: () => launchUrl(Uri.parse(AppLocalizations.of(context)!.compdf_technical_support_url))), item(context, AppLocalizations.of(context)!.contact_sales, onTap: () => launchUrl( Uri.parse(AppLocalizations.of(context)!.compdf_contact_sales_url))), item(context, AppLocalizations.of(context)!.compdf_email, onTap: () { launchUrl(Uri.parse( 'mailto:support@compdf.com?subject=${AppLocalizations.of(context)!.technical_support}')); }), ], ), Expanded( child: SafeArea( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ Text( '© 2014-2024 PDF Technologies, Inc. All Rights Reserved.', style: Theme.of(context) .textTheme .bodySmall ?.copyWith(fontSize: 11), textAlign: TextAlign.center, ), const Padding(padding: EdgeInsets.only(top: 8)), Text.rich(TextSpan(children: [ TextSpan( text: AppLocalizations.of(context)!.privacy_policy, style: Theme.of(context).textTheme.bodySmall?.copyWith( fontSize: 11, color: const Color(0xFF1460F3)), recognizer: TapGestureRecognizer() ..onTap = () => launchUrl( Uri.parse( AppLocalizations.of(context)!.compdf_privacy_policy_url), )), const TextSpan(text: ' | '), TextSpan( text: AppLocalizations.of(context)!.terms_of_service, style: Theme.of(context).textTheme.bodySmall?.copyWith( fontSize: 11, color: const Color(0xFF1460F3)), recognizer: TapGestureRecognizer() ..onTap = () => launchUrl( Uri.parse( AppLocalizations.of(context)!.compdf_terms_of_service_url), )), ])), ], ), ))) ], )); } Widget head(BuildContext context, String title) { return Container( width: double.infinity, padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6), color: Theme.of(context).brightness == Brightness.dark ? const Color(0xFF303238) : const Color(0xFFF2F2F2), child: Text(title, style: Theme.of(context).textTheme.bodySmall), ); } Widget item(BuildContext context, String title, {Widget? trailing, GestureTapCallback? onTap}) { return ListTile( onTap: onTap, title: Text(title, style: Theme.of(context).textTheme.bodyMedium), trailing: trailing ?? SvgPicture.asset( 'images/ic_syasarrow.svg', color: Theme.of(context).colorScheme.onPrimary, )); } }