refactor: Centralize bottom bar visibility paths into a list and simplify the conditional check.
This commit is contained in:
@@ -9,6 +9,11 @@ class ClientMainCubit extends Cubit<ClientMainState> implements Disposable {
|
||||
_onRouteChanged();
|
||||
}
|
||||
|
||||
static const List<String> _hideBottomBarPaths = <String>[
|
||||
ClientPaths.completionReview,
|
||||
ClientPaths.awaitingApproval,
|
||||
];
|
||||
|
||||
void _onRouteChanged() {
|
||||
final String path = Modular.to.path;
|
||||
int newIndex = state.currentIndex;
|
||||
@@ -26,9 +31,7 @@ class ClientMainCubit extends Cubit<ClientMainState> implements Disposable {
|
||||
newIndex = 4;
|
||||
}
|
||||
|
||||
final bool showBottomBar =
|
||||
!path.contains(ClientPaths.completionReview) &&
|
||||
!path.contains(ClientPaths.awaitingApproval);
|
||||
final bool showBottomBar = !_hideBottomBarPaths.any(path.contains);
|
||||
|
||||
if (newIndex != state.currentIndex ||
|
||||
showBottomBar != state.showBottomBar) {
|
||||
|
||||
Reference in New Issue
Block a user