refactor: Centralize bottom bar visibility paths into a list and simplify the conditional check.

This commit is contained in:
Achintha Isuru
2026-02-27 21:45:43 -05:00
parent a65181251d
commit 1ed6d27ca7

View File

@@ -9,6 +9,11 @@ class ClientMainCubit extends Cubit<ClientMainState> implements Disposable {
_onRouteChanged(); _onRouteChanged();
} }
static const List<String> _hideBottomBarPaths = <String>[
ClientPaths.completionReview,
ClientPaths.awaitingApproval,
];
void _onRouteChanged() { void _onRouteChanged() {
final String path = Modular.to.path; final String path = Modular.to.path;
int newIndex = state.currentIndex; int newIndex = state.currentIndex;
@@ -26,9 +31,7 @@ class ClientMainCubit extends Cubit<ClientMainState> implements Disposable {
newIndex = 4; newIndex = 4;
} }
final bool showBottomBar = final bool showBottomBar = !_hideBottomBarPaths.any(path.contains);
!path.contains(ClientPaths.completionReview) &&
!path.contains(ClientPaths.awaitingApproval);
if (newIndex != state.currentIndex || if (newIndex != state.currentIndex ||
showBottomBar != state.showBottomBar) { showBottomBar != state.showBottomBar) {