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