Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cat-voices): registration completed screen #996

Merged
merged 24 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8ede11f
feat: Registration completed screen - initial
digitalheartxs Oct 11, 2024
3a3372c
feat: Registration completed screen - showCloseButton
digitalheartxs Oct 11, 2024
4876d7b
feat: Registration completed screen - show real data
digitalheartxs Oct 11, 2024
b592a44
feat: Registration completed screen - go to discovery
digitalheartxs Oct 11, 2024
3e31a2d
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/reg…
digitalheartxs Oct 11, 2024
f4e9b2c
feat: Registration completed screen - open account
digitalheartxs Oct 11, 2024
6a29bc6
feat: Registration completed screen - translations
digitalheartxs Oct 14, 2024
5e9125a
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/reg…
digitalheartxs Oct 14, 2024
34681a6
feat: Registration completed screen - fix merge
digitalheartxs Oct 14, 2024
6bcb729
feat: Registration completed screen - fix Lint issues
digitalheartxs Oct 14, 2024
81456d5
feat: Registration completed screen - better spacing
digitalheartxs Oct 14, 2024
272f9e6
feat: Registration completed screen - put 1x as string literal into code
digitalheartxs Oct 14, 2024
2b5d2b8
feat: Registration completed screen - PR feedback part 1
digitalheartxs Oct 14, 2024
73999af
feat: Registration completed screen - Use BlocSelector
digitalheartxs Oct 14, 2024
f7edb82
feat: Registration completed screen - Use BlocSelector
digitalheartxs Oct 14, 2024
d9be391
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/reg…
digitalheartxs Oct 14, 2024
2b46dcf
Update catalyst_voices/lib/pages/registration/account_completed/accou…
digitalheartxs Oct 14, 2024
c564459
feat: Registration completed screen - Capitalize wallet name
digitalheartxs Oct 14, 2024
da6d536
Merge remote-tracking branch 'origin/feat/registration_completed_scre…
digitalheartxs Oct 14, 2024
03ff57c
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/reg…
digitalheartxs Oct 14, 2024
18f0946
feat: Registration completed screen - fix issue after merge
digitalheartxs Oct 14, 2024
87c76fa
feat: Registration completed screen - fix lint issues
digitalheartxs Oct 14, 2024
231560c
feat: Registration completed screen - correct 'Remove Keychain' error…
digitalheartxs Oct 14, 2024
df53a61
feat: Registration completed screen - implement capitalize edge cases
digitalheartxs Oct 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions catalyst_voices/lib/common/ext/ext.dart
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export 'brand_ext.dart';
export 'space_ext.dart';
export 'string_ext.dart';
9 changes: 9 additions & 0 deletions catalyst_voices/lib/common/ext/string_ext.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extension StringExt on String {
String capitalize() {
if (isNotEmpty) {
return '${this[0].toUpperCase()}${substring(1).toLowerCase()}';
} else {
return '';
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
import 'package:catalyst_voices/common/ext/account_role_ext.dart';
import 'package:catalyst_voices/common/ext/ext.dart';
import 'package:catalyst_voices/pages/registration/widgets/next_step.dart';
import 'package:catalyst_voices/routes/routing/account_route.dart';
import 'package:catalyst_voices/routes/routing/spaces_route.dart';
import 'package:catalyst_voices/widgets/widgets.dart';
import 'package:catalyst_voices_assets/catalyst_voices_assets.dart';
import 'package:catalyst_voices_blocs/catalyst_voices_blocs.dart';
import 'package:catalyst_voices_brands/catalyst_voices_brands.dart';
import 'package:catalyst_voices_localization/catalyst_voices_localization.dart';
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:flutter_bloc/flutter_bloc.dart';

class AccountCompletedPanel extends StatelessWidget {
const AccountCompletedPanel({super.key});

@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const _TitleText(),
const SizedBox(height: 10),
Column(
children: <Widget>[
_SummaryItem(
image: VoicesAssets.images.registrationSummaryKeychain,
title: context.l10n.registrationCompletedKeychainTitle,
info: context.l10n.registrationCompletedKeychainInfo,
),
BlocSelector<RegistrationCubit, RegistrationState, String>(
selector: (state) =>
state.walletLinkStateData.selectedWallet?.wallet.name
.capitalize() ??
'',
builder: (context, walletName) {
return _SummaryItem(
image: VoicesAssets.images.registrationSummaryWallet,
title: context.l10n
.registrationCompletedWalletTitle(walletName),
info: context.l10n
.registrationCompletedWalletInfo(walletName),
);
},
),
BlocSelector<RegistrationCubit, RegistrationState,
List<AccountRole>>(
selector: (state) =>
state.walletLinkStateData.selectedRoles?.toList() ??
state.walletLinkStateData.defaultRoles.toList(),
builder: (context, roles) {
return _SummaryItem(
image: VoicesAssets.images.registrationSummaryRoles,
title: context.l10n.registrationCompletedRolesTitle,
info: context.l10n.registrationCompletedRolesInfo,
footer: _RolesFooter(roles),
);
},
),
].separatedBy(const SizedBox(height: 10)).toList(),
),
],
),
),
),
const _NextStep(),
const SizedBox(height: 10),
_OpenDiscoveryButton(
onTap: () {
Navigator.pop(context);
const DiscoveryRoute().go(context);
},
),
const SizedBox(height: 10),
_ReviewMyAccountButton(
onTap: () {
Navigator.pop(context);
const AccountRoute().go(context);
},
),
],
);
}
}

class _RolesFooter extends StatelessWidget {
final List<AccountRole> roles;

const _RolesFooter(this.roles);

@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
...roles.map(
(role) => Row(
children: [
Text(
'1x',
dtscalac marked this conversation as resolved.
Show resolved Hide resolved
style: Theme.of(context).textTheme.bodySmall,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: VoicesChip(
padding: const EdgeInsets.symmetric(
vertical: 1,
horizontal: 6,
),
content: Text(
role.getName(context),
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).colors.successContainer,
fontWeight: FontWeight.bold,
),
),
borderRadius: const BorderRadius.all(
Radius.circular(6),
),
backgroundColor: Theme.of(context).colors.success,
),
),
Text(
context.l10n.registrationCompletedRoleRegistration,
style: Theme.of(context).textTheme.bodySmall,
),
],
),
),
]
.separatedBy(
const SizedBox(height: 6),
)
.toList(),
);
}
}

class _SummaryItem extends StatelessWidget {
final AssetGenImage image;
final String title;
final String info;
final Widget? footer;

const _SummaryItem({
required this.image,
required this.title,
required this.info,
this.footer,
});

@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Theme.of(context).colors.elevationsOnSurfaceNeutralLv1Grey,
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CatalystImage.asset(
image.path,
width: 52,
height: 52,
),
const SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: Theme.of(context).textTheme.titleSmall,
),
Text(
info,
style: Theme.of(context).textTheme.bodySmall,
),
],
),
),
VoicesAvatar(
icon: VoicesAssets.icons.check.buildIcon(),
radius: 14,
padding: EdgeInsets.zero,
foregroundColor: Theme.of(context).colors.iconsPrimary,
backgroundColor:
Theme.of(context).colors.elevationsOnSurfaceNeutralLv1White,
),
],
),
if (footer != null) ...[
const VoicesDivider(
indent: 70,
endIndent: 0,
),
Padding(
padding: const EdgeInsets.only(left: 70),
child: footer,
),
digitalheartxs marked this conversation as resolved.
Show resolved Hide resolved
],
],
),
);
}
}

class _TitleText extends StatelessWidget {
const _TitleText();

@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final color = theme.colors.textOnPrimaryLevel1;

return Text(
context.l10n.registrationCompletedSummaryHeader,
style: theme.textTheme.titleMedium?.copyWith(color: color),
);
}
}

class _NextStep extends StatelessWidget {
const _NextStep();

@override
Widget build(BuildContext context) {
return const NextStep(null);
}
}

class _OpenDiscoveryButton extends StatelessWidget {
final VoidCallback onTap;

const _OpenDiscoveryButton({
required this.onTap,
});

@override
Widget build(BuildContext context) {
return VoicesFilledButton(
onTap: onTap,
child: Text(context.l10n.registrationCompletedDiscoveryButton),
);
}
}

class _ReviewMyAccountButton extends StatelessWidget {
final VoidCallback onTap;

const _ReviewMyAccountButton({
required this.onTap,
});

@override
Widget build(BuildContext context) {
return VoicesTextButton(
onTap: onTap,
child: Text(context.l10n.registrationCompletedAccountButton),
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:catalyst_voices_assets/catalyst_voices_assets.dart';
import 'package:flutter/material.dart';

class AccountCompletedPicture extends StatelessWidget {
const AccountCompletedPicture({
super.key,
});

@override
Widget build(BuildContext context) {
return CatalystImage.asset(
VoicesAssets.images.welcomeIllustration.path,
);
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:catalyst_voices/pages/registration/account_completed/account_completed_panel.dart';
import 'package:catalyst_voices/pages/registration/create_keychain/create_keychain_panel.dart';
import 'package:catalyst_voices/pages/registration/finish_account/finish_account_creation_panel.dart';
import 'package:catalyst_voices/pages/registration/get_started/get_started_panel.dart';
Expand Down Expand Up @@ -26,7 +27,7 @@ class RegistrationDetailsPanel extends StatelessWidget {
CreateKeychainStep(:final stage) => CreateKeychainPanel(stage: stage),
FinishAccountCreationStep() => const FinishAccountCreationPanel(),
WalletLinkStep(:final stage) => WalletLinkPanel(stage: stage),
AccountCompletedStep() => const Placeholder(),
AccountCompletedStep() => const AccountCompletedPanel(),
};
},
);
Expand Down
13 changes: 10 additions & 3 deletions catalyst_voices/lib/pages/registration/registration_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:catalyst_voices/pages/registration/registration_exit_confirm_dia
import 'package:catalyst_voices/pages/registration/registration_info_panel.dart';
import 'package:catalyst_voices/widgets/widgets.dart';
import 'package:catalyst_voices_blocs/catalyst_voices_blocs.dart';
import 'package:catalyst_voices_models/catalyst_voices_models.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

Expand Down Expand Up @@ -56,9 +57,15 @@ class _RegistrationDialogState extends State<RegistrationDialog>
onPopInvokedWithResult: (didPop, result) {
unawaited(_confirmedExit(context, didPop: didPop));
},
child: const VoicesTwoPaneDialog(
left: RegistrationInfoPanel(),
right: RegistrationDetailsPanel(),
child: BlocSelector<RegistrationCubit, RegistrationState, bool>(
selector: (state) => state.step is! AccountCompletedStep,
builder: (context, showCloseButton) {
return VoicesTwoPaneDialog(
left: const RegistrationInfoPanel(),
right: const RegistrationDetailsPanel(),
showCloseButton: showCloseButton,
);
},
),
),
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:catalyst_voices/pages/registration/bloc_unlock_password_builder.dart';
import 'package:catalyst_voices/pages/registration/create_keychain/bloc_seed_phrase_builder.dart';
import 'package:catalyst_voices/pages/registration/pictures/account_completed_picture.dart';
import 'package:catalyst_voices/pages/registration/pictures/keychain_picture.dart';
import 'package:catalyst_voices/pages/registration/pictures/keychain_with_password_picture.dart';
import 'package:catalyst_voices/pages/registration/pictures/password_picture.dart';
Expand Down Expand Up @@ -131,7 +132,10 @@ class RegistrationInfoPanel extends StatelessWidget {
),
CreateKeychainStep(:final stage) => buildKeychainStageHeader(stage),
WalletLinkStep(:final stage) => buildWalletLinkStageHeader(stage),
AccountCompletedStep() => _HeaderStrings(title: 'TODO'),
AccountCompletedStep() => _HeaderStrings(
title: context.l10n.registrationCompletedTitle,
subtitle: context.l10n.registrationCompletedSubtitle,
),
};
}
}
Expand Down Expand Up @@ -194,7 +198,7 @@ class _RegistrationPicture extends StatelessWidget {
CreateKeychainStep(:final stage) => buildKeychainStagePicture(stage),
FinishAccountCreationStep() => const KeychainWithPasswordPicture(),
WalletLinkStep(:final stage) => buildWalletLinkStagePicture(stage),
AccountCompletedStep() => const KeychainPicture(),
AccountCompletedStep() => const AccountCompletedPicture(),
};
}
}
Expand Down
Loading
Loading