Skip to content

Commit

Permalink
Merge main into feat/account_creation_get_started
Browse files Browse the repository at this point in the history
  • Loading branch information
damian-molinski committed Sep 25, 2024
2 parents ecd135e + 7706275 commit 89ba2b3
Show file tree
Hide file tree
Showing 13 changed files with 253 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class _LeftPanel extends StatelessWidget {
const Expanded(child: Center(child: TaskKeychainPicture())),
const SizedBox(height: 32),
// TODO(damian-molinski): External url redirect
LearnMoreButton(onTap: () {}),
VoicesLearnMoreButton(onTap: () {}),
],
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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),
),
],
),
);
}
}
Original file line number Diff line number Diff line change
@@ -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<void> show({required BuildContext context}) {
return VoicesDialog.show(
context: context,
routeSettings: const RouteSettings(name: '/register/link-wallet'),
builder: (context) => const LinkWalletDialog._(),
);
}

@override
State<LinkWalletDialog> createState() => _LinkWalletDialogState();
}

class _LinkWalletDialogState extends State<LinkWalletDialog> {
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
}
}
Original file line number Diff line number Diff line change
@@ -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,
}
Original file line number Diff line number Diff line change
@@ -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<CardanoWallet> onSelectedWallet;

const SelectWalletDialog({
super.key,
required this.onSelectedWallet,
});

@override
Widget build(BuildContext context) {
return const VoicesDesktopPanelsDialog(
left: Column(
children: [],
),
right: Column(
children: [],
),
);
}
}
11 changes: 6 additions & 5 deletions catalyst_voices/lib/widgets/buttons/voices_buttons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,20 @@ class MoreOptionsButton extends StatelessWidget {
}
}

class LearnMoreButton extends StatelessWidget {
final VoidCallback? onTap;
/// A "Learn More" button that redirects usually to an external content.
class VoicesLearnMoreButton extends StatelessWidget {
final VoidCallback onTap;

const LearnMoreButton({
const VoicesLearnMoreButton({
super.key,
this.onTap,
required this.onTap,
});

@override
Widget build(BuildContext context) {
return VoicesTextButton(
onTap: onTap,
trailing: VoicesAssets.icons.externalLink.buildIcon(),
onTap: onTap,
child: Text(context.l10n.learnMore),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ ThemeData _buildThemeData(
final textTheme = _buildTextTheme(voicesColorScheme);

return ThemeData(
visualDensity: VisualDensity.standard,
appBarTheme: AppBarTheme(
backgroundColor: voicesColorScheme.onSurfaceNeutralOpaqueLv1,
scrolledUnderElevation: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,42 @@ abstract class VoicesLocalizations {
/// **'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;

/// No description provided for @accountCreationCreate.
///
/// In en, this message translates to:
Expand All @@ -682,12 +718,6 @@ abstract class VoicesLocalizations {
/// **'On this device'**
String get accountCreationOnThisDevice;

/// General string used as external link text buttons
///
/// In en, this message translates to:
/// **'Learn more'**
String get learnMore;

/// No description provided for @accountCreationGetStartedTitle.
///
/// In en, this message translates to:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,24 @@ 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.';

@override
String get accountCreationCreate => 'Create a new 
Catalyst Keychain';

Expand All @@ -355,9 +373,6 @@ class VoicesLocalizationsEn extends VoicesLocalizations {
@override
String get accountCreationOnThisDevice => 'On this device';

@override
String get learnMore => 'Learn more';

@override
String get accountCreationGetStartedTitle => 'Welcome to Catalyst';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,24 @@ 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.';

@override
String get accountCreationCreate => 'Create a new 
Catalyst Keychain';

Expand All @@ -355,9 +373,6 @@ class VoicesLocalizationsEs extends VoicesLocalizations {
@override
String get accountCreationOnThisDevice => 'On this device';

@override
String get learnMore => 'Learn more';

@override
String get accountCreationGetStartedTitle => 'Welcome to Catalyst';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,16 +426,36 @@
"@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."
},
"accountCreationCreate": "Create a new \u2028Catalyst Keychain",
"accountCreationRecover": "Recover your\u2028Catalyst Keychain",
"accountCreationOnThisDevice": "On this device",
"@accountCreationOnThisDevice": {
"description": "Indicates that created keychain will be stored in this device only"
},
"learnMore": "Learn more",
"@learnMore": {
"description": "General string used as external link text buttons"
},
"accountCreationGetStartedTitle": "Welcome to Catalyst",
"accountCreationGetStatedDesc": "If you already have a Catalyst keychain you can restore it on this device, or you can create a new Catalyst Keychain.",
"accountCreationGetStatedWhatNext": "What do you want to do?"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,20 @@ void main() {
'addr_test1qpu5vlrf4xkxv2qpwngf6cjhtw542ayty80v8dyr49rf5ewvxwdrt70'
'qlcpeeagscasafhffqsxy36t90ldv06wqrk2qum8x5w',
),
amount: const Value(coin: Coin(10162333)),
amount: const Balance(coin: Coin(10162333)),
),
);
final txOutput = TransactionOutput(
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),
Expand Down

0 comments on commit 89ba2b3

Please sign in to comment.