Skip to content

Commit

Permalink
Merge branch 'main' into feat/chain-sync-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenj committed Sep 25, 2024
2 parents ead01c9 + 7706275 commit d7eedf9
Show file tree
Hide file tree
Showing 12 changed files with 267 additions and 4 deletions.
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: [],
),
);
}
}
21 changes: 21 additions & 0 deletions catalyst_voices/lib/widgets/buttons/voices_buttons.dart
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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),
);
}
}
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 @@ -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<VoicesLocalizations> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.';
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.';
}
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
}
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 d7eedf9

Please sign in to comment.