From c1bbf1a316a6763e61dadeb9c1db592f982b5b69 Mon Sep 17 00:00:00 2001 From: Dominik Toton <166132265+dtscalac@users.noreply.github.com> Date: Wed, 25 Sep 2024 09:35:37 +0200 Subject: [PATCH 1/2] fix: samples (#880) --- .../catalyst_cardano/catalyst_cardano/README.md | 2 +- .../catalyst_cardano_serialization/README.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/catalyst_voices_packages/catalyst_cardano/catalyst_cardano/README.md b/catalyst_voices_packages/catalyst_cardano/catalyst_cardano/README.md index af110d7dab..3a1ec3c2ff 100644 --- a/catalyst_voices_packages/catalyst_cardano/catalyst_cardano/README.md +++ b/catalyst_voices_packages/catalyst_cardano/catalyst_cardano/README.md @@ -123,7 +123,7 @@ Transaction _buildUnsignedTx({ final txOutput = TransactionOutput( address: preprodFaucetAddress, - amount: const Value(coin: Coin(1000000)), + amount: const Balance(coin: Coin(1000000)), ); final txBuilder = TransactionBuilder( diff --git a/catalyst_voices_packages/catalyst_cardano_serialization/README.md b/catalyst_voices_packages/catalyst_cardano_serialization/README.md index 8188f53185..e9c6c10e71 100644 --- a/catalyst_voices_packages/catalyst_cardano_serialization/README.md +++ b/catalyst_voices_packages/catalyst_cardano_serialization/README.md @@ -91,7 +91,7 @@ void main() { 'addr_test1qpu5vlrf4xkxv2qpwngf6cjhtw542ayty80v8dyr49rf5ewvxwdrt70' 'qlcpeeagscasafhffqsxy36t90ldv06wqrk2qum8x5w', ), - amount: const Value(coin: Coin(10162333)), + amount: const Balance(coin: Coin(10162333)), ), ); @@ -99,12 +99,12 @@ void main() { address: ShelleyAddress.fromBech32( 'addr_test1vzpwq95z3xyum8vqndgdd9mdnmafh3djcxnc6jemlgdmswcve6tkw', ), - amount: const Value(coin: Coin(1000000)), + amount: const Balance(coin: Coin(1000000)), ); final txBuilder = TransactionBuilder( config: txBuilderConfig, - inputs: [utxo], + inputs: {utxo}, // fee can be left empty so that it's auto calculated or can be hardcoded // fee: const Coin(1000000), ttl: const SlotBigNum(410021), From 77062753069d920a80c2f062c40477c7f9be353c Mon Sep 17 00:00:00 2001 From: Dominik Toton <166132265+dtscalac@users.noreply.github.com> Date: Wed, 25 Sep 2024 10:07:06 +0200 Subject: [PATCH 2/2] feat(cat-voices): wallet link flow structure (#877) * feat: add link wallet flow structure * fix(cat-voices): typo * feat: add content for link wallet intro dialog * feat(cat-voices): add picture * refactor(cat-voices): cleanup * refactor(cat-voices): make link wallet dialog private, move learn more button --- .../intro/link_wallet_intro_dialog.dart | 62 +++++++++++++++++++ .../link_wallet/link_wallet_dialog.dart | 50 +++++++++++++++ .../link_wallet/link_wallet_stage.dart | 8 +++ .../select_wallet/select_wallet_dialog.dart | 25 ++++++++ .../lib/widgets/buttons/voices_buttons.dart | 21 +++++++ .../lib/src/themes/catalyst.dart | 1 + .../catalyst_voices_localizations.dart | 36 +++++++++++ .../catalyst_voices_localizations_en.dart | 18 ++++++ .../catalyst_voices_localizations_es.dart | 18 ++++++ .../lib/l10n/intl_en.arb | 24 +++++++ 10 files changed, 263 insertions(+) create mode 100644 catalyst_voices/lib/pages/registration/link_wallet/intro/link_wallet_intro_dialog.dart create mode 100644 catalyst_voices/lib/pages/registration/link_wallet/link_wallet_dialog.dart create mode 100644 catalyst_voices/lib/pages/registration/link_wallet/link_wallet_stage.dart create mode 100644 catalyst_voices/lib/pages/registration/link_wallet/select_wallet/select_wallet_dialog.dart diff --git a/catalyst_voices/lib/pages/registration/link_wallet/intro/link_wallet_intro_dialog.dart b/catalyst_voices/lib/pages/registration/link_wallet/intro/link_wallet_intro_dialog.dart new file mode 100644 index 0000000000..066cc83863 --- /dev/null +++ b/catalyst_voices/lib/pages/registration/link_wallet/intro/link_wallet_intro_dialog.dart @@ -0,0 +1,62 @@ +import 'package:catalyst_voices/pages/account/creation/task_picture.dart'; +import 'package:catalyst_voices/widgets/widgets.dart'; +import 'package:catalyst_voices_assets/catalyst_voices_assets.dart'; +import 'package:catalyst_voices_localization/catalyst_voices_localization.dart'; +import 'package:flutter/material.dart'; + +/// The initial screen for the link wallet flow during registration. +class LinkWalletIntroDialog extends StatelessWidget { + final VoidCallback onSelectWallet; + + const LinkWalletIntroDialog({ + super.key, + required this.onSelectWallet, + }); + + @override + Widget build(BuildContext context) { + return VoicesDesktopPanelsDialog( + left: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.walletLink_header, + style: Theme.of(context).textTheme.titleLarge, + ), + const SizedBox(height: 12), + Text( + context.l10n.walletLink_subheader, + style: Theme.of(context).textTheme.titleMedium, + ), + const SizedBox(height: 50), + const TaskKeychainPicture(), + const Spacer(), + VoicesLearnMoreButton( + onTap: () {}, + ), + ], + ), + right: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const SizedBox(height: 24), + Text( + context.l10n.walletLink_intro_title, + style: Theme.of(context).textTheme.titleMedium, + ), + const SizedBox(height: 24), + Text( + context.l10n.walletLink_intro_content, + style: Theme.of(context).textTheme.bodyMedium, + ), + const Spacer(), + VoicesFilledButton( + leading: VoicesAssets.icons.wallet.buildIcon(), + onTap: onSelectWallet, + child: Text(context.l10n.chooseCardanoWallet), + ), + ], + ), + ); + } +} diff --git a/catalyst_voices/lib/pages/registration/link_wallet/link_wallet_dialog.dart b/catalyst_voices/lib/pages/registration/link_wallet/link_wallet_dialog.dart new file mode 100644 index 0000000000..edfd4312ec --- /dev/null +++ b/catalyst_voices/lib/pages/registration/link_wallet/link_wallet_dialog.dart @@ -0,0 +1,50 @@ +import 'package:catalyst_cardano/catalyst_cardano.dart'; +import 'package:catalyst_voices/pages/registration/link_wallet/intro/link_wallet_intro_dialog.dart'; +import 'package:catalyst_voices/pages/registration/link_wallet/link_wallet_stage.dart'; +import 'package:catalyst_voices/pages/registration/link_wallet/select_wallet/select_wallet_dialog.dart'; +import 'package:catalyst_voices/widgets/modals/voices_dialog.dart'; +import 'package:flutter/material.dart'; + +/// The link wallet flow consisting +/// of [LinkWalletStage]'s during the registration. +class LinkWalletDialog extends StatefulWidget { + const LinkWalletDialog._(); + + /// Shows the [LinkWalletDialog] flow. + static Future show({required BuildContext context}) { + return VoicesDialog.show( + context: context, + routeSettings: const RouteSettings(name: '/register/link-wallet'), + builder: (context) => const LinkWalletDialog._(), + ); + } + + @override + State createState() => _LinkWalletDialogState(); +} + +class _LinkWalletDialogState extends State { + LinkWalletStage _stage = LinkWalletStage.intro; + + @override + Widget build(BuildContext context) { + return switch (_stage) { + LinkWalletStage.intro => LinkWalletIntroDialog( + onSelectWallet: _onSelectWallet, + ), + LinkWalletStage.selectWallet => SelectWalletDialog( + onSelectedWallet: _onSelectedWallet, + ), + }; + } + + void _onSelectWallet() { + setState(() { + _stage = LinkWalletStage.selectWallet; + }); + } + + void _onSelectedWallet(CardanoWallet wallet) { + // TODO(dtscalac): store selected wallet and proceed to next stage + } +} diff --git a/catalyst_voices/lib/pages/registration/link_wallet/link_wallet_stage.dart b/catalyst_voices/lib/pages/registration/link_wallet/link_wallet_stage.dart new file mode 100644 index 0000000000..4ca59a842e --- /dev/null +++ b/catalyst_voices/lib/pages/registration/link_wallet/link_wallet_stage.dart @@ -0,0 +1,8 @@ +/// Describes the link wallet flow during registration. +enum LinkWalletStage { + /// The welcome screen for the link wallet flow. + intro, + + /// A screen where the user is asked to connect the cardano wallet. + selectWallet, +} diff --git a/catalyst_voices/lib/pages/registration/link_wallet/select_wallet/select_wallet_dialog.dart b/catalyst_voices/lib/pages/registration/link_wallet/select_wallet/select_wallet_dialog.dart new file mode 100644 index 0000000000..6799dafcff --- /dev/null +++ b/catalyst_voices/lib/pages/registration/link_wallet/select_wallet/select_wallet_dialog.dart @@ -0,0 +1,25 @@ +import 'package:catalyst_cardano/catalyst_cardano.dart'; +import 'package:catalyst_voices/widgets/widgets.dart'; +import 'package:flutter/material.dart'; + +// TODO(dtscalac): add content for the screen +class SelectWalletDialog extends StatelessWidget { + final ValueChanged onSelectedWallet; + + const SelectWalletDialog({ + super.key, + required this.onSelectedWallet, + }); + + @override + Widget build(BuildContext context) { + return const VoicesDesktopPanelsDialog( + left: Column( + children: [], + ), + right: Column( + children: [], + ), + ); + } +} diff --git a/catalyst_voices/lib/widgets/buttons/voices_buttons.dart b/catalyst_voices/lib/widgets/buttons/voices_buttons.dart index 1d9cba19a1..a12419eb16 100644 --- a/catalyst_voices/lib/widgets/buttons/voices_buttons.dart +++ b/catalyst_voices/lib/widgets/buttons/voices_buttons.dart @@ -1,7 +1,9 @@ import 'dart:async'; import 'package:catalyst_voices/widgets/buttons/voices_icon_button.dart'; +import 'package:catalyst_voices/widgets/buttons/voices_text_button.dart'; import 'package:catalyst_voices_assets/catalyst_voices_assets.dart'; +import 'package:catalyst_voices_localization/catalyst_voices_localization.dart'; import 'package:flutter/material.dart'; class DrawerToggleButton extends StatelessWidget { @@ -146,3 +148,22 @@ class MoreOptionsButton extends StatelessWidget { ); } } + +/// A "Learn More" button that redirects usually to an external content. +class VoicesLearnMoreButton extends StatelessWidget { + final VoidCallback onTap; + + const VoicesLearnMoreButton({ + super.key, + required this.onTap, + }); + + @override + Widget build(BuildContext context) { + return VoicesTextButton( + trailing: VoicesAssets.icons.externalLink.buildIcon(), + onTap: onTap, + child: Text(context.l10n.learnMore), + ); + } +} diff --git a/catalyst_voices/packages/catalyst_voices_brands/lib/src/themes/catalyst.dart b/catalyst_voices/packages/catalyst_voices_brands/lib/src/themes/catalyst.dart index 1e76d0c85a..4c4c7efd64 100644 --- a/catalyst_voices/packages/catalyst_voices_brands/lib/src/themes/catalyst.dart +++ b/catalyst_voices/packages/catalyst_voices_brands/lib/src/themes/catalyst.dart @@ -302,6 +302,7 @@ ThemeData _buildThemeData( final textTheme = _buildTextTheme(voicesColorScheme); return ThemeData( + visualDensity: VisualDensity.standard, appBarTheme: AppBarTheme( backgroundColor: voicesColorScheme.onSurfaceNeutralOpaqueLv1, scrolledUnderElevation: 0, diff --git a/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations.dart b/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations.dart index 1105d7c665..cf70a944c9 100644 --- a/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations.dart +++ b/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations.dart @@ -663,6 +663,42 @@ abstract class VoicesLocalizations { /// In en, this message translates to: /// **'Good password strength'** String get goodPasswordStrength; + + /// A button label to select a cardano wallet. + /// + /// In en, this message translates to: + /// **'Choose Cardano Wallet'** + String get chooseCardanoWallet; + + /// A label on a clickable element that can show more content. + /// + /// In en, this message translates to: + /// **'Learn More'** + String get learnMore; + + /// A header in link wallet flow in registration. + /// + /// In en, this message translates to: + /// **'Link keys to your Catalyst Keychain'** + String get walletLink_header; + + /// A subheader in link wallet flow in registration. + /// + /// In en, this message translates to: + /// **'Link your Cardano wallet'** + String get walletLink_subheader; + + /// A title in link wallet flow on intro screen. + /// + /// In en, this message translates to: + /// **'Link Cardano Wallet & Catalyst Roles to you Catalyst Keychain.'** + String get walletLink_intro_title; + + /// A message (content) in link wallet flow on intro screen. + /// + /// In en, this message translates to: + /// **'You\'re almost there! This is the final and most important step in your account setup.\n\nWe\'re going to link a Cardano Wallet to your Catalyst Keychain, so you can start collecting Role Keys.\n\nRole Keys allow you to enter new spaces, discover new ways to participate, and unlock new ways to earn rewards.\n\nWe\'ll start with your Voter Key by default. You can decide to add a Proposer Key and Drep key if you want, or you can always add them later.'** + String get walletLink_intro_content; } class _VoicesLocalizationsDelegate extends LocalizationsDelegate { diff --git a/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations_en.dart b/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations_en.dart index b4ae93ae36..08a982619f 100644 --- a/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations_en.dart +++ b/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations_en.dart @@ -345,4 +345,22 @@ class VoicesLocalizationsEn extends VoicesLocalizations { @override String get goodPasswordStrength => 'Good password strength'; + + @override + String get chooseCardanoWallet => 'Choose Cardano Wallet'; + + @override + String get learnMore => 'Learn More'; + + @override + String get walletLink_header => 'Link keys to your Catalyst Keychain'; + + @override + String get walletLink_subheader => 'Link your Cardano wallet'; + + @override + String get walletLink_intro_title => 'Link Cardano Wallet & Catalyst Roles to you Catalyst Keychain.'; + + @override + String get walletLink_intro_content => 'You\'re almost there! This is the final and most important step in your account setup.\n\nWe\'re going to link a Cardano Wallet to your Catalyst Keychain, so you can start collecting Role Keys.\n\nRole Keys allow you to enter new spaces, discover new ways to participate, and unlock new ways to earn rewards.\n\nWe\'ll start with your Voter Key by default. You can decide to add a Proposer Key and Drep key if you want, or you can always add them later.'; } diff --git a/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations_es.dart b/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations_es.dart index 734ef69842..33a5b51913 100644 --- a/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations_es.dart +++ b/catalyst_voices/packages/catalyst_voices_localization/lib/generated/catalyst_voices_localizations_es.dart @@ -345,4 +345,22 @@ class VoicesLocalizationsEs extends VoicesLocalizations { @override String get goodPasswordStrength => 'Good password strength'; + + @override + String get chooseCardanoWallet => 'Choose Cardano Wallet'; + + @override + String get learnMore => 'Learn More'; + + @override + String get walletLink_header => 'Link keys to your Catalyst Keychain'; + + @override + String get walletLink_subheader => 'Link your Cardano wallet'; + + @override + String get walletLink_intro_title => 'Link Cardano Wallet & Catalyst Roles to you Catalyst Keychain.'; + + @override + String get walletLink_intro_content => 'You\'re almost there! This is the final and most important step in your account setup.\n\nWe\'re going to link a Cardano Wallet to your Catalyst Keychain, so you can start collecting Role Keys.\n\nRole Keys allow you to enter new spaces, discover new ways to participate, and unlock new ways to earn rewards.\n\nWe\'ll start with your Voter Key by default. You can decide to add a Proposer Key and Drep key if you want, or you can always add them later.'; } diff --git a/catalyst_voices/packages/catalyst_voices_localization/lib/l10n/intl_en.arb b/catalyst_voices/packages/catalyst_voices_localization/lib/l10n/intl_en.arb index 65c3750b5b..22a2c7f2fe 100644 --- a/catalyst_voices/packages/catalyst_voices_localization/lib/l10n/intl_en.arb +++ b/catalyst_voices/packages/catalyst_voices_localization/lib/l10n/intl_en.arb @@ -425,5 +425,29 @@ "goodPasswordStrength": "Good password strength", "@goodPasswordStrength": { "description": "Describes a password that is strong." + }, + "chooseCardanoWallet": "Choose Cardano Wallet", + "@chooseCardanoWallet": { + "description": "A button label to select a cardano wallet." + }, + "learnMore": "Learn More", + "@learnMore": { + "description": "A label on a clickable element that can show more content." + }, + "walletLink_header": "Link keys to your Catalyst Keychain", + "@walletLink_header": { + "description": "A header in link wallet flow in registration." + }, + "walletLink_subheader": "Link your Cardano wallet", + "@walletLink_subheader": { + "description": "A subheader in link wallet flow in registration." + }, + "walletLink_intro_title": "Link Cardano Wallet & Catalyst Roles to you Catalyst Keychain.", + "@walletLink_intro_title": { + "description": "A title in link wallet flow on intro screen." + }, + "walletLink_intro_content": "You're almost there! This is the final and most important step in your account setup.\n\nWe're going to link a Cardano Wallet to your Catalyst Keychain, so you can start collecting Role Keys.\n\nRole Keys allow you to enter new spaces, discover new ways to participate, and unlock new ways to earn rewards.\n\nWe'll start with your Voter Key by default. You can decide to add a Proposer Key and Drep key if you want, or you can always add them later.", + "@walletLink_intro_content": { + "description": "A message (content) in link wallet flow on intro screen." } } \ No newline at end of file