mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-03 17:40:43 +00:00
Merge pull request #802 from cake-tech/CW-321-lock-app-feature-on-mac
Add app lock feature on mac
This commit is contained in:
commit
f0164db47f
3 changed files with 43 additions and 24 deletions
|
@ -4,12 +4,14 @@ class SideMenuItem extends StatelessWidget {
|
|||
const SideMenuItem({
|
||||
Key? key,
|
||||
required this.onTap,
|
||||
required this.iconPath,
|
||||
required this.isSelected,
|
||||
}) : super(key: key);
|
||||
this.imagePath,
|
||||
this.icon,
|
||||
this.isSelected = false,
|
||||
}) : assert((icon != null && imagePath == null) || (icon == null && imagePath != null));
|
||||
|
||||
final void Function() onTap;
|
||||
final String iconPath;
|
||||
final String? imagePath;
|
||||
final IconData? icon;
|
||||
final bool isSelected;
|
||||
|
||||
Color _setColor(BuildContext context) {
|
||||
|
@ -25,8 +27,13 @@ class SideMenuItem extends StatelessWidget {
|
|||
return InkWell(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: Image.asset(
|
||||
iconPath,
|
||||
child: icon != null
|
||||
? Icon(
|
||||
icon,
|
||||
color: _setColor(context),
|
||||
)
|
||||
: Image.asset(
|
||||
imagePath ?? '',
|
||||
fit: BoxFit.cover,
|
||||
height: 30,
|
||||
width: 30,
|
||||
|
|
|
@ -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) {
|
||||
if (isAuthenticatedSuccessfully) {
|
||||
auth.close();
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
],
|
||||
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,10 +17,8 @@ abstract class DesktopSidebarViewModelBase with Store {
|
|||
@observable
|
||||
SidebarItem currentPage = SidebarItem.dashboard;
|
||||
|
||||
|
||||
@action
|
||||
void onPageChange(SidebarItem item) {
|
||||
|
||||
if (currentPage == item) {
|
||||
resetSidebar();
|
||||
|
||||
|
|
Loading…
Reference in a new issue