Skip to content

Commit

Permalink
add more onboarding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed May 29, 2024
1 parent 3059d3c commit 34fdfd8
Show file tree
Hide file tree
Showing 14 changed files with 455 additions and 275 deletions.
1 change: 0 additions & 1 deletion lib/onboarding/onboarding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ export 'gen_phrase/onboarding_gen_phrase.dart';
export 'helper_function/helper_function.dart';
export 'protect_wallet/protect_wallet.dart';
export 'starter/starter.dart';
export 'third/onboarding_third.dart';
export 'tos/onboarding_terms.dart';
export 'verify_phrase/onboarding_verify_phrase.dart';
export 'wallet_ready/wallet_ready.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class _ProtectWalletViewState extends State<ProtectWalletView> {
if (byPassScreen) {
await widget.onboardingCubit.emitOnboardingProcessing();
final mnemonic = bip39.generateMnemonic().split(' ');

await widget.onBoardingGenPhraseCubit
.generateSSIAndCryptoAccount(mnemonic);
} else {
Expand Down
22 changes: 18 additions & 4 deletions lib/onboarding/starter/view/starter_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,21 @@ class StarterPage extends StatelessWidget {

@override
Widget build(BuildContext context) {
final l10n = context.l10n;
return StarterView(profileCubit: context.read<ProfileCubit>());
}
}

class StarterView extends StatelessWidget {
const StarterView({
super.key,
required this.profileCubit,
});

final ProfileCubit profileCubit;

final profileCubit = context.read<ProfileCubit>();
@override
Widget build(BuildContext context) {
final l10n = context.l10n;

return WillPopScope(
onWillPop: () async {
Expand Down Expand Up @@ -67,11 +79,13 @@ class StarterPage extends StatelessWidget {
await profileCubit.setWalletType(
walletType: WalletType.personal,
);

await profileCubit.setProfileSetting(
profileSetting: ProfileSetting.initial(),
profileType: ProfileType.defaultOne,
);
await Navigator.of(context).push(

await Navigator.of(context).push<void>(
ProtectWalletPage.route(
routeType: WalletRouteType.create,
),
Expand All @@ -93,7 +107,7 @@ class StarterPage extends StatelessWidget {
profileSetting: ProfileSetting.initial(),
profileType: ProfileType.defaultOne,
);
await Navigator.of(context).push(
await Navigator.of(context).push<void>(
ProtectWalletPage.route(
routeType: WalletRouteType.import,
),
Expand Down
1 change: 0 additions & 1 deletion lib/onboarding/third/onboarding_third.dart

This file was deleted.

66 changes: 0 additions & 66 deletions lib/onboarding/third/view/onboarding_third_page.dart

This file was deleted.

25 changes: 13 additions & 12 deletions lib/onboarding/tos/view/onboarding_tos_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@ class OnBoardingTosPage extends StatelessWidget {
Widget build(BuildContext context) {
return BlocProvider<OnBoardingTosCubit>(
create: (_) => OnBoardingTosCubit(),
child: const OnBoardingTosView(),
child: OnBoardingTosView(
onBoardingTosCubit: context.read<OnBoardingTosCubit>(),
),
);
}
}

class OnBoardingTosView extends StatefulWidget {
const OnBoardingTosView({super.key});
const OnBoardingTosView({
super.key,
required this.onBoardingTosCubit,
});

final OnBoardingTosCubit onBoardingTosCubit;

@override
State<OnBoardingTosView> createState() => _OnBoardingTosViewState();
Expand All @@ -41,13 +48,9 @@ class _OnBoardingTosViewState extends State<OnBoardingTosView> {
final double currentScroll = _scrollController.position.pixels;

if (maxScroll - currentScroll <= 200) {
context
.read<OnBoardingTosCubit>()
.setScrolledIsOver(scrollIsOver: true);
widget.onBoardingTosCubit.setScrolledIsOver(scrollIsOver: true);
} else {
context
.read<OnBoardingTosCubit>()
.setScrolledIsOver(scrollIsOver: false);
widget.onBoardingTosCubit.setScrolledIsOver(scrollIsOver: false);
}
});
super.initState();
Expand Down Expand Up @@ -87,17 +90,15 @@ class _OnBoardingTosViewState extends State<OnBoardingTosView> {
value: state.agreeTerms,
text: l10n.agreeTermsAndConditionCheckBox,
onChange: (value) {
context
.read<OnBoardingTosCubit>()
widget.onBoardingTosCubit
.setAgreeTerms(agreeTerms: value);
},
),
CheckboxItem(
value: state.readTerms,
text: l10n.readTermsOfUseCheckBox,
onChange: (value) {
context
.read<OnBoardingTosCubit>()
widget.onBoardingTosCubit
.setReadTerms(readTerms: value);
},
),
Expand Down
95 changes: 0 additions & 95 deletions lib/onboarding/widgets/onboarding_widget.dart

This file was deleted.

55 changes: 0 additions & 55 deletions lib/onboarding/widgets/page_tracker.dart

This file was deleted.

2 changes: 0 additions & 2 deletions lib/onboarding/widgets/widgets.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
export 'm_stepper.dart';
export 'onboarding_widget.dart';
export 'page_tracker.dart';
export 'protect_widget.dart';
Loading

0 comments on commit 34fdfd8

Please sign in to comment.