Skip to content

Commit

Permalink
fix: update drawer test
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Jun 21, 2024
1 parent 88a6a47 commit 32d85ac
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 131 deletions.
261 changes: 132 additions & 129 deletions lib/dashboard/drawer/src/view/drawer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,161 +43,164 @@ class DrawerView extends StatelessWidget {
child: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: ListView(
children: <Widget>[
const Align(
alignment: Alignment.topLeft,
child: BackLeadingButton(
padding: EdgeInsets.zero,
child: SingleChildScrollView(
child: Column(
children: <Widget>[
const Align(
alignment: Alignment.topLeft,
child: BackLeadingButton(
padding: EdgeInsets.zero,
),
),
),

const DrawerLogo(),
const AppVersionDrawer(),
const SizedBox(height: Sizes.spaceLarge),
if (profileModel.profileType == ProfileType.enterprise) ...[
DrawerCategoryItem(
title: l10n.updateYourWalletConfigNow,
padding: const EdgeInsets.all(16),
onClick: () async {
Navigator.of(context).pop();
await context
.read<EnterpriseCubit>()
.updateTheConfiguration();
},
),
const SizedBox(height: Sizes.spaceSmall),
],
const DrawerLogo(),
const AppVersionDrawer(),
const SizedBox(height: Sizes.spaceLarge),
if (profileModel.profileType ==
ProfileType.enterprise) ...[
DrawerCategoryItem(
title: l10n.updateYourWalletConfigNow,
padding: const EdgeInsets.all(16),
onClick: () async {
Navigator.of(context).pop();
await context
.read<EnterpriseCubit>()
.updateTheConfiguration();
},
),
const SizedBox(height: Sizes.spaceSmall),
],

if (profileModel
.profileSetting.settingsMenu.displayProfile) ...[
DrawerCategoryItem(
title: l10n.walletProfiles,
subTitle: l10n.walletProfilesDescription,
onClick: () {
Navigator.of(context)
.push<void>(PickProfileMenu.route());
},
),
const SizedBox(height: Sizes.spaceSmall),
],

if (profileModel
.profileSetting.settingsMenu.displayProfile) ...[
DrawerCategoryItem(
title: l10n.walletProfiles,
subTitle: l10n.walletProfilesDescription,
title: l10n.walletSecurity,
subTitle: l10n.walletSecurityDescription,
onClick: () {
Navigator.of(context)
.push<void>(PickProfileMenu.route());
.push<void>(WalletSecurityMenu.route());
},
),
const SizedBox(height: Sizes.spaceSmall),
],

DrawerCategoryItem(
title: l10n.walletSecurity,
subTitle: l10n.walletSecurityDescription,
onClick: () {
Navigator.of(context)
.push<void>(WalletSecurityMenu.route());
},
),
const SizedBox(height: Sizes.spaceSmall),
DrawerCategoryItem(
title: l10n.walletSettings,
subTitle: l10n.walletSettingsDescription,
onClick: () {
Navigator.of(context)
.push<void>(WalletSettingsMenu.route());
},
),
if (Parameters.walletHandlesCrypto)
Column(
children: [
const SizedBox(height: Sizes.spaceSmall),
DrawerCategoryItem(
title: l10n.blockchainSettings,
subTitle: l10n.blockchainSettingsDescription,
onClick: () {
Navigator.of(context)
.push<void>(BlockchainSettingsMenu.route());
},
),
],
)
else
const SizedBox.shrink(),
const SizedBox(height: Sizes.spaceSmall),

if (profileModel.profileSetting.settingsMenu
.displaySelfSovereignIdentity) ...[
DrawerCategoryItem(
title: l10n.ssi,
subTitle: l10n.ssiDescription,
title: l10n.walletSettings,
subTitle: l10n.walletSettingsDescription,
onClick: () {
Navigator.of(context).push<void>(SSIMenu.route());
Navigator.of(context)
.push<void>(WalletSettingsMenu.route());
},
),
if (Parameters.walletHandlesCrypto)
Column(
children: [
const SizedBox(height: Sizes.spaceSmall),
DrawerCategoryItem(
title: l10n.blockchainSettings,
subTitle: l10n.blockchainSettingsDescription,
onClick: () {
Navigator.of(context)
.push<void>(BlockchainSettingsMenu.route());
},
),
],
)
else
const SizedBox.shrink(),
const SizedBox(height: Sizes.spaceSmall),
],

if (profileModel
.profileSetting.settingsMenu.displayDeveloperMode) ...[
DrawerCategoryItem(
title: l10n.developerMode,
subTitle: l10n.developerModeSubtitle,
trailing: SizedBox(
height: 25,
child: BlocBuilder<ProfileCubit, ProfileState>(
builder: (context, state) {
return Switch(
key: const Key('developerMode'),
onChanged: (value) async {
await profileCubit.setDeveloperModeStatus(
enabled: value,
);
},
value: state.model.isDeveloperMode,
activeColor:
Theme.of(context).colorScheme.primary,
);
},
if (profileModel.profileSetting.settingsMenu
.displaySelfSovereignIdentity) ...[
DrawerCategoryItem(
title: l10n.ssi,
subTitle: l10n.ssiDescription,
onClick: () {
Navigator.of(context).push<void>(SSIMenu.route());
},
),
const SizedBox(height: Sizes.spaceSmall),
],

if (profileModel.profileSetting.settingsMenu
.displayDeveloperMode) ...[
DrawerCategoryItem(
title: l10n.developerMode,
subTitle: l10n.developerModeSubtitle,
trailing: SizedBox(
height: 25,
child: BlocBuilder<ProfileCubit, ProfileState>(
builder: (context, state) {
return Switch(
key: const Key('developerMode'),
onChanged: (value) async {
await profileCubit.setDeveloperModeStatus(
enabled: value,
);
},
value: state.model.isDeveloperMode,
activeColor:
Theme.of(context).colorScheme.primary,
);
},
),
),
),
),
const SizedBox(height: Sizes.spaceSmall),
],
const SizedBox(height: Sizes.spaceSmall),
],

// DrawerCategoryItem(
// title: l10n.checkLinkedinProfile,
// subTitle: l10n.checkLinkedinProfile,
// onClick: () {
// Navigator.of(context)
// .push<void>(CheckForLinkedInProfile.route());
// },
// ),
//const SizedBox(height: Sizes.spaceSmall),

// DrawerCategoryItem(
// title: l10n.checkLinkedinProfile,
// subTitle: l10n.checkLinkedinProfile,
// onClick: () {
// Navigator.of(context)
// .push<void>(CheckForLinkedInProfile.route());
// },
// ),
//const SizedBox(height: Sizes.spaceSmall),
if (profileModel
.profileSetting.settingsMenu.displayHelpCenter) ...[
DrawerCategoryItem(
title: l10n.helpCenter,
subTitle: l10n.helpCenterDescription,
onClick: () {
Navigator.of(context)
.push<void>(HelpCenterMenu.route());
},
),
const SizedBox(height: Sizes.spaceSmall),
],

if (profileModel
.profileSetting.settingsMenu.displayHelpCenter) ...[
DrawerCategoryItem(
title: l10n.helpCenter,
subTitle: l10n.helpCenterDescription,
title: l10n.about,
subTitle: l10n.aboutDescription,
onClick: () {
Navigator.of(context)
.push<void>(HelpCenterMenu.route());
.push<void>(AboutAltmeMenu.route());
},
),
const SizedBox(height: Sizes.spaceSmall),
DrawerCategoryItem(
title: l10n.resetWallet,
subTitle: l10n.resetWalletDescription,
onClick: () {
Navigator.of(context)
.push<void>(ResetWalletMenu.route());
},
),
const SizedBox(height: Sizes.spaceNormal),
],

DrawerCategoryItem(
title: l10n.about,
subTitle: l10n.aboutDescription,
onClick: () {
Navigator.of(context)
.push<void>(AboutAltmeMenu.route());
},
),
const SizedBox(height: Sizes.spaceSmall),
DrawerCategoryItem(
title: l10n.resetWallet,
subTitle: l10n.resetWalletDescription,
onClick: () {
Navigator.of(context)
.push<void>(ResetWalletMenu.route());
},
),
const SizedBox(height: Sizes.spaceNormal),
],
),
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WalletSettingsMenu extends StatelessWidget {

static Route<dynamic> route() {
return MaterialPageRoute<void>(
settings: const RouteSettings(name: '/LanguageSettings'),
settings: const RouteSettings(name: '/WalletSettingsMenu'),
builder: (_) => const WalletSettingsMenu(),
);
}
Expand Down
2 changes: 1 addition & 1 deletion test/dashboard/drawer/src/view/drawer_page_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void main() {
);

expect(find.text('Wallet Settings'), findsOneWidget);
expect(find.text('Choose your language'), findsOneWidget);
expect(find.text('Choose your language and theme'), findsOneWidget);

await tester.tap(find.text('Wallet Settings'));
await tester.pumpAndSettle();
Expand Down

0 comments on commit 32d85ac

Please sign in to comment.