Skip to content

Commit

Permalink
Added btn in project view to open in file manager
Browse files Browse the repository at this point in the history
Closes #26
  • Loading branch information
TechnicJelle committed Nov 3, 2024
1 parent 0553a33 commit a717719
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "main_menu/main_menu.dart";
import "main_menu/projects/projects_screen.dart";
import "prefs.dart";
import "project_view/close_project_button.dart";
import "project_view/open_in_explorer_button.dart";
import "project_view/project_view.dart";
import "tech_app.dart";

Expand Down Expand Up @@ -61,7 +62,10 @@ class MyHomePage extends ConsumerWidget {
title: Text(title),
actions: [
const Text("Version: $version\nBlueMap: $blueMapTag"),
if (projectDirectory != null) const CloseProjectButton(),
if (projectDirectory != null) ...[
const OpenInFileManagerButton(),
const CloseProjectButton(),
]
],
),
body: projectDirectory == null ? const MainMenu() : const ProjectView(),
Expand Down
24 changes: 24 additions & 0 deletions lib/project_view/open_in_explorer_button.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import "dart:io";

import "package:flutter/material.dart";
import "package:flutter_riverpod/flutter_riverpod.dart";
import "package:url_launcher/url_launcher.dart";

import "../main_menu/projects/projects_screen.dart";

class OpenInFileManagerButton extends ConsumerWidget {
const OpenInFileManagerButton({super.key});

@override
Widget build(BuildContext context, WidgetRef ref) {
return IconButton(
tooltip: "Open in file manager",
onPressed: () {
final Directory? projectDirectory = ref.read(openProjectProvider);
if (projectDirectory == null) return;
launchUrl(projectDirectory.uri);
},
icon: const Icon(Icons.folder_open),
);
}
}

0 comments on commit a717719

Please sign in to comment.