Disable navigation bar button when already active
What changed, and why it matters
This commit is a minor user-interface polish change. It stops a navigation button from doing anything if the user is already on the page it would open. There is no security relevance in the commit message or code change.
No security action needed. Treat as a normal UI/UX fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch adds selectedIndex != N guards before each Navigator.pushNamed call in the wallet navigation bar. This prevents pushing a duplicate route when the currently selected tab is tapped again. The remaining changes are purely formatting (collapsing multi-line widget constructors to single lines). No security-sensitive code, cryptographic operations, authentication, input handling, or network behavior is modified.
Changed components
lib/widgets/wallet_navigation_bar.dartInspect captured patch +6 / −15
diff --git a/lib/widgets/wallet_navigation_bar.dart b/lib/widgets/wallet_navigation_bar.dart
index 3f29ed8..0f8cf89 100644
--- a/lib/widgets/wallet_navigation_bar.dart
+++ b/lib/widgets/wallet_navigation_bar.dart
@@ -13,23 +13,14 @@ class WalletNavigationBar extends StatelessWidget {
return NavigationBar(
selectedIndex: selectedIndex,
onDestinationSelected: (index) => {
- if (index == 0) {Navigator.pushNamed(context, '/wallet_home')},
- if (index == 1) {Navigator.pushNamed(context, '/address_book')},
- if (index == 2) {Navigator.pushNamed(context, '/settings')},
+ if (index == 0 && selectedIndex != 0) {Navigator.pushNamed(context, '/wallet_home')},
+ if (index == 1 && selectedIndex != 1) {Navigator.pushNamed(context, '/address_book')},
+ if (index == 2 && selectedIndex != 2) {Navigator.pushNamed(context, '/settings')},
},
destinations: [
- NavigationDestination(
- icon: Icon(Icons.wallet),
- label: i18n.navigationBarWallet,
- ),
- NavigationDestination(
- icon: Icon(Icons.contacts),
- label: i18n.addressBookTitle,
- ),
- NavigationDestination(
- icon: Icon(Icons.settings),
- label: i18n.navigationBarSettings,
- ),
+ NavigationDestination(icon: Icon(Icons.wallet), label: i18n.navigationBarWallet),
+ NavigationDestination(icon: Icon(Icons.contacts), label: i18n.addressBookTitle),
+ NavigationDestination(icon: Icon(Icons.settings), label: i18n.navigationBarSettings),
],
);
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.