fix: Links now clickable in about dialog, add translations

This commit is contained in:
Anton Stubenbord
2023-04-28 17:55:47 +02:00
parent c58d5809a7
commit 663f1085d3
9 changed files with 123 additions and 31 deletions

View File

@@ -1,3 +1,4 @@
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
@@ -9,6 +10,7 @@ import 'package:paperless_mobile/features/settings/view/settings_page.dart';
import 'package:paperless_mobile/generated/l10n/app_localizations.dart'; import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
import 'package:url_launcher/link.dart'; import 'package:url_launcher/link.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart'; import 'package:url_launcher/url_launcher_string.dart';
class AppDrawer extends StatelessWidget { class AppDrawer extends StatelessWidget {
@@ -42,7 +44,10 @@ class AppDrawer extends StatelessWidget {
leading: const Icon(Icons.bug_report_outlined), leading: const Icon(Icons.bug_report_outlined),
title: Text(S.of(context)!.reportABug), title: Text(S.of(context)!.reportABug),
onTap: () { onTap: () {
launchUrlString('https://github.com/astubenbord/paperless-mobile/issues/new'); launchUrlString(
'https://github.com/astubenbord/paperless-mobile/issues/new',
mode: LaunchMode.externalApplication,
);
}, },
), ),
ListTile( ListTile(
@@ -55,9 +60,21 @@ class AppDrawer extends StatelessWidget {
height: 24, height: 24,
), ),
), ),
title: Text(S.of(context)!.donateCoffee), title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(S.of(context)!.donateCoffee),
Icon(
Icons.open_in_new,
size: 16,
)
],
),
onTap: () { onTap: () {
launchUrlString("https://www.buymeacoffee.com/astubenbord"); launchUrlString(
"https://www.buymeacoffee.com/astubenbord",
mode: LaunchMode.externalApplication,
);
}, },
), ),
ListTile( ListTile(
@@ -91,14 +108,30 @@ class AppDrawer extends StatelessWidget {
applicationVersion: packageInfo.version + '+' + packageInfo.buildNumber, applicationVersion: packageInfo.version + '+' + packageInfo.buildNumber,
children: [ children: [
Text(S.of(context)!.developedBy('Anton Stubenbord')), Text(S.of(context)!.developedBy('Anton Stubenbord')),
Link( const SizedBox(height: 16),
uri: Uri.parse('https://github.com/astubenbord/paperless-mobile'), Text(
builder: (context, followLink) => GestureDetector( "Source Code",
onTap: followLink, style: Theme.of(context).textTheme.titleMedium,
child: Text( ),
'https://github.com/astubenbord/paperless-mobile', RichText(
style: TextStyle(color: Theme.of(context).colorScheme.tertiary), text: TextSpan(
), children: [
TextSpan(
text: S.of(context)!.findTheSourceCodeOn,
),
TextSpan(
text: ' GitHub',
style: const TextStyle(color: Colors.blue),
recognizer: TapGestureRecognizer()
..onTap = () {
launchUrlString(
'https://github.com/astubenbord/paperless-mobile',
mode: LaunchMode.externalApplication,
);
},
),
const TextSpan(text: '.'),
],
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
@@ -112,22 +145,41 @@ class AppDrawer extends StatelessWidget {
} }
Widget _buildOnboardingImageCredits() { Widget _buildOnboardingImageCredits() {
return Link( return RichText(
uri: Uri.parse( text: TextSpan(
'https://www.freepik.com/free-vector/business-team-working-cogwheel-mechanism-together_8270974.htm#query=setting&position=4&from_view=author'),
builder: (context, followLink) => Wrap(
children: [ children: [
const Text('Onboarding images by '), TextSpan(
GestureDetector( text: 'Onboarding images by ',
onTap: followLink, ),
child: Text( TextSpan(
'pch.vector', text: 'pch.vector',
style: TextStyle(color: Theme.of(context).colorScheme.tertiary), style: TextStyle(color: Colors.blue),
), recognizer: TapGestureRecognizer()
..onTap = () {
launchUrlString(
'https://www.freepik.com/free-vector/business-team-working-cogwheel-mechanism-together_8270974.htm#query=setting&position=4&from_view=author');
},
),
TextSpan(
text: ' on Freepik.',
), ),
const Text(' on Freepik.')
], ],
), ),
); );
} }
} }
//Wrap(
// children: [
// const Text('Onboarding images by '),
// GestureDetector(
// onTap: followLink,
// child: RichText(
// 'pch.vector',
// style: TextStyle(color: Colors.blue),
// ),
// ),
// const Text(' on Freepik.')
// ],
// )

View File

@@ -1,5 +1,5 @@
{ {
"developedBy": "Desenvolupat per {name}", "developedBy": "Desenvolupat per {name}.",
"@developedBy": { "@developedBy": {
"placeholders": { "placeholders": {
"name": {} "name": {}
@@ -761,5 +761,10 @@
"switchToNewAccount": "Vols canviar al nou compte? Pots canviar en qualsevol moment.", "switchToNewAccount": "Vols canviar al nou compte? Pots canviar en qualsevol moment.",
"@switchToNewAccount": { "@switchToNewAccount": {
"description": "Content of the dialog shown after adding an account, asking the user whether to switch to the newly added account or not." "description": "Content of the dialog shown after adding an account, asking the user whether to switch to the newly added account or not."
},
"sourceCode": "Source Code",
"findTheSourceCodeOn": "Find the source code on",
"@findTheSourceCodeOn": {
"description": "Text before link to Paperless Mobile GitHub"
} }
} }

View File

@@ -1,5 +1,5 @@
{ {
"developedBy": "Vyvíjí {name}", "developedBy": "Vyvíjí {name}.",
"@developedBy": { "@developedBy": {
"placeholders": { "placeholders": {
"name": {} "name": {}
@@ -761,5 +761,10 @@
"switchToNewAccount": "Do you want to switch to the new account? You can switch back at any time.", "switchToNewAccount": "Do you want to switch to the new account? You can switch back at any time.",
"@switchToNewAccount": { "@switchToNewAccount": {
"description": "Content of the dialog shown after adding an account, asking the user whether to switch to the newly added account or not." "description": "Content of the dialog shown after adding an account, asking the user whether to switch to the newly added account or not."
},
"sourceCode": "Source Code",
"findTheSourceCodeOn": "Find the source code on",
"@findTheSourceCodeOn": {
"description": "Text before link to Paperless Mobile GitHub"
} }
} }

View File

@@ -1,5 +1,5 @@
{ {
"developedBy": "Entwickelt von {name}", "developedBy": "Entwickelt von {name}.",
"@developedBy": { "@developedBy": {
"placeholders": { "placeholders": {
"name": {} "name": {}
@@ -761,5 +761,10 @@
"switchToNewAccount": "Möchtest du zum neuen Account wechseln? Du kannst jederzeit zurückwechseln.", "switchToNewAccount": "Möchtest du zum neuen Account wechseln? Du kannst jederzeit zurückwechseln.",
"@switchToNewAccount": { "@switchToNewAccount": {
"description": "Content of the dialog shown after adding an account, asking the user whether to switch to the newly added account or not." "description": "Content of the dialog shown after adding an account, asking the user whether to switch to the newly added account or not."
},
"sourceCode": "Source Code",
"findTheSourceCodeOn": "Finde den Code auf",
"@findTheSourceCodeOn": {
"description": "Text before link to Paperless Mobile GitHub"
} }
} }

View File

@@ -1,5 +1,5 @@
{ {
"developedBy": "Developed by {name}", "developedBy": "Developed by {name}.",
"@developedBy": { "@developedBy": {
"placeholders": { "placeholders": {
"name": {} "name": {}
@@ -761,5 +761,10 @@
"switchToNewAccount": "Do you want to switch to the new account? You can switch back at any time.", "switchToNewAccount": "Do you want to switch to the new account? You can switch back at any time.",
"@switchToNewAccount": { "@switchToNewAccount": {
"description": "Content of the dialog shown after adding an account, asking the user whether to switch to the newly added account or not." "description": "Content of the dialog shown after adding an account, asking the user whether to switch to the newly added account or not."
},
"sourceCode": "Source Code",
"findTheSourceCodeOn": "Find the source code on",
"@findTheSourceCodeOn": {
"description": "Text before link to Paperless Mobile GitHub"
} }
} }

View File

@@ -1,5 +1,5 @@
{ {
"developedBy": "Développé par {name}", "developedBy": "Développé par {name}.",
"@developedBy": { "@developedBy": {
"placeholders": { "placeholders": {
"name": {} "name": {}
@@ -761,5 +761,10 @@
"switchToNewAccount": "Do you want to switch to the new account? You can switch back at any time.", "switchToNewAccount": "Do you want to switch to the new account? You can switch back at any time.",
"@switchToNewAccount": { "@switchToNewAccount": {
"description": "Content of the dialog shown after adding an account, asking the user whether to switch to the newly added account or not." "description": "Content of the dialog shown after adding an account, asking the user whether to switch to the newly added account or not."
},
"sourceCode": "Source Code",
"findTheSourceCodeOn": "Find the source code on",
"@findTheSourceCodeOn": {
"description": "Text before link to Paperless Mobile GitHub"
} }
} }

View File

@@ -1,5 +1,5 @@
{ {
"developedBy": "Stworzone przez {name}", "developedBy": "Stworzone przez {name}.",
"@developedBy": { "@developedBy": {
"placeholders": { "placeholders": {
"name": {} "name": {}
@@ -761,5 +761,10 @@
"switchToNewAccount": "Do you want to switch to the new account? You can switch back at any time.", "switchToNewAccount": "Do you want to switch to the new account? You can switch back at any time.",
"@switchToNewAccount": { "@switchToNewAccount": {
"description": "Content of the dialog shown after adding an account, asking the user whether to switch to the newly added account or not." "description": "Content of the dialog shown after adding an account, asking the user whether to switch to the newly added account or not."
},
"sourceCode": "Source Code",
"findTheSourceCodeOn": "Find the source code on",
"@findTheSourceCodeOn": {
"description": "Text before link to Paperless Mobile GitHub"
} }
} }

View File

@@ -1,5 +1,5 @@
{ {
"developedBy": "Разработано {name}", "developedBy": "Разработано {name}.",
"@developedBy": { "@developedBy": {
"placeholders": { "placeholders": {
"name": {} "name": {}
@@ -761,5 +761,10 @@
"switchToNewAccount": "Do you want to switch to the new account? You can switch back at any time.", "switchToNewAccount": "Do you want to switch to the new account? You can switch back at any time.",
"@switchToNewAccount": { "@switchToNewAccount": {
"description": "Content of the dialog shown after adding an account, asking the user whether to switch to the newly added account or not." "description": "Content of the dialog shown after adding an account, asking the user whether to switch to the newly added account or not."
},
"sourceCode": "Source Code",
"findTheSourceCodeOn": "Find the source code on",
"@findTheSourceCodeOn": {
"description": "Text before link to Paperless Mobile GitHub"
} }
} }

View File

@@ -1,5 +1,5 @@
{ {
"developedBy": "Developed by {name}", "developedBy": "Developed by {name}.",
"@developedBy": { "@developedBy": {
"placeholders": { "placeholders": {
"name": {} "name": {}
@@ -761,5 +761,10 @@
"switchToNewAccount": "Do you want to switch to the new account? You can switch back at any time.", "switchToNewAccount": "Do you want to switch to the new account? You can switch back at any time.",
"@switchToNewAccount": { "@switchToNewAccount": {
"description": "Content of the dialog shown after adding an account, asking the user whether to switch to the newly added account or not." "description": "Content of the dialog shown after adding an account, asking the user whether to switch to the newly added account or not."
},
"sourceCode": "Source Code",
"findTheSourceCodeOn": "Find the source code on",
"@findTheSourceCodeOn": {
"description": "Text before link to Paperless Mobile GitHub"
} }
} }