cake_wallet/lib/view_model/dashboard/desktop_sidebar_view_model.dart

37 lines
644 B
Dart
Raw Normal View History

2023-02-10 22:32:26 +00:00
import 'package:mobx/mobx.dart';
part 'desktop_sidebar_view_model.g.dart';
enum SidebarItem {
dashboard,
support,
settings,
transactions;
2023-02-10 22:32:26 +00:00
}
class DesktopSidebarViewModel = DesktopSidebarViewModelBase with _$DesktopSidebarViewModel;
abstract class DesktopSidebarViewModelBase with Store {
DesktopSidebarViewModelBase();
@observable
SidebarItem currentPage = SidebarItem.dashboard;
@action
void onPageChange(SidebarItem item) {
if(currentPage == item){
resetSidebar();
return;
}
2023-02-10 22:32:26 +00:00
currentPage = item;
}
@action
void resetSidebar() {
currentPage = SidebarItem.dashboard;
}
}