Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(macOS): Traffic lights reset after showing file seletor #168

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/screens/home/widgets/welcome.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import 'dart:io';
import 'package:provider/provider.dart';
import 'package:fluent_ui/fluent_ui.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:file_selector/file_selector.dart';
import 'package:permission_handler/permission_handler.dart';

import '../../../utils/ax_shadow.dart';
import '../../../utils/dialogs/failed_to_initialize_library.dart';
import '../../../providers/library_path.dart';
import '../../../providers/library_manager.dart';
import '../../../providers/responsive_providers.dart';
import '../../../utils/get_dir_path.dart';
import '../../../utils/l10n.dart';

class WelcomePage extends StatelessWidget {
Expand Down Expand Up @@ -79,7 +79,7 @@ class WelcomePage extends StatelessWidget {
// on Android, check for permission
if (!await requestAndroidPermission()) return;

final path = await getDirectoryPath();
final path = await getDirPath();

if (path == null) return;
if (!context.mounted) return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:provider/provider.dart';
import 'package:fluent_ui/fluent_ui.dart';
import 'package:file_selector/file_selector.dart';
import 'package:material_symbols_icons/symbols.dart';

import '../../../utils/api/close_library.dart';
import '../../../utils/get_dir_path.dart';
import '../../../utils/router/navigation.dart';
import '../../../utils/dialogs/failed_to_initialize_library.dart';
import '../../../providers/library_manager.dart';
Expand Down Expand Up @@ -33,7 +33,7 @@ class AddLibrarySettingButton extends StatelessWidget {
title: S.of(context).addLibrary,
subtitle: S.of(context).addLibrarySubtitle,
onPressed: () async {
final path = await getDirectoryPath();
final path = await getDirPath();

if (path == null) return;
if (!context.mounted) return;
Expand Down
15 changes: 15 additions & 0 deletions lib/utils/get_dir_path.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'dart:io';

import 'package:file_selector/file_selector.dart';

import 'macos_window_control_button_manager.dart';

// TODO(hexagram): This is a temporary solution, not the best way to handle this callback.
// Once BitsdojoWindow is forked and rewritten, using NSWindowDelagate to listen for windowDidEndSheet and windowWillBeginSheet will be a more general andbetter solution to handle this.
Future<String?> getDirPath() async {
XMLHexagram marked this conversation as resolved.
Show resolved Hide resolved
final path = await getDirectoryPath();
if (Platform.isMacOS) {
MacOSWindowControlButtonManager.setVertical();
}
return path;
}
Loading