diff --git a/catalyst_voices/apps/voices/lib/common/constants/constants.dart b/catalyst_voices/apps/voices/lib/common/constants/constants.dart new file mode 100644 index 00000000000..60b46b0e51c --- /dev/null +++ b/catalyst_voices/apps/voices/lib/common/constants/constants.dart @@ -0,0 +1,5 @@ +abstract class VoicesConstants { + /// External urls + static const String supportedWalletsUrl = + 'https://docs.projectcatalyst.io/current-fund/voter-registration/supported-wallets'; +} diff --git a/catalyst_voices/apps/voices/lib/common/ext/string_ext.dart b/catalyst_voices/apps/voices/lib/common/ext/string_ext.dart index 18bd350b97f..9349c7dd7e1 100644 --- a/catalyst_voices/apps/voices/lib/common/ext/string_ext.dart +++ b/catalyst_voices/apps/voices/lib/common/ext/string_ext.dart @@ -7,3 +7,9 @@ extension StringExt on String { } } } + +extension UrlParser on String { + Uri getUri() { + return Uri.parse(this); + } +} diff --git a/catalyst_voices/apps/voices/lib/pages/registration/wallet_link/stage/select_wallet_panel.dart b/catalyst_voices/apps/voices/lib/pages/registration/wallet_link/stage/select_wallet_panel.dart index 45cceabc556..c89d80dd7e6 100644 --- a/catalyst_voices/apps/voices/lib/pages/registration/wallet_link/stage/select_wallet_panel.dart +++ b/catalyst_voices/apps/voices/lib/pages/registration/wallet_link/stage/select_wallet_panel.dart @@ -1,5 +1,7 @@ import 'dart:async'; +import 'package:catalyst_voices/common/constants/constants.dart'; +import 'package:catalyst_voices/common/ext/string_ext.dart'; import 'package:catalyst_voices/pages/registration/wallet_link/bloc_wallet_link_builder.dart'; import 'package:catalyst_voices/pages/registration/widgets/registration_stage_message.dart'; import 'package:catalyst_voices/widgets/common/infrastructure/voices_result_builder.dart'; @@ -11,6 +13,7 @@ import 'package:catalyst_voices_models/catalyst_voices_models.dart'; import 'package:catalyst_voices_shared/catalyst_voices_shared.dart'; import 'package:flutter/material.dart'; import 'package:result_type/result_type.dart'; +import 'package:url_launcher/url_launcher.dart'; /// Callback called when a [wallet] is selected. typedef _OnSelectWallet = Future Function(WalletMetadata wallet); @@ -57,7 +60,7 @@ class _SelectWalletPanelState extends State { const SizedBox(height: 10), VoicesTextButton( trailing: VoicesAssets.icons.externalLink.buildIcon(), - onTap: () {}, + onTap: () async => _launchSupportedWalletsLink(), child: Text(context.l10n.seeAllSupportedWallets), ), ], @@ -76,6 +79,13 @@ class _SelectWalletPanelState extends State { registration.nextStep(); } } + + Future _launchSupportedWalletsLink() async { + final url = VoicesConstants.supportedWalletsUrl.getUri(); + if (!await launchUrl(url)) { + throw Exception('Could not launch $url'); + } + } } class _BlocWallets extends StatelessWidget {