diff --git a/lib/main.dart b/lib/main.dart index e4ce9f8..397f192 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -6,10 +6,12 @@ import 'package:app/app_controller.dart'; import 'package:app/router.dart'; import 'client.dart'; import 'native_storage.dart'; +import 'package_info_helper.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); setDefaultUrl(); + PackageInfoPlusHelper.init(); Authentication.checkForAuth().then((isAuthenticated) { AnyFluroRouter.setupRouter(); runApp(Anypay(isAuthenticated)); diff --git a/lib/package_info_helper.dart b/lib/package_info_helper.dart new file mode 100644 index 0000000..92174bf --- /dev/null +++ b/lib/package_info_helper.dart @@ -0,0 +1,11 @@ +import 'package:package_info_plus/package_info_plus.dart'; + +class PackageInfoPlusHelper { + static String version = ""; + static String build = ""; + static Future init() async { + PackageInfo packageInfo = await PackageInfo.fromPlatform(); + version = packageInfo.version; + build = packageInfo.buildNumber; + } +} diff --git a/lib/router.dart b/lib/router.dart index f609980..31965c6 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -15,6 +15,7 @@ import 'package:app/routes/payments.dart'; import 'package:app/routes/payment.dart'; import 'package:app/routes/invoice.dart'; import 'package:app/routes/login.dart'; +import 'routes/about_us.dart'; class AnyFluroRouter { static FluroRouter router = FluroRouter(); @@ -95,6 +96,11 @@ class AnyFluroRouter { handler: newHandler(() => Addresses(), []), transitionType: TransitionType.inFromBottom, ); + router.define( + 'settings/about_us', + handler: newHandler(() => AboutUs(), []), + transitionType: TransitionType.inFromBottom, + ); router.define( 'payments', handler: newHandler(() => Payments(), []), diff --git a/lib/routes/about_us.dart b/lib/routes/about_us.dart new file mode 100644 index 0000000..d5b41fb --- /dev/null +++ b/lib/routes/about_us.dart @@ -0,0 +1,84 @@ +import 'package:app/package_info_helper.dart'; +import 'package:flutter/material.dart'; +import 'package:app/back_button.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class AboutUs extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Center( + child: SingleChildScrollView( + child: SafeArea( + child: + Column(mainAxisAlignment: MainAxisAlignment.center, children: [ + Text( + "AnyPay", + style: TextStyle(fontSize: 40, fontWeight: FontWeight.w500), + ), + SizedBox( + height: 10, + ), + Text("support@anypayx.com"), + SizedBox( + height: 10, + ), + _clickable( + url: "https://docs.anypayx.com/terms", + title: "Terms of Service"), + SizedBox( + height: 10, + ), + _clickable( + url: "https://docs.anypayx.com/privacy", + title: "Privacy Policy"), + SizedBox( + height: 10, + ), + _clickable( + url: "https://docs.anypayx.com/", title: "Documentation"), + SizedBox( + height: 10, + ), + Text( + "${PackageInfoPlusHelper.version} [Build ${PackageInfoPlusHelper.build}]", + style: TextStyle(fontStyle: FontStyle.italic), + ), + SizedBox( + height: 10, + ), + Text( + "2024", + style: TextStyle(fontStyle: FontStyle.italic), + ), + SizedBox( + height: 10, + ), + CircleBackButton( + margin: EdgeInsets.only(top: 20.0), + backPath: '/settings', + ), + ]), + ), + ), + ), + ); + } + Widget _clickable({required String title, required String url}) { + return GestureDetector( + onTap: () async { + await launchUrl(Uri.parse(url)); + }, + child: Column( + children: [ + Text( + title, + style: TextStyle( + decoration: TextDecoration.underline, + decorationColor: Colors.blue, + ), + ), + ], + )); + } +} diff --git a/lib/routes/settings.dart b/lib/routes/settings.dart index abbdc30..119cc04 100644 --- a/lib/routes/settings.dart +++ b/lib/routes/settings.dart @@ -60,6 +60,7 @@ class _SettingsPageState extends State<SettingsPage> { if (isUserLoggedIn == true) _SelectCurrencyLink(context), if (isUserLoggedIn == true) _BusinessInfoLink(context), if (isUserLoggedIn == true) _AddressesLink(context), + _BuildAboutUs(context), CircleBackButton( margin: EdgeInsets.only(top: 20.0), backPath: 'navigation', @@ -136,6 +137,28 @@ class _SettingsPageState extends State<SettingsPage> { ); } + Widget _BuildAboutUs(context) { + return Container( + margin: EdgeInsets.all(10.0), + child: GestureDetector( + behavior: HitTestBehavior.translucent, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: <Widget>[ + Container( + margin: EdgeInsets.all(AppController.scale(20.0)), + child: Text("About Us", + style: TextStyle( + fontSize: 22, + ))), + ], + ), + onTap: () { + Navigator.pushNamed(context, 'settings/about_us'); + }), + ); + } + Widget _SelectCurrencyLink(context) { return Container( margin: EdgeInsets.all(10.0), diff --git a/pubspec.yaml b/pubspec.yaml index ca23378..17b5bb0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -39,6 +39,7 @@ dependencies: fluro: ^2.0.4 http: ^1.2.0 intl: ^0.19.0 + package_info_plus: ^5.0.1 flutter: sdk: flutter