learn more updates

This commit is contained in:
Adam Velebil 2023-02-22 11:27:05 +01:00
parent 68411efbd8
commit bfd0f91c14
No known key found for this signature in database
GPG Key ID: C9B1E4A3CBBD2E10

View File

@ -15,6 +15,7 @@
*/ */
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
@ -39,25 +40,15 @@ class IconPackDialog extends ConsumerWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
const Text('By loading an external icon pack, the avatar icons ' RichText(
'of the accounts will be easier to distinguish through the issuers ' text: TextSpan(
'familiar logos and colors.\n\n' text: 'Icon packs can make your accounts more easily '
'Read more about how to create or obtain a compatible icon pack ' 'distinguishable with familiar logos and colors. ',
'by clicking the link from below.'), style: TextStyle(color: theme.textTheme.bodySmall?.color),
TextButton( children: [_createLearnMoreLink(context, [])],
child: const Text(
'Icon pack support',
style: TextStyle(decoration: TextDecoration.none),
), ),
onPressed: () async {
await launchUrl(
Uri.parse(
'https://github.com/Yubico/yubioath-flutter/tree/main/doc'),
mode: LaunchMode.externalApplication,
);
},
), ),
const SizedBox(height: 8), const SizedBox(height: 4),
Wrap( Wrap(
spacing: 4.0, spacing: 4.0,
runSpacing: 8.0, runSpacing: 8.0,
@ -67,9 +58,7 @@ class IconPackDialog extends ConsumerWidget {
await _importIconPack(context, ref); await _importIconPack(context, ref);
}, },
avatar: const Icon(Icons.download_outlined, size: 16), avatar: const Icon(Icons.download_outlined, size: 16),
label: hasIconPack label: const Text('Load icon pack')),
? const Text('Load icon pack')
: const Text('Load icon pack')),
if (hasIconPack) if (hasIconPack)
ActionChip( ActionChip(
onPressed: () async { onPressed: () async {
@ -90,7 +79,7 @@ class IconPackDialog extends ConsumerWidget {
label: const Text('Remove icon pack')) label: const Text('Remove icon pack'))
], ],
), ),
const SizedBox(height: 16), const SizedBox(height: 8),
if (hasIconPack) if (hasIconPack)
Text( Text(
'Current: ${packManager.iconPackName} (version: ${packManager.iconPackVersion})', 'Current: ${packManager.iconPackName} (version: ${packManager.iconPackVersion})',
@ -132,4 +121,22 @@ class IconPackDialog extends ConsumerWidget {
return false; return false;
} }
TextSpan _createLearnMoreLink(
BuildContext context, List<InlineSpan>? children) {
final theme = Theme.of(context);
return TextSpan(
text: 'Learn\u00a0more',
style: TextStyle(color: theme.primaryColor),
recognizer: TapGestureRecognizer()
..onTap = () async {
await launchUrl(
Uri.parse(
'https://github.com/Yubico/yubioath-flutter/tree/main/doc'),
mode: LaunchMode.externalApplication,
);
},
children: children,
);
}
} }