-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: finish account creation panel (#931)
Co-authored-by: Dominik Toton <[email protected]>
- Loading branch information
1 parent
d5e6ff3
commit 7278e22
Showing
9 changed files
with
244 additions
and
4 deletions.
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
catalyst_voices/lib/pages/registration/finish_account/finish_account_creation_panel.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import 'package:catalyst_voices/pages/registration/next_step.dart'; | ||
import 'package:catalyst_voices/pages/registration/registration_progress.dart'; | ||
import 'package:catalyst_voices/widgets/buttons/voices_filled_button.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:flutter/material.dart'; | ||
|
||
class FinishAccountCreationPanel extends StatelessWidget { | ||
const FinishAccountCreationPanel({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Column( | ||
crossAxisAlignment: CrossAxisAlignment.stretch, | ||
children: [ | ||
const SizedBox(height: 24), | ||
const Expanded( | ||
child: SingleChildScrollView( | ||
child: Column( | ||
mainAxisSize: MainAxisSize.min, | ||
crossAxisAlignment: CrossAxisAlignment.stretch, | ||
children: [ | ||
_TitleText(), | ||
SizedBox(height: 24), | ||
RegistrationProgressKeychainCompleted() | ||
], | ||
), | ||
), | ||
), | ||
const SizedBox(height: 10), | ||
const _NextStep(), | ||
const SizedBox(height: 10), | ||
_LinkWalletAndRolesButton(onTap: () => _goToNextStep(context)), | ||
], | ||
); | ||
} | ||
|
||
void _goToNextStep(BuildContext context) { | ||
RegistrationCubit.of(context).nextStep(); | ||
} | ||
} | ||
|
||
class _TitleText extends StatelessWidget { | ||
const _TitleText(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final theme = Theme.of(context); | ||
final color = theme.colors.textOnPrimaryLevel1; | ||
|
||
final l10n = context.l10n; | ||
|
||
return Text( | ||
l10n.createKeychainCreatedTitle, | ||
style: theme.textTheme.titleMedium?.copyWith(color: color), | ||
); | ||
} | ||
} | ||
|
||
class _NextStep extends StatelessWidget { | ||
const _NextStep(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return NextStep(context.l10n.createKeychainCreatedNextStep); | ||
} | ||
} | ||
|
||
class _LinkWalletAndRolesButton extends StatelessWidget { | ||
final VoidCallback onTap; | ||
|
||
const _LinkWalletAndRolesButton({ | ||
required this.onTap, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return VoicesFilledButton( | ||
onTap: onTap, | ||
leading: VoicesAssets.icons.wallet.buildIcon(size: 18), | ||
child: Text(context.l10n.createKeychainLinkWalletAndRoles), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
catalyst_voices/lib/pages/registration/registration_progress.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import 'package:catalyst_voices/widgets/indicators/process_progress_indicator.dart'; | ||
import 'package:catalyst_voices_localization/catalyst_voices_localization.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
enum RegistrationProgressStepGroup { | ||
createKeychain, | ||
linkWallet, | ||
accountCompleted; | ||
|
||
String _localizedName(BuildContext context) { | ||
return switch (this) { | ||
RegistrationProgressStepGroup.createKeychain => | ||
context.l10n.registrationCreateKeychainStepGroup, | ||
RegistrationProgressStepGroup.linkWallet => | ||
context.l10n.registrationLinkWalletStepGroup, | ||
RegistrationProgressStepGroup.accountCompleted => | ||
context.l10n.registrationCompletedStepGroup, | ||
}; | ||
} | ||
|
||
ProcessProgressStep<RegistrationProgressStepGroup> _asProcessStep( | ||
BuildContext context, | ||
) { | ||
return ProcessProgressStep( | ||
value: this, | ||
name: _localizedName(context), | ||
); | ||
} | ||
} | ||
|
||
class RegistrationProgressKeychainCompleted extends StatelessWidget { | ||
const RegistrationProgressKeychainCompleted({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return const RegistrationProgress( | ||
completed: { | ||
RegistrationProgressStepGroup.createKeychain, | ||
}, | ||
current: RegistrationProgressStepGroup.linkWallet, | ||
); | ||
} | ||
} | ||
|
||
class RegistrationProgress extends StatelessWidget { | ||
final Set<RegistrationProgressStepGroup> completed; | ||
final RegistrationProgressStepGroup current; | ||
|
||
const RegistrationProgress({ | ||
super.key, | ||
required this.completed, | ||
required this.current, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ProcessProgressIndicator<RegistrationProgressStepGroup>( | ||
steps: RegistrationProgressStepGroup.values | ||
.map((e) => e._asProcessStep(context)) | ||
.toList(), | ||
completed: completed, | ||
current: current, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters