cake_wallet/lib/view_model/dashboard/desktop_sidebar_view_model.dart

35 lines
634 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) {
2023-02-24 12:24:40 +00:00
if (currentPage == item) {
resetSidebar();
2023-02-24 12:24:40 +00:00
return;
}
2023-02-10 22:32:26 +00:00
currentPage = item;
}
@action
void resetSidebar() {
currentPage = SidebarItem.dashboard;
}
}