Skip to content

Commit

Permalink
about us feature
Browse files Browse the repository at this point in the history
  • Loading branch information
BlockchainViper committed Feb 25, 2024
1 parent db82c97 commit 3df7110
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
11 changes: 11 additions & 0 deletions lib/package_info_helper.dart
Original file line number Diff line number Diff line change
@@ -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;
}
}
6 changes: 6 additions & 0 deletions lib/router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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(), []),
Expand Down
84 changes: 84 additions & 0 deletions lib/routes/about_us.dart
Original file line number Diff line number Diff line change
@@ -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("[email protected]"),
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,
),
),
],
));
}
}
23 changes: 23 additions & 0 deletions lib/routes/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3df7110

Please sign in to comment.