diff --git a/lib/about_screen.dart b/lib/about_screen.dart new file mode 100644 index 0000000..589c32c --- /dev/null +++ b/lib/about_screen.dart @@ -0,0 +1,112 @@ +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:url_launcher/url_launcher.dart' as url; + +import 'localizations.dart'; + +class AboutScreen extends StatelessWidget { + static const _email = 'mailto:johrpan@gmail.com?subject=Memor'; + static const _license = 'https://www.gnu.org/licenses/gpl-3.0.html'; + static const _github = 'https://github.com/johrpan/memor'; + + @override + Widget build(BuildContext context) { + final l10n = MemorLocalizations.of(context); + final theme = Theme.of(context); + + return Scaffold( + appBar: AppBar( + title: Text(l10n.about), + ), + body: ListView( + padding: const EdgeInsets.all(16.0), + children: [ + Text( + l10n.introTitle, + style: theme.textTheme.headline6, + ), + SizedBox( + height: 12.0, + ), + Text(l10n.intro), + SizedBox( + height: 24.0, + ), + Text( + l10n.contactTitle, + style: theme.textTheme.headline6, + ), + SizedBox( + height: 12.0, + ), + RichText( + text: TextSpan( + style: theme.textTheme.bodyText1, + children: [ + TextSpan( + text: l10n.contact1, + ), + TextSpan( + text: l10n.contact2, + style: theme.textTheme.bodyText1.copyWith( + color: Colors.amber[700], + decoration: TextDecoration.underline, + ), + recognizer: TapGestureRecognizer() + ..onTap = () => url.launch(_email), + ), + TextSpan( + text: l10n.contact3, + ), + TextSpan( + text: l10n.contact4, + style: theme.textTheme.bodyText1.copyWith( + color: Colors.amber[700], + decoration: TextDecoration.underline, + ), + recognizer: TapGestureRecognizer() + ..onTap = () => url.launch(_github), + ), + TextSpan( + text: l10n.contact5, + ), + ], + ), + ), + SizedBox( + height: 24.0, + ), + Text( + l10n.licenseTitle, + style: theme.textTheme.headline6, + ), + SizedBox( + height: 12.0, + ), + RichText( + text: TextSpan( + style: theme.textTheme.bodyText1, + children: [ + TextSpan( + text: l10n.license1, + ), + TextSpan( + text: l10n.license2, + style: theme.textTheme.bodyText1.copyWith( + color: Colors.amber[700], + decoration: TextDecoration.underline, + ), + recognizer: TapGestureRecognizer() + ..onTap = () => url.launch(_license), + ), + TextSpan( + text: l10n.license3, + ), + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/home_screen.dart b/lib/home_screen.dart index 5db4c21..04ec2f1 100644 --- a/lib/home_screen.dart +++ b/lib/home_screen.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; +import 'about_screen.dart'; import 'backend.dart'; import 'date_utils.dart'; import 'localizations.dart'; @@ -31,6 +32,26 @@ class HomeScreen extends StatelessWidget { return Scaffold( appBar: AppBar( title: Text(l10n.title), + actions: [ + PopupMenuButton( + itemBuilder: (context) => [ + PopupMenuItem( + value: 0, + child: Text(l10n.about), + ), + ], + onSelected: (value) { + if (value == 0) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AboutScreen(), + ), + ); + } + }, + ), + ], ), body: backend.loading ? Center( diff --git a/lib/localizations.dart b/lib/localizations.dart index c44f8d8..4321c64 100644 --- a/lib/localizations.dart +++ b/lib/localizations.dart @@ -23,6 +23,41 @@ class MemorLocalizations { String get noReminders => de ? 'Keine Erinnerungen eingerichtet' : 'No reminders scheduled'; + // About screen + + String get about => de ? 'Über Memor' : 'About Memor'; + String get introTitle => de ? 'Einführung' : 'Introduction'; + String get intro => de + ? 'Memor ist eine Anwendung, die Sie zu bestimmten Zeiten mit einer ' + 'Benachrichtigung an etwas erinnern kann. Sie wurde mit dem Ziel ' + 'entwickelt möglichst einfach, schlicht und elegant zu sein.' + : 'Memor is an app for getting reminders at a specified time via a ' + 'notification. It was developed with the goal to be as simple and ' + 'elegant as possible.'; + String get licenseTitle => de ? 'Lizenz' : 'License'; + String get license1 => '© 2020 Elias Projahn\n\n' + 'This program is free software: you can redistribute it and/or modify it ' + 'under the terms of the GNU General Public License as published by the ' + 'Free Software Foundation, either version 3 of the License, or (at your ' + 'option) any later version.\n\nThis program is distributed in the hope ' + 'that it will be useful, but WITHOUT ANY WARRANTY; without even the ' + 'implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ' + 'PURPOSE. See the '; + String get license2 => 'GNU General Public License'; + String get license3 => ' for more details.'; + String get contactTitle => de ? 'Kontakt' : 'Contact'; + String get contact1 => de + ? 'Für Fragen, Fehlermeldungen, Anregungen etc. können Sie mich gerne ' + : 'Feel free to contact me '; + String get contact2 => de ? 'per E-Mail' : 'via E-mail'; + String get contact3 => de + ? ' kontaktieren. Memor ist freie Software. Sie können bei ' + : ' for questions, bug reports, ideas etc. Memor is free software. You ' + 'can study the source code and contribute on '; + String get contact4 => 'GitHub'; + String get contact5 => + de ? ' den Quellcode studieren und zur Entwicklung beitragen.' : '.'; + // Memo editor String get editTitle => de ? 'Memo bearbeiten' : 'Edit memo'; diff --git a/pubspec.yaml b/pubspec.yaml index bccb255..9ebc4b2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,6 +16,7 @@ dependencies: path: path_provider: rxdart: + url_launcher: flutter: uses-material-design: true