summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Frank <conjfrnk@gmail.com>2024-04-01 22:55:32 -0400
committerConnor Frank <conjfrnk@gmail.com>2024-04-01 22:55:32 -0400
commit5a760fcaeb5e65c5ea7910bf21fff9781817cea1 (patch)
treea74d1956fdccb3f63580b7bd06013cbfbb0994e1
parent394c4e5b4344ad7abd9c7ea082c245cb65124430 (diff)
Add license/contact
-rw-r--r--lib/main.dart8
-rw-r--r--lib/main_menu.dart35
2 files changed, 38 insertions, 5 deletions
diff --git a/lib/main.dart b/lib/main.dart
index 0d6a66c..cb421ae 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,7 +1,13 @@
+C
import 'package:flutter/material.dart';
-import 'package:mini_golf/main_menu.dart';
+import 'package:flutter/services.dart';
+import 'package:mini_golf_scores/main_menu.dart';
void main() {
+ LicenseRegistry.addLicense(() async* {
+ final license = await rootBundle.loadString('LICENSE');
+ yield LicenseEntryWithLineBreaks(['mini_golf_scores'], license);
+ });
runApp(const MiniGolfScoreApp());
}
diff --git a/lib/main_menu.dart b/lib/main_menu.dart
index 1f63bb3..30bd84b 100644
--- a/lib/main_menu.dart
+++ b/lib/main_menu.dart
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
-import 'package:mini_golf/scorekeeper.dart';
+import 'package:mini_golf_scores/scorekeeper.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:package_info_plus/package_info_plus.dart';
@@ -120,8 +120,14 @@ class MainMenu extends StatelessWidget {
children: <Widget>[
const Text('Mini Golf Scorekeeper App'),
const Text('Made by Connor Frank'),
- const Text('Princeton NJ April 2024'),
+ const Text('Princeton NJ'),
+ const Text(''),
Text('Version: $version'), // Display app version
+ const Text(''),
+ const Text('Mini Golf Scores Copyright (C) 2024 Connor Frank'),
+ const Text('This program comes with ABSOLUTELY NO WARRANTY.'),
+ const Text('This is free software, and you are welcome to redistribute it under certain conditions.'),
+ const Text('View \'Licenses\' in main menu for details.'),
// Add more about info here
],
),
@@ -142,9 +148,16 @@ class MainMenu extends StatelessWidget {
),
// License Button
ElevatedButton(
- onPressed: () {
+ onPressed: () async {
+ PackageInfo packageInfo = await PackageInfo.fromPlatform();
+ String version = packageInfo.version;
// Action for License button
- showLicensePage(context: context);
+ showLicensePage(
+ context: context,
+ applicationName: 'Mini Golf Scores',
+ applicationVersion: version,
+ applicationLegalese: '© 2024 Connor Frank'
+ );
},
child: const Text('License'),
),
@@ -165,6 +178,20 @@ class MainMenu extends StatelessWidget {
child: const Text(
'GitHub'), // You can use an Icon instead: Icon(Icons.link)
),
+ ElevatedButton(
+ onPressed: () async {
+ Uri link = Uri(scheme: 'mailto',
+ path: 'conjfrnk+minigolf@gmail.com');
+ if (await canLaunchUrl(link)) {
+ await launchUrl(link);
+ } else {
+ ScaffoldMessenger.of(context).showSnackBar(
+ const SnackBar(content: Text('Could not open GitHub')),
+ );
+ }
+ },
+ child: const Text('Contact'),
+ ),
],
),
const SizedBox(height: 20),