mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 20:19:25 +00:00
36 lines
644 B
Dart
36 lines
644 B
Dart
import 'package:mobx/mobx.dart';
|
|
|
|
part 'desktop_sidebar_view_model.g.dart';
|
|
|
|
enum SidebarItem {
|
|
dashboard,
|
|
support,
|
|
settings,
|
|
transactions;
|
|
}
|
|
|
|
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;
|
|
}
|
|
currentPage = item;
|
|
}
|
|
|
|
@action
|
|
void resetSidebar() {
|
|
currentPage = SidebarItem.dashboard;
|
|
}
|
|
}
|