Skip to content

Commit

Permalink
refactor: Display advanced security options #2584
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Jul 25, 2024
1 parent 9324849 commit 6d0afd0
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:altme/l10n/l10n.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

// this page is not used anymore
class AdvancedSettingsPage extends StatelessWidget {
const AdvancedSettingsPage({super.key});

Expand Down
14 changes: 0 additions & 14 deletions lib/dashboard/drawer/src/view/drawer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,20 +149,6 @@ class DrawerView extends StatelessWidget {
),
const SizedBox(height: Sizes.spaceSmall),
],
if (profileModel.profileType == ProfileType.enterprise &&
profileModel.profileSetting.walletSecurityOptions
.displaySecurityAdvancedSettings) ...[
DrawerCategoryItem(
title: l10n.advanceSettings,
subTitle: l10n
.selectCredentialCategoryWhichYouWantToShowInCredentialList,
onClick: () {
Navigator.of(context)
.push<void>(AdvancedSettingsPage.route());
},
),
const SizedBox(height: Sizes.spaceSmall),
],
if (profileModel
.profileSetting.settingsMenu.displayHelpCenter) ...[
DrawerCategoryItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,76 +45,80 @@ class AdvancedSecuritySettingsView extends StatelessWidget {
width: MediaQuery.of(context).size.shortestSide * 0.5,
showPoweredBy: true,
),
const SizedBox(
height: Sizes.spaceSmall,
),
DrawerItem2(
title: l10n.verifyIssuerWebsiteIdentity,
subtitle: l10n.verifyIssuerWebsiteIdentitySubtitle,
trailing: SizedBox(
height: 25,
child: Switch(
onChanged: (value) async {
await context
.read<ProfileCubit>()
.updateProfileSetting(
verifySecurityIssuerWebsiteIdentity: value,
);
},
value: state
.model
.profileSetting
.walletSecurityOptions
.verifySecurityIssuerWebsiteIdentity,
activeColor: Theme.of(context).colorScheme.primary,
const SizedBox(height: Sizes.spaceSmall),
if (state.model.profileSetting.walletSecurityOptions
.verifySecurityIssuerWebsiteIdentity)
DrawerItem2(
title: l10n.verifyIssuerWebsiteIdentity,
subtitle: l10n.verifyIssuerWebsiteIdentitySubtitle,
trailing: SizedBox(
height: 25,
child: Switch(
onChanged: (value) async {
await context
.read<ProfileCubit>()
.updateProfileSetting(
verifySecurityIssuerWebsiteIdentity: value,
);
},
value: state
.model
.profileSetting
.walletSecurityOptions
.verifySecurityIssuerWebsiteIdentity,
activeColor: Theme.of(context).colorScheme.primary,
),
),
),
),
DrawerItem2(
title: l10n.confirmVerifierAccess,
subtitle: l10n.confirmVerifierAccessSubtitle,
trailing: SizedBox(
height: 25,
child: Switch(
onChanged: (value) async {
await context
.read<ProfileCubit>()
.updateProfileSetting(
confirmSecurityVerifierAccess: value,
);
},
value: state
.model
.profileSetting
.walletSecurityOptions
.confirmSecurityVerifierAccess,
activeColor: Theme.of(context).colorScheme.primary,
if (state.model.profileSetting.walletSecurityOptions
.confirmSecurityVerifierAccess)
DrawerItem2(
title: l10n.confirmVerifierAccess,
subtitle: l10n.confirmVerifierAccessSubtitle,
trailing: SizedBox(
height: 25,
child: Switch(
onChanged: (value) async {
await context
.read<ProfileCubit>()
.updateProfileSetting(
confirmSecurityVerifierAccess: value,
);
},
value: state
.model
.profileSetting
.walletSecurityOptions
.confirmSecurityVerifierAccess,
activeColor: Theme.of(context).colorScheme.primary,
),
),
),
),
DrawerItem2(
title: l10n.secureAuthenticationWithPINCode,
subtitle: l10n.secureAuthenticationWithPINCodeSubtitle,
trailing: SizedBox(
height: 25,
child: Switch(
onChanged: (value) async {
await context
.read<ProfileCubit>()
.updateProfileSetting(
secureSecurityAuthenticationWithPinCode:
value,
);
},
value: state
.model
.profileSetting
.walletSecurityOptions
.secureSecurityAuthenticationWithPinCode,
activeColor: Theme.of(context).colorScheme.primary,
if (state.model.profileSetting.walletSecurityOptions
.secureSecurityAuthenticationWithPinCode)
DrawerItem2(
title: l10n.secureAuthenticationWithPINCode,
subtitle: l10n.secureAuthenticationWithPINCodeSubtitle,
trailing: SizedBox(
height: 25,
child: Switch(
onChanged: (value) async {
await context
.read<ProfileCubit>()
.updateProfileSetting(
secureSecurityAuthenticationWithPinCode:
value,
);
},
value: state
.model
.profileSetting
.walletSecurityOptions
.secureSecurityAuthenticationWithPinCode,
activeColor: Theme.of(context).colorScheme.primary,
),
),
),
),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class WalletSecurityView extends StatelessWidget {
@override
Widget build(BuildContext context) {
final l10n = context.l10n;

return BlocBuilder<ProfileCubit, ProfileState>(
builder: (context, state) {
return BasePage(
Expand Down Expand Up @@ -84,8 +85,8 @@ class WalletSecurityView extends StatelessWidget {
}
},
),
if (context.read<ProfileCubit>().state.model.profileType ==
ProfileType.custom)
if (state.model.profileSetting.walletSecurityOptions
.displaySecurityAdvancedSettings)
DrawerItem(
title: l10n.advancedSecuritySettings,
onTap: () {
Expand Down

0 comments on commit 6d0afd0

Please sign in to comment.