Skip to content

Commit

Permalink
Add about view with version
Browse files Browse the repository at this point in the history
  • Loading branch information
gsailer authored and Gabriel Sailer committed Mar 13, 2021
1 parent 546ce68 commit dca3c29
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 7 deletions.
5 changes: 2 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';

import 'package:ofa_v0/views/about.dart';
import 'package:ofa_v0/views/licenses.dart';
import 'package:ofa_v0/views/loading_home.dart';
import 'package:ofa_v0/views/nojson.dart';
Expand All @@ -9,7 +10,6 @@ import 'package:ofa_v0/views/onboarding.dart';
import 'package:ofa_v0/views/how_to_del.dart';
import 'package:ofa_v0/views/authors.dart';
import 'package:ofa_v0/views/delete_confirm.dart';
import 'package:ofa_v0/views/insights_screens/insight_detail.dart';
import 'package:ofa_v0/views/privacy_edu.dart';
import 'package:ofa_v0/views/export_data.dart';

Expand All @@ -28,8 +28,6 @@ class MyApp extends StatelessWidget {
title: 'OFA App',
initialRoute: '/',
routes: {
//TODO: Implement App Loading Screen
//TODO: Implement Splash Screen
'/': (context) => LoadingHome(),
'/onboarding': (context) => Onboarding(),
'/dashBoard': (context) => DashBoard(),
Expand All @@ -41,6 +39,7 @@ class MyApp extends StatelessWidget {
'/licenses': (context) => OssLicensesPage(),
'/privacy_edu': (context) => PrivacyEdu(),
'/export_data': (context) => ExportData(),
'/about': (context) => About(),
});
}
}
83 changes: 83 additions & 0 deletions lib/views/about.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import 'package:flutter/material.dart';
import 'package:package_info/package_info.dart';

class About extends StatelessWidget {
Future<String> getVersion() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
return packageInfo.version;
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Color(0xff212121),
leading: Builder(builder: (BuildContext context) {
return IconButton(
icon: Icon(Icons.arrow_back, color: Colors.white),
onPressed: () {
Navigator.of(context).pop();
},
);
}),
),
body: Container(
height: MediaQuery.of(context).size.height -
MediaQuery.of(context).padding.top -
kToolbarHeight,
width: MediaQuery.of(context).size.width,
color: Color(0xff212121),
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(12.0),
child: Align(
alignment: Alignment.topLeft,
child: Text(
"About",
style: TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold,
),
)),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"The OFA app was developed in cooperation with the KIT for usage in reasearch related to privacy awareness. It should better visualise data provided by Facebook through the GDPR information on Off-Facebook activity.",
style: TextStyle(
color: Colors.white,
fontSize: 14,
fontWeight: FontWeight.normal,
)),
),
Spacer(),
Padding(
padding: const EdgeInsets.all(8.0),
child: Align(
alignment: FractionalOffset.bottomCenter,
child: FutureBuilder<String>(
future: getVersion(),
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.none) {
return Text("Version: dev");
}
if (snapshot.connectionState == ConnectionState.waiting) {
return Text('Getting version...');
} else {
if (snapshot.hasError)
return Text('Error: ${snapshot.error}');
else
return Text('Version ${snapshot.data}');
}
},
),
),
),
],
),
),
);
}
}
37 changes: 33 additions & 4 deletions lib/views/dashboard.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:mdi/mdi.dart';
import 'package:ofa_v0/json_parser.dart';
// import 'package:ofa_v0/views/more_websites.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
Expand Down Expand Up @@ -121,7 +122,7 @@ class _DashBoard extends State<DashBoard> {
width: 11,
),
Text(
'How to delete your data from Facebook?',
'How to delete your data?',
style: TextStyle(color: Colors.white),
),
],
Expand Down Expand Up @@ -220,7 +221,10 @@ class _DashBoard extends State<DashBoard> {
ListTile(
title: Row(
children: <Widget>[
Icon(Icons.import_export, color: Colors.white,),
Icon(
Icons.import_export,
color: Colors.white,
),
SizedBox(
width: 11,
),
Expand All @@ -231,8 +235,33 @@ class _DashBoard extends State<DashBoard> {
],
),
onTap: () {
INRepository insights = ModalRoute.of(context).settings.arguments;
Navigator.pushNamed(context, '/export_data', arguments: insights);
INRepository insights =
ModalRoute.of(context).settings.arguments;
Navigator.pushNamed(context, '/export_data',
arguments: insights);
},
),
Divider(
color: Colors.white,
thickness: 2,
indent: 10,
endIndent: 10,
),
ListTile(
title: Row(
children: <Widget>[
Icon(Mdi.information, color: Colors.white),
SizedBox(
width: 11,
),
Text(
'About',
style: TextStyle(color: Colors.white),
),
],
),
onTap: () {
Navigator.pushNamed(context, '/about');
},
),
],
Expand Down
14 changes: 14 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10"
mdi:
dependency: "direct main"
description:
name: mdi
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
meta:
dependency: transitive
description:
Expand Down Expand Up @@ -333,6 +340,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
package_info:
dependency: "direct main"
description:
name: package_info
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
path:
dependency: transitive
description:
Expand Down
3 changes: 3 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ dependencies:
date_range_picker:
git:
url: https://github.com/LempereurBenjamin/date_range_picker
package_info: ^2.0.0
mdi: ^3.0.0



# The following adds the Cupertino Icons font to your application.
Expand Down

0 comments on commit dca3c29

Please sign in to comment.