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();
|
_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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user