mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-25 19:27:24 +02:00
desktop: Switch to file_picker
This commit is contained in:
parent
777c89fed4
commit
25b0a9f436
6 changed files with 9 additions and 21 deletions
|
|
@ -1,21 +1,13 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:file_chooser/file_chooser.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:musicus_common/musicus_common.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
class MusicusDesktopPlatform extends MusicusPlatform {
|
||||
@override
|
||||
Future<String> chooseBasePath() async {
|
||||
final result = await showOpenPanel(
|
||||
canSelectDirectories: true,
|
||||
);
|
||||
|
||||
if (result != null && !result.canceled) {
|
||||
return result.paths.first;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return await FilePicker.platform.getDirectoryPath();
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@ add_custom_command(
|
|||
COMMAND ${CMAKE_COMMAND} -E env
|
||||
${FLUTTER_TOOL_ENVIRONMENT}
|
||||
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
|
||||
linux-x64 ${CMAKE_BUILD_TYPE}
|
||||
${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
|
||||
VERBATIM
|
||||
)
|
||||
add_custom_target(flutter_assemble DEPENDS
|
||||
"${FLUTTER_LIBRARY}"
|
||||
|
|
|
|||
|
|
@ -2,15 +2,13 @@
|
|||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <file_chooser/file_chooser_plugin.h>
|
||||
#include <url_launcher_linux/url_launcher_plugin.h>
|
||||
|
||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||
g_autoptr(FlPluginRegistrar) file_chooser_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "FileChooserPlugin");
|
||||
file_chooser_plugin_register_with_registrar(file_chooser_registrar);
|
||||
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
|
||||
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#ifndef GENERATED_PLUGIN_REGISTRANT_
|
||||
#define GENERATED_PLUGIN_REGISTRANT_
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
file_chooser
|
||||
url_launcher_linux
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,11 +6,7 @@ environment:
|
|||
sdk: ">=2.3.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
file_chooser:
|
||||
git:
|
||||
url: git://github.com/google/flutter-desktop-embedding.git
|
||||
path: plugins/file_chooser
|
||||
ref: bd722fbdb6d491d4b7781c240543ed3b3b181063
|
||||
file_picker: ^4.5.1
|
||||
flutter:
|
||||
sdk: flutter
|
||||
musicus_common:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue