mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-05 10:29:23 +00:00
Merge branch 'CW-311-remove-drawer-from-mac-os' of https://github.com/cake-tech/cake_wallet into desktop-ui-for-exchange-send
Conflicts: lib/src/screens/dashboard/desktop_dashboard_page.dart lib/src/screens/dashboard/desktop_widgets/desktop_sidebar_wrapper.dart
This commit is contained in:
commit
b1947426fb
8 changed files with 127 additions and 78 deletions
|
@ -7,6 +7,7 @@ import 'package:cake_wallet/ionia/ionia_anypay.dart';
|
||||||
import 'package:cake_wallet/ionia/ionia_gift_card.dart';
|
import 'package:cake_wallet/ionia/ionia_gift_card.dart';
|
||||||
import 'package:cake_wallet/ionia/ionia_tip.dart';
|
import 'package:cake_wallet/ionia/ionia_tip.dart';
|
||||||
import 'package:cake_wallet/src/screens/buy/onramper_page.dart';
|
import 'package:cake_wallet/src/screens/buy/onramper_page.dart';
|
||||||
|
import 'package:cake_wallet/src/screens/dashboard/desktop_dashboard_page.dart';
|
||||||
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_wallet_selection_dropdown.dart';
|
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_wallet_selection_dropdown.dart';
|
||||||
import 'package:cake_wallet/src/screens/dashboard/widgets/transactions_page.dart';
|
import 'package:cake_wallet/src/screens/dashboard/widgets/transactions_page.dart';
|
||||||
import 'package:cake_wallet/src/screens/settings/display_settings_page.dart';
|
import 'package:cake_wallet/src/screens/settings/display_settings_page.dart';
|
||||||
|
@ -368,7 +369,12 @@ Future setup(
|
||||||
getIt.registerFactory(() =>
|
getIt.registerFactory(() =>
|
||||||
BalancePage(dashboardViewModel: getIt.get<DashboardViewModel>(), settingsStore: getIt.get<SettingsStore>()));
|
BalancePage(dashboardViewModel: getIt.get<DashboardViewModel>(), settingsStore: getIt.get<SettingsStore>()));
|
||||||
|
|
||||||
getIt.registerFactory<DashboardPage>(() => DashboardPage( balancePage: getIt.get<BalancePage>(), walletViewModel: getIt.get<DashboardViewModel>(), addressListViewModel: getIt.get<WalletAddressListViewModel>()));
|
getIt.registerFactory<DashboardPage>(() => DashboardPage(
|
||||||
|
balancePage: getIt.get<BalancePage>(),
|
||||||
|
walletViewModel: getIt.get<DashboardViewModel>(),
|
||||||
|
addressListViewModel: getIt.get<WalletAddressListViewModel>(),
|
||||||
|
desktopSidebarViewModel: getIt.get<DesktopSidebarViewModel>(),
|
||||||
|
));
|
||||||
getIt.registerFactory<TransactionsPage>(() => TransactionsPage(dashboardViewModel: getIt.get<DashboardViewModel>()));
|
getIt.registerFactory<TransactionsPage>(() => TransactionsPage(dashboardViewModel: getIt.get<DashboardViewModel>()));
|
||||||
getIt.registerFactory<ReceivePage>(() => ReceivePage(
|
getIt.registerFactory<ReceivePage>(() => ReceivePage(
|
||||||
addressListViewModel: getIt.get<WalletAddressListViewModel>()));
|
addressListViewModel: getIt.get<WalletAddressListViewModel>()));
|
||||||
|
|
|
@ -25,21 +25,23 @@ import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
|
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
|
||||||
import 'package:cake_wallet/main.dart';
|
import 'package:cake_wallet/main.dart';
|
||||||
|
import 'package:cake_wallet/router.dart' as Router;
|
||||||
|
|
||||||
class DashboardPage extends StatelessWidget {
|
class DashboardPage extends StatelessWidget {
|
||||||
DashboardPage({
|
DashboardPage({
|
||||||
required this.balancePage,
|
required this.balancePage,
|
||||||
required this.walletViewModel,
|
required this.walletViewModel,
|
||||||
required this.addressListViewModel,
|
required this.addressListViewModel,
|
||||||
|
required this.desktopSidebarViewModel,
|
||||||
});
|
});
|
||||||
|
|
||||||
final BalancePage balancePage;
|
final BalancePage balancePage;
|
||||||
final DashboardViewModel walletViewModel;
|
final DashboardViewModel walletViewModel;
|
||||||
final WalletAddressListViewModel addressListViewModel;
|
final WalletAddressListViewModel addressListViewModel;
|
||||||
|
final DesktopSidebarViewModel desktopSidebarViewModel;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final desktopSidebarViewModel = getIt<DesktopSidebarViewModel>();
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: ResponsiveLayoutUtil.instance.isMobile(context)
|
body: ResponsiveLayoutUtil.instance.isMobile(context)
|
||||||
? _DashboardPageView(
|
? _DashboardPageView(
|
||||||
|
@ -49,6 +51,7 @@ class DashboardPage extends StatelessWidget {
|
||||||
)
|
)
|
||||||
: DesktopSidebarWrapper(
|
: DesktopSidebarWrapper(
|
||||||
desktopSidebarViewModel: desktopSidebarViewModel,
|
desktopSidebarViewModel: desktopSidebarViewModel,
|
||||||
|
dashboardViewModel: walletViewModel,
|
||||||
child: DesktopDashboardPage(
|
child: DesktopDashboardPage(
|
||||||
desktopSidebarViewModel: desktopSidebarViewModel,
|
desktopSidebarViewModel: desktopSidebarViewModel,
|
||||||
balancePage: balancePage,
|
balancePage: balancePage,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_dashboard_view.dart';
|
||||||
import 'package:cake_wallet/di.dart';
|
import 'package:cake_wallet/di.dart';
|
||||||
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_wallet_selection_dropdown.dart';
|
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_wallet_selection_dropdown.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
import 'package:cake_wallet/routes.dart';
|
|
||||||
import 'package:cake_wallet/src/screens/yat_emoji_id.dart';
|
import 'package:cake_wallet/src/screens/yat_emoji_id.dart';
|
||||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||||
import 'package:cake_wallet/themes/theme_base.dart';
|
import 'package:cake_wallet/themes/theme_base.dart';
|
||||||
|
@ -12,9 +12,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||||
import 'package:cake_wallet/src/screens/dashboard/widgets/balance_page.dart';
|
import 'package:cake_wallet/src/screens/dashboard/widgets/balance_page.dart';
|
||||||
import 'package:cake_wallet/src/screens/dashboard/widgets/sync_indicator.dart';
|
|
||||||
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
|
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
|
||||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:cake_wallet/main.dart';
|
import 'package:cake_wallet/main.dart';
|
||||||
import 'package:cake_wallet/router.dart' as Router;
|
import 'package:cake_wallet/router.dart' as Router;
|
||||||
|
@ -36,63 +34,12 @@ class DesktopDashboardPage extends BasePage {
|
||||||
@override
|
@override
|
||||||
Color get backgroundDarkColor => Colors.transparent;
|
Color get backgroundDarkColor => Colors.transparent;
|
||||||
|
|
||||||
@override
|
|
||||||
Widget Function(BuildContext, Widget) get rootWrapper =>
|
|
||||||
(BuildContext context, Widget scaffold) => Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
gradient: LinearGradient(colors: [
|
|
||||||
Theme.of(context).accentColor,
|
|
||||||
Theme.of(context).scaffoldBackgroundColor,
|
|
||||||
Theme.of(context).primaryColor,
|
|
||||||
], begin: Alignment.topRight, end: Alignment.bottomLeft)),
|
|
||||||
child: scaffold);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get resizeToAvoidBottomInset => false;
|
bool get resizeToAvoidBottomInset => false;
|
||||||
|
|
||||||
@override
|
|
||||||
Widget? leading(BuildContext context) => getIt<DesktopWalletSelectionDropDown>();
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget middle(BuildContext context) {
|
|
||||||
return SyncIndicator(
|
|
||||||
dashboardViewModel: walletViewModel,
|
|
||||||
onTap: () => Navigator.of(context, rootNavigator: true).pushNamed(Routes.connectionSync));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget trailing(BuildContext context) {
|
|
||||||
final selectedIconPath = 'assets/images/desktop_transactions_solid_icon.png';
|
|
||||||
final unselectedIconPath = 'assets/images/desktop_transactions_outline_icon.png';
|
|
||||||
|
|
||||||
return InkWell(
|
|
||||||
onTap: () {
|
|
||||||
String? currentPath;
|
|
||||||
|
|
||||||
desktopKey.currentState?.popUntil((route) {
|
|
||||||
currentPath = route.settings.name;
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (currentPath == Routes.transactionsPage) {
|
|
||||||
desktopSidebarViewModel.resetSidebar();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
desktopSidebarViewModel.onPageChange(SidebarItem.transactions);
|
|
||||||
|
|
||||||
desktopKey.currentState!.pushNamed(Routes.transactionsPage);
|
|
||||||
},
|
|
||||||
child: Observer(
|
|
||||||
builder: (_) {
|
|
||||||
return Image.asset(
|
|
||||||
desktopSidebarViewModel.currentPage == SidebarItem.transactions
|
|
||||||
? selectedIconPath
|
|
||||||
: unselectedIconPath,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
final BalancePage balancePage;
|
final BalancePage balancePage;
|
||||||
final DashboardViewModel walletViewModel;
|
final DashboardViewModel walletViewModel;
|
||||||
|
|
|
@ -6,19 +6,21 @@ class SideMenu extends StatelessWidget {
|
||||||
super.key,
|
super.key,
|
||||||
required this.topItems,
|
required this.topItems,
|
||||||
required this.bottomItems,
|
required this.bottomItems,
|
||||||
|
required this.width,
|
||||||
});
|
});
|
||||||
|
|
||||||
final List<SideMenuItem> topItems;
|
final List<SideMenuItem> topItems;
|
||||||
final List<SideMenuItem> bottomItems;
|
final List<SideMenuItem> bottomItems;
|
||||||
|
final double width;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
color: Colors.black.withOpacity(0.1),
|
color: Colors.black.withOpacity(0.1),
|
||||||
width: 76,
|
width: width,
|
||||||
height: MediaQuery.of(context).size.height,
|
height: MediaQuery.of(context).size.height,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: 20),
|
|
||||||
...topItems,
|
...topItems,
|
||||||
Spacer(),
|
Spacer(),
|
||||||
...bottomItems,
|
...bottomItems,
|
||||||
|
|
|
@ -12,9 +12,7 @@ class SideMenuItem extends StatelessWidget {
|
||||||
final String iconPath;
|
final String iconPath;
|
||||||
final bool isSelected;
|
final bool isSelected;
|
||||||
|
|
||||||
@override
|
Color _setColor(BuildContext context) {
|
||||||
Widget build(BuildContext context) {
|
|
||||||
Color _setColor() {
|
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
return Theme.of(context).primaryTextTheme.headline6!.color!;
|
return Theme.of(context).primaryTextTheme.headline6!.color!;
|
||||||
} else {
|
} else {
|
||||||
|
@ -22,6 +20,8 @@ class SideMenuItem extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(20),
|
padding: EdgeInsets.all(20),
|
||||||
|
@ -30,7 +30,7 @@ class SideMenuItem extends StatelessWidget {
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
height: 30,
|
height: 30,
|
||||||
width: 30,
|
width: 30,
|
||||||
color: _setColor(),
|
color: _setColor(context),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () => onTap.call(),
|
onTap: () => onTap.call(),
|
||||||
|
|
|
@ -1,23 +1,111 @@
|
||||||
|
import 'package:cake_wallet/di.dart';
|
||||||
import 'package:cake_wallet/routes.dart';
|
import 'package:cake_wallet/routes.dart';
|
||||||
import 'package:cake_wallet/src/screens/dashboard/desktop_dashboard_page.dart';
|
import 'package:cake_wallet/src/screens/dashboard/desktop_dashboard_page.dart';
|
||||||
|
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||||
|
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_dashboard_view.dart';
|
||||||
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_sidebar/side_menu.dart';
|
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_sidebar/side_menu.dart';
|
||||||
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_sidebar/side_menu_item.dart';
|
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_sidebar/side_menu_item.dart';
|
||||||
|
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_wallet_selection_dropdown.dart';
|
||||||
|
import 'package:cake_wallet/src/screens/dashboard/widgets/sync_indicator.dart';
|
||||||
|
import 'package:cake_wallet/themes/theme_base.dart';
|
||||||
|
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||||
import 'package:cake_wallet/view_model/dashboard/desktop_sidebar_view_model.dart';
|
import 'package:cake_wallet/view_model/dashboard/desktop_sidebar_view_model.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:cake_wallet/router.dart' as Router;
|
|
||||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
|
import 'package:cake_wallet/router.dart' as Router;
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
|
|
||||||
class DesktopSidebarWrapper extends StatelessWidget {
|
class DesktopSidebarWrapper extends BasePage {
|
||||||
final Widget child;
|
final Widget child;
|
||||||
final DesktopSidebarViewModel desktopSidebarViewModel;
|
final DesktopSidebarViewModel desktopSidebarViewModel;
|
||||||
|
final DashboardViewModel dashboardViewModel;
|
||||||
|
|
||||||
const DesktopSidebarWrapper({required this.child, required this.desktopSidebarViewModel});
|
DesktopSidebarWrapper({
|
||||||
|
required this.child,
|
||||||
|
required this.desktopSidebarViewModel,
|
||||||
|
required this.dashboardViewModel,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Color get backgroundLightColor =>
|
||||||
|
currentTheme.type == ThemeType.bright ? Colors.transparent : Colors.white;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get backgroundDarkColor => Colors.transparent;
|
||||||
|
|
||||||
final pageController = PageController();
|
final pageController = PageController();
|
||||||
|
|
||||||
|
final selectedIconPath = 'assets/images/desktop_transactions_solid_icon.png';
|
||||||
|
final unselectedIconPath = 'assets/images/desktop_transactions_outline_icon.png';
|
||||||
|
double get sideMenuWidth => 76.0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget Function(BuildContext, Widget) get rootWrapper =>
|
||||||
|
(BuildContext context, Widget scaffold) => Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
colors: [
|
||||||
|
Theme.of(context).accentColor,
|
||||||
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
|
Theme.of(context).primaryColor,
|
||||||
|
],
|
||||||
|
begin: Alignment.topRight,
|
||||||
|
end: Alignment.bottomLeft,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: scaffold,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget? leading(BuildContext context) => Padding(
|
||||||
|
padding: EdgeInsets.only(left: sideMenuWidth),
|
||||||
|
child: getIt<DesktopWalletSelectionDropDown>(),
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget middle(BuildContext context) {
|
||||||
|
return SyncIndicator(
|
||||||
|
dashboardViewModel: dashboardViewModel,
|
||||||
|
onTap: () => Navigator.of(context, rootNavigator: true).pushNamed(Routes.connectionSync));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget trailing(BuildContext context) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: () {
|
||||||
|
String? currentPath;
|
||||||
|
|
||||||
|
desktopKey.currentState?.popUntil((route) {
|
||||||
|
currentPath = route.settings.name;
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
switch (currentPath) {
|
||||||
|
case Routes.transactionsPage:
|
||||||
|
desktopSidebarViewModel.resetSidebar();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
desktopSidebarViewModel.resetSidebar();
|
||||||
|
Future.delayed(Duration(milliseconds: 10), () {
|
||||||
|
desktopSidebarViewModel.onPageChange(SidebarItem.transactions);
|
||||||
|
desktopKey.currentState?.pushNamed(Routes.transactionsPage);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Observer(
|
||||||
|
builder: (_) {
|
||||||
|
return Image.asset(
|
||||||
|
desktopSidebarViewModel.currentPage == SidebarItem.transactions
|
||||||
|
? selectedIconPath
|
||||||
|
: unselectedIconPath,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget body(BuildContext context) {
|
||||||
reaction<SidebarItem>((_) => desktopSidebarViewModel.currentPage, (page) {
|
reaction<SidebarItem>((_) => desktopSidebarViewModel.currentPage, (page) {
|
||||||
String? currentPath;
|
String? currentPath;
|
||||||
|
|
||||||
|
@ -41,6 +129,7 @@ class DesktopSidebarWrapper extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
Observer(builder: (_) {
|
Observer(builder: (_) {
|
||||||
return SideMenu(
|
return SideMenu(
|
||||||
|
width: sideMenuWidth,
|
||||||
topItems: [
|
topItems: [
|
||||||
SideMenuItem(
|
SideMenuItem(
|
||||||
iconPath: 'assets/images/wallet_outline.png',
|
iconPath: 'assets/images/wallet_outline.png',
|
||||||
|
@ -68,6 +157,7 @@ class DesktopSidebarWrapper extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
child,
|
child,
|
||||||
Container(
|
Container(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
child: Navigator(
|
child: Navigator(
|
||||||
initialRoute: Routes.support,
|
initialRoute: Routes.support,
|
||||||
onGenerateRoute: (settings) => Router.createRoute(settings),
|
onGenerateRoute: (settings) => Router.createRoute(settings),
|
||||||
|
|
|
@ -16,14 +16,12 @@ class DesktopSettingsPage extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _DesktopSettingsPageState extends State<DesktopSettingsPage> {
|
class _DesktopSettingsPageState extends State<DesktopSettingsPage> {
|
||||||
int itemCount = SettingActions.all.length;
|
final int itemCount = SettingActions.all.length;
|
||||||
int? currentPage;
|
int? currentPage;
|
||||||
bool isTapped = false;
|
|
||||||
|
|
||||||
void _onItemChange(int index) {
|
void _onItemChange(int index) {
|
||||||
setState(() {
|
setState(() {
|
||||||
currentPage = index;
|
currentPage = index;
|
||||||
isTapped = true;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +52,7 @@ class _DesktopSettingsPageState extends State<DesktopSettingsPage> {
|
||||||
final isLastTile = index == itemCount;
|
final isLastTile = index == itemCount;
|
||||||
return SettingActionButton(
|
return SettingActionButton(
|
||||||
isLastTile: isLastTile,
|
isLastTile: isLastTile,
|
||||||
selectionActive: isTapped,
|
selectionActive: currentPage != null,
|
||||||
isSelected: currentPage == index,
|
isSelected: currentPage == index,
|
||||||
isArrowVisible: true,
|
isArrowVisible: true,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|
|
@ -3,13 +3,10 @@ import 'package:mobx/mobx.dart';
|
||||||
part 'desktop_sidebar_view_model.g.dart';
|
part 'desktop_sidebar_view_model.g.dart';
|
||||||
|
|
||||||
enum SidebarItem {
|
enum SidebarItem {
|
||||||
dashboard(0),
|
dashboard,
|
||||||
support(1),
|
support,
|
||||||
settings(2),
|
settings,
|
||||||
transactions(3);
|
transactions;
|
||||||
|
|
||||||
final int value;
|
|
||||||
const SidebarItem(this.value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DesktopSidebarViewModel = DesktopSidebarViewModelBase with _$DesktopSidebarViewModel;
|
class DesktopSidebarViewModel = DesktopSidebarViewModelBase with _$DesktopSidebarViewModel;
|
||||||
|
@ -23,6 +20,12 @@ abstract class DesktopSidebarViewModelBase with Store {
|
||||||
|
|
||||||
@action
|
@action
|
||||||
void onPageChange(SidebarItem item) {
|
void onPageChange(SidebarItem item) {
|
||||||
|
|
||||||
|
if(currentPage == item){
|
||||||
|
resetSidebar();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
currentPage = item;
|
currentPage = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue