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_bloc/flutter_bloc.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:url_launcher/link.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
class AppDrawer extends StatelessWidget {
@@ -42,7 +44,10 @@ class AppDrawer extends StatelessWidget {
leading: const Icon(Icons.bug_report_outlined),
title: Text(S.of(context)!.reportABug),
onTap: () {
launchUrlString('https://github.com/astubenbord/paperless-mobile/issues/new');
launchUrlString(
'https://github.com/astubenbord/paperless-mobile/issues/new',
mode: LaunchMode.externalApplication,
);
},
),
ListTile(
@@ -55,9 +60,21 @@ class AppDrawer extends StatelessWidget {
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: () {
launchUrlString("https://www.buymeacoffee.com/astubenbord");
launchUrlString(
"https://www.buymeacoffee.com/astubenbord",
mode: LaunchMode.externalApplication,
);
},
),
ListTile(
@@ -91,14 +108,30 @@ class AppDrawer extends StatelessWidget {
applicationVersion: packageInfo.version + '+' + packageInfo.buildNumber,
children: [
Text(S.of(context)!.developedBy('Anton Stubenbord')),
Link(
uri: Uri.parse('https://github.com/astubenbord/paperless-mobile'),
builder: (context, followLink) => GestureDetector(
onTap: followLink,
child: Text(
'https://github.com/astubenbord/paperless-mobile',
style: TextStyle(color: Theme.of(context).colorScheme.tertiary),
const SizedBox(height: 16),
Text(
"Source Code",
style: Theme.of(context).textTheme.titleMedium,
),
RichText(
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),
@@ -112,22 +145,41 @@ class AppDrawer extends StatelessWidget {
}
Widget _buildOnboardingImageCredits() {
return Link(
uri: Uri.parse(
'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(
return RichText(
text: TextSpan(
children: [
const Text('Onboarding images by '),
GestureDetector(
onTap: followLink,
child: Text(
'pch.vector',
style: TextStyle(color: Theme.of(context).colorScheme.tertiary),
TextSpan(
text: 'Onboarding images by ',
),
TextSpan(
text: 'pch.vector',
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": {
"placeholders": {
"name": {}
@@ -761,5 +761,10 @@
"switchToNewAccount": "Vols canviar al nou compte? Pots canviar en qualsevol moment.",
"@switchToNewAccount": {
"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": {
"placeholders": {
"name": {}
@@ -761,5 +761,10 @@
"switchToNewAccount": "Do you want to switch to the new account? You can switch back at any time.",
"@switchToNewAccount": {
"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": {
"placeholders": {
"name": {}
@@ -761,5 +761,10 @@
"switchToNewAccount": "Möchtest du zum neuen Account wechseln? Du kannst jederzeit zurückwechseln.",
"@switchToNewAccount": {
"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": {
"placeholders": {
"name": {}
@@ -761,5 +761,10 @@
"switchToNewAccount": "Do you want to switch to the new account? You can switch back at any time.",
"@switchToNewAccount": {
"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": {
"placeholders": {
"name": {}
@@ -761,5 +761,10 @@
"switchToNewAccount": "Do you want to switch to the new account? You can switch back at any time.",
"@switchToNewAccount": {
"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": {
"placeholders": {
"name": {}
@@ -761,5 +761,10 @@
"switchToNewAccount": "Do you want to switch to the new account? You can switch back at any time.",
"@switchToNewAccount": {
"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": {
"placeholders": {
"name": {}
@@ -761,5 +761,10 @@
"switchToNewAccount": "Do you want to switch to the new account? You can switch back at any time.",
"@switchToNewAccount": {
"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": {
"placeholders": {
"name": {}
@@ -761,5 +761,10 @@
"switchToNewAccount": "Do you want to switch to the new account? You can switch back at any time.",
"@switchToNewAccount": {
"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"
}
}