From eaa254e0e0cd7d257fe5651710c6f5c2fd60b1d9 Mon Sep 17 00:00:00 2001 From: Tom Slater Date: Fri, 24 May 2019 16:21:48 +0100 Subject: [PATCH] Updated the About page so it functions, formatted + information added --- lib/common/widgets/basic_drawer.dart | 3 +- lib/main.dart | 2 + lib/pages/about_screen.dart | 116 +++++++++++++++++++++++++++ pubspec.lock | 7 ++ pubspec.yaml | 1 + 5 files changed, 127 insertions(+), 2 deletions(-) create mode 100644 lib/pages/about_screen.dart diff --git a/lib/common/widgets/basic_drawer.dart b/lib/common/widgets/basic_drawer.dart index 9852e7f..7dba13c 100644 --- a/lib/common/widgets/basic_drawer.dart +++ b/lib/common/widgets/basic_drawer.dart @@ -39,8 +39,7 @@ class _BasicDrawerState extends State { ), onTap: () { SystemChannels.textInput.invokeMethod('TextInput.hide'); -// Here I have not implemented an actual about screen, but if you did you would navigate to it's route -// Navigator.of(context).pushReplacementNamed('/AboutScreen'); + Navigator.of(context).pushReplacementNamed('/AboutPage'); }, ), ListTile( diff --git a/lib/main.dart b/lib/main.dart index 2ee7835..e180def 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -3,6 +3,7 @@ import 'package:local_spend/pages/home_page.dart'; import 'package:local_spend/pages/login_page.dart'; import 'package:local_spend/pages/receipt_page.dart'; import 'package:local_spend/pages/spash_screen.dart'; +import 'package:local_spend/pages/about_screen.dart'; import 'package:local_spend/config.dart'; void main() { @@ -22,6 +23,7 @@ class MyApp extends StatelessWidget { "/HomePage": (BuildContext context) => HomePage(), "/LoginPage": (BuildContext context) => LoginPage(), "/ReceiptPage": (BuildContext context) => ReceiptPage(), + "/AboutPage": (BuildContext context) => AboutPage(), }, home: SplashScreen(), ); diff --git a/lib/pages/about_screen.dart b/lib/pages/about_screen.dart new file mode 100644 index 0000000..443ee32 --- /dev/null +++ b/lib/pages/about_screen.dart @@ -0,0 +1,116 @@ +import 'package:flutter/material.dart'; +import 'package:local_spend/common/platform/platform_scaffold.dart'; +import 'package:local_spend/common/widgets/basic_drawer.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:url_launcher/url_launcher.dart'; +import 'package:flutter_linkify/flutter_linkify.dart'; + +class AboutPage extends StatefulWidget { + @override + _HomePageState createState() => _HomePageState(); +} + +class _HomePageState extends State { + @override + void initState() { + super.initState(); + _saveCurrentRoute("/AboutPage"); + } + + _saveCurrentRoute(String lastRoute) async { + SharedPreferences preferences = await SharedPreferences.getInstance(); + await preferences.setString('LastScreenRoute', lastRoute); + } + + @override + Widget build(BuildContext context) { + return PlatformScaffold( + appBar: AppBar( + title: Text( + "About Page", + style: TextStyle( + fontSize: 30, + color: Colors.black), + ), + centerTitle: true, + iconTheme: IconThemeData(color: Colors.black), + elevation: Theme.of(context).platform == TargetPlatform.iOS ? 0.0 : 6.0, + ), + drawer: BasicDrawer(), + body: Container( + padding: EdgeInsets.all(32.0), + child: ListView( + children: [ + InkWell( + child: const Center(child: Text + ('Link to Pear trading website', + style: TextStyle( + fontSize: 20, + color: Colors.blue, + ), + ), + ), + onTap: () => launch('https://app.peartrade.org/#/login?returnUrl=%2Fdashboard') + ), + Padding( + padding: EdgeInsets.fromLTRB(0,20,0,0), + child: Text( + "Developed by Shadowcat Industries", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 20.0, + color: Colors.black, + ), + ), + ), + Padding( + padding: EdgeInsets.fromLTRB(0,20,0,0), + child: Text( + "Pear tradings a commerce company designed to register andmonitor money circulating in the local economy.", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 20.0, + color: Colors.black, + ), + ), + ), + Padding( + padding: EdgeInsets.fromLTRB(0,20,0,0), + child: Text( + "Email: Test@admin.com", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 18.0, + color: Colors.blue, + ), + ), + ), + Padding( + padding: EdgeInsets.fromLTRB(0,0,0,20), + child: Text( + "Phone: +44(0)1524 64544", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 18.0, + color: Colors.blue, + ), + ), + ), + + InkWell( + child: const Center(child: Text + ('Link to Shadowcat website', + style: TextStyle( + fontSize: 20, + color: Colors.blue, + ), + ), + ), + onTap: () => launch('https://shadow.cat/') + ), + ], + ), + ), + ); + } +} \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index ea96797..7fae896 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -160,6 +160,13 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_linkify: + dependency: "direct main" + description: + name: flutter_linkify + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.1" flutter_test: dependency: "direct dev" description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index e4f4376..056b22a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -20,6 +20,7 @@ dependencies: json_annotation : ^2.2.0 http: ^0.12.0+2 datetime_picker_formfield: ^0.1.8 + flutter_linkify: ^1.0.3 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons.