Skip to content

Commit

Permalink
feat: My account, account_popup, use enum
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalheartxs committed Sep 23, 2024
1 parent bf1a464 commit a6f7037
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions catalyst_voices/lib/pages/account/account_popup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ class AccountPopup extends StatelessWidget {

@override
Widget build(BuildContext context) {
return PopupMenuButton(
return PopupMenuButton<_MenuItemValue>(
color: Theme.of(context).colors.elevationsOnSurfaceNeutralLv1White,
onSelected: (String? value) {
onSelected: (_MenuItemValue value) {
switch (value) {
case _profileAndKeychain:
case _MenuItemValue.profileAndKeychain:
onProfileKeychainTap?.call();
break;
case _lock:
case _MenuItemValue.lock:
onLockAccountTap?.call();
break;
}
Expand Down Expand Up @@ -53,15 +53,15 @@ class AccountPopup extends StatelessWidget {
),
PopupMenuItem(
padding: EdgeInsets.zero,
value: _profileAndKeychain,
value: _MenuItemValue.profileAndKeychain,
child: _MenuItem(
'Profile & Keychain',
VoicesAssets.icons.userCircle,
),
),
PopupMenuItem(
padding: EdgeInsets.zero,
value: _lock,
value: _MenuItemValue.lock,
child: _MenuItem(
'Lock account',
VoicesAssets.icons.lockClosed,
Expand Down Expand Up @@ -240,5 +240,8 @@ class _Section extends StatelessWidget {
}

const _padding = 12.0;
const _profileAndKeychain = 'profileAndKeychain';
const _lock = 'lock';

enum _MenuItemValue {
profileAndKeychain,
lock,
}

0 comments on commit a6f7037

Please sign in to comment.