mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-03 17:40:43 +00:00
Merge branch 'dashboard-desktop-view' of https://github.com/cake-tech/cake_wallet into desktop-ui-enhancements
This commit is contained in:
commit
26a7bfcee5
3 changed files with 43 additions and 24 deletions
|
@ -4,34 +4,41 @@ class SideMenuItem extends StatelessWidget {
|
||||||
const SideMenuItem({
|
const SideMenuItem({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.onTap,
|
required this.onTap,
|
||||||
required this.iconPath,
|
this.imagePath,
|
||||||
required this.isSelected,
|
this.icon,
|
||||||
}) : super(key: key);
|
this.isSelected = false,
|
||||||
|
}) : assert((icon != null && imagePath == null) || (icon == null && imagePath != null));
|
||||||
|
|
||||||
final void Function() onTap;
|
final void Function() onTap;
|
||||||
final String iconPath;
|
final String? imagePath;
|
||||||
|
final IconData? icon;
|
||||||
final bool isSelected;
|
final bool isSelected;
|
||||||
|
|
||||||
Color _setColor(BuildContext context) {
|
Color _setColor(BuildContext context) {
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
return Theme.of(context).primaryTextTheme.headline6!.color!;
|
return Theme.of(context).primaryTextTheme.headline6!.color!;
|
||||||
} else {
|
} else {
|
||||||
return Theme.of(context).highlightColor;
|
return Theme.of(context).highlightColor;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(20),
|
padding: EdgeInsets.all(20),
|
||||||
child: Image.asset(
|
child: icon != null
|
||||||
iconPath,
|
? Icon(
|
||||||
fit: BoxFit.cover,
|
icon,
|
||||||
height: 30,
|
color: _setColor(context),
|
||||||
width: 30,
|
)
|
||||||
color: _setColor(context),
|
: Image.asset(
|
||||||
),
|
imagePath ?? '',
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
height: 30,
|
||||||
|
width: 30,
|
||||||
|
color: _setColor(context),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
onTap: () => onTap.call(),
|
onTap: () => onTap.call(),
|
||||||
highlightColor: Colors.transparent,
|
highlightColor: Colors.transparent,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:cake_wallet/di.dart';
|
import 'package:cake_wallet/di.dart';
|
||||||
import 'package:cake_wallet/routes.dart';
|
import 'package:cake_wallet/routes.dart';
|
||||||
|
import 'package:cake_wallet/src/screens/auth/auth_page.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/base_page.dart';
|
||||||
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_dashboard_navbar.dart';
|
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_dashboard_navbar.dart';
|
||||||
|
@ -93,18 +94,31 @@ class DesktopSidebarWrapper extends BasePage {
|
||||||
width: sideMenuWidth,
|
width: sideMenuWidth,
|
||||||
topItems: [
|
topItems: [
|
||||||
SideMenuItem(
|
SideMenuItem(
|
||||||
iconPath: 'assets/images/wallet_outline.png',
|
imagePath: 'assets/images/wallet_outline.png',
|
||||||
isSelected: desktopSidebarViewModel.currentPage == SidebarItem.dashboard,
|
isSelected: desktopSidebarViewModel.currentPage == SidebarItem.dashboard,
|
||||||
onTap: () => desktopSidebarViewModel.onPageChange(SidebarItem.dashboard),
|
onTap: () => desktopSidebarViewModel.onPageChange(SidebarItem.dashboard),
|
||||||
),
|
),
|
||||||
|
SideMenuItem(
|
||||||
|
icon: Icons.lock_outline,
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
Routes.unlock,
|
||||||
|
arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) {
|
||||||
|
if (isAuthenticatedSuccessfully) {
|
||||||
|
auth.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
],
|
],
|
||||||
bottomItems: [
|
bottomItems: [
|
||||||
SideMenuItem(
|
SideMenuItem(
|
||||||
iconPath: 'assets/images/support_icon.png',
|
imagePath: 'assets/images/support_icon.png',
|
||||||
isSelected: desktopSidebarViewModel.currentPage == SidebarItem.support,
|
isSelected: desktopSidebarViewModel.currentPage == SidebarItem.support,
|
||||||
onTap: () => desktopSidebarViewModel.onPageChange(SidebarItem.support)),
|
onTap: () => desktopSidebarViewModel.onPageChange(SidebarItem.support)),
|
||||||
SideMenuItem(
|
SideMenuItem(
|
||||||
iconPath: 'assets/images/settings_outline.png',
|
imagePath: 'assets/images/settings_outline.png',
|
||||||
isSelected: desktopSidebarViewModel.currentPage == SidebarItem.settings,
|
isSelected: desktopSidebarViewModel.currentPage == SidebarItem.settings,
|
||||||
onTap: () => desktopSidebarViewModel.onPageChange(SidebarItem.settings),
|
onTap: () => desktopSidebarViewModel.onPageChange(SidebarItem.settings),
|
||||||
),
|
),
|
||||||
|
|
|
@ -17,13 +17,11 @@ abstract class DesktopSidebarViewModelBase with Store {
|
||||||
@observable
|
@observable
|
||||||
SidebarItem currentPage = SidebarItem.dashboard;
|
SidebarItem currentPage = SidebarItem.dashboard;
|
||||||
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
void onPageChange(SidebarItem item) {
|
void onPageChange(SidebarItem item) {
|
||||||
|
if (currentPage == item) {
|
||||||
if(currentPage == item){
|
|
||||||
resetSidebar();
|
resetSidebar();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
currentPage = item;
|
currentPage = item;
|
||||||
|
|
Loading…
Reference in a new issue