Skip to content

Commit

Permalink
print -> log
Browse files Browse the repository at this point in the history
  • Loading branch information
gnunicorn committed Aug 16, 2024
1 parent 8bcb9b5 commit dd99604
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/lib/config/desktop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:acter/common/utils/routes.dart';
import 'package:acter/router/router.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:go_router/go_router.dart';
import 'package:tray_manager/tray_manager.dart';
import 'package:window_manager/window_manager.dart';
Expand Down Expand Up @@ -104,12 +103,11 @@ class _DesktopSupportState extends State<DesktopSupport>
@override
void onTrayIconMouseDown() async {
// toggle visiblity
print("toggled");
if (await windowManager.isVisible()) {
print('hiding');
_log.info('hiding window on toggle');
await windowManager.hide();
} else {
print('showing');
_log.info('showing window on toggle');
await windowManager.show();
}
}
Expand All @@ -123,17 +121,21 @@ class _DesktopSupportState extends State<DesktopSupport>
@override
void onTrayMenuItemClick(MenuItem menuItem) async {
if (menuItem.key == 'exit_app') {
_log.info('exit app');
await windowManager.destroy();
return;
}

await windowManager.show();
WidgetsBinding.instance.addPostFrameCallback((Duration duration) async {
if (menuItem.key == 'home') {
_log.info('route home');
rootNavKey.currentContext!.pushNamed(Routes.main.name);
} else if (menuItem.key == 'chat') {
_log.info('route chat');
rootNavKey.currentContext!.pushNamed(Routes.chat.name);
} else if (menuItem.key == 'activities') {
_log.info('route activities');
rootNavKey.currentContext!.pushNamed(Routes.activities.name);
}
});
Expand Down

0 comments on commit dd99604

Please sign in to comment.