├── .gitignore
├── LICENSE
├── README.md
├── TODO.md
├── package
├── .gitignore
├── .metadata
├── CHANGELOG.md
├── LICENSE
├── README.md
├── analysis_options.yaml
├── example
│ ├── .gitignore
│ ├── .metadata
│ ├── README.md
│ ├── analysis_options.yaml
│ ├── android
│ │ ├── .gitignore
│ │ ├── app
│ │ │ ├── build.gradle
│ │ │ └── src
│ │ │ │ ├── debug
│ │ │ │ └── AndroidManifest.xml
│ │ │ │ ├── main
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── kotlin
│ │ │ │ │ └── com
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── filesystem_picker_example
│ │ │ │ │ │ └── MainActivity.kt
│ │ │ │ └── res
│ │ │ │ │ ├── drawable-v21
│ │ │ │ │ └── launch_background.xml
│ │ │ │ │ ├── drawable
│ │ │ │ │ └── launch_background.xml
│ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── values-night
│ │ │ │ │ └── styles.xml
│ │ │ │ │ └── values
│ │ │ │ │ └── styles.xml
│ │ │ │ └── profile
│ │ │ │ └── AndroidManifest.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ └── gradle-wrapper.properties
│ │ └── settings.gradle
│ ├── ios
│ │ ├── .gitignore
│ │ ├── Flutter
│ │ │ ├── AppFrameworkInfo.plist
│ │ │ ├── Debug.xcconfig
│ │ │ └── Release.xcconfig
│ │ ├── Runner.xcodeproj
│ │ │ ├── project.pbxproj
│ │ │ ├── project.xcworkspace
│ │ │ │ ├── contents.xcworkspacedata
│ │ │ │ └── xcshareddata
│ │ │ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ │ │ └── WorkspaceSettings.xcsettings
│ │ │ └── xcshareddata
│ │ │ │ └── xcschemes
│ │ │ │ └── Runner.xcscheme
│ │ ├── Runner.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ │ └── WorkspaceSettings.xcsettings
│ │ └── Runner
│ │ │ ├── AppDelegate.swift
│ │ │ ├── Assets.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ │ ├── Icon-App-20x20@1x.png
│ │ │ │ ├── Icon-App-20x20@2x.png
│ │ │ │ ├── Icon-App-20x20@3x.png
│ │ │ │ ├── Icon-App-29x29@1x.png
│ │ │ │ ├── Icon-App-29x29@2x.png
│ │ │ │ ├── Icon-App-29x29@3x.png
│ │ │ │ ├── Icon-App-40x40@1x.png
│ │ │ │ ├── Icon-App-40x40@2x.png
│ │ │ │ ├── Icon-App-40x40@3x.png
│ │ │ │ ├── Icon-App-60x60@2x.png
│ │ │ │ ├── Icon-App-60x60@3x.png
│ │ │ │ ├── Icon-App-76x76@1x.png
│ │ │ │ ├── Icon-App-76x76@2x.png
│ │ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ │ └── LaunchImage.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── LaunchImage.png
│ │ │ │ ├── LaunchImage@2x.png
│ │ │ │ ├── LaunchImage@3x.png
│ │ │ │ └── README.md
│ │ │ ├── Base.lproj
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ │ ├── Info.plist
│ │ │ └── Runner-Bridging-Header.h
│ ├── lib
│ │ ├── main.dart
│ │ └── screens
│ │ │ ├── breadcrumbs_demo_screen.dart
│ │ │ ├── custom_theme_demo_screen.dart
│ │ │ ├── shortcuts_demo_screen.dart
│ │ │ ├── simple_demo_screen.dart
│ │ │ └── widgets
│ │ │ ├── demo_scaffold.dart
│ │ │ └── heading.dart
│ ├── linux
│ │ ├── .gitignore
│ │ ├── CMakeLists.txt
│ │ ├── flutter
│ │ │ ├── CMakeLists.txt
│ │ │ ├── generated_plugin_registrant.cc
│ │ │ ├── generated_plugin_registrant.h
│ │ │ └── generated_plugins.cmake
│ │ ├── main.cc
│ │ ├── my_application.cc
│ │ └── my_application.h
│ ├── macos
│ │ ├── .gitignore
│ │ ├── Flutter
│ │ │ ├── Flutter-Debug.xcconfig
│ │ │ ├── Flutter-Release.xcconfig
│ │ │ └── GeneratedPluginRegistrant.swift
│ │ ├── Runner.xcodeproj
│ │ │ ├── project.pbxproj
│ │ │ ├── project.xcworkspace
│ │ │ │ └── xcshareddata
│ │ │ │ │ └── IDEWorkspaceChecks.plist
│ │ │ └── xcshareddata
│ │ │ │ └── xcschemes
│ │ │ │ └── Runner.xcscheme
│ │ ├── Runner.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ └── Runner
│ │ │ ├── AppDelegate.swift
│ │ │ ├── Assets.xcassets
│ │ │ └── AppIcon.appiconset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── app_icon_1024.png
│ │ │ │ ├── app_icon_128.png
│ │ │ │ ├── app_icon_16.png
│ │ │ │ ├── app_icon_256.png
│ │ │ │ ├── app_icon_32.png
│ │ │ │ ├── app_icon_512.png
│ │ │ │ └── app_icon_64.png
│ │ │ ├── Base.lproj
│ │ │ └── MainMenu.xib
│ │ │ ├── Configs
│ │ │ ├── AppInfo.xcconfig
│ │ │ ├── Debug.xcconfig
│ │ │ ├── Release.xcconfig
│ │ │ └── Warnings.xcconfig
│ │ │ ├── DebugProfile.entitlements
│ │ │ ├── Info.plist
│ │ │ ├── MainFlutterWindow.swift
│ │ │ └── Release.entitlements
│ ├── pubspec.lock
│ ├── pubspec.yaml
│ ├── test
│ │ └── widget_test.dart
│ ├── web
│ │ ├── favicon.png
│ │ ├── icons
│ │ │ ├── Icon-192.png
│ │ │ ├── Icon-512.png
│ │ │ ├── Icon-maskable-192.png
│ │ │ └── Icon-maskable-512.png
│ │ ├── index.html
│ │ └── manifest.json
│ └── windows
│ │ ├── .gitignore
│ │ ├── CMakeLists.txt
│ │ ├── flutter
│ │ ├── CMakeLists.txt
│ │ ├── generated_plugin_registrant.cc
│ │ ├── generated_plugin_registrant.h
│ │ └── generated_plugins.cmake
│ │ └── runner
│ │ ├── CMakeLists.txt
│ │ ├── Runner.rc
│ │ ├── flutter_window.cpp
│ │ ├── flutter_window.h
│ │ ├── main.cpp
│ │ ├── resource.h
│ │ ├── resources
│ │ └── app_icon.ico
│ │ ├── runner.exe.manifest
│ │ ├── utils.cpp
│ │ ├── utils.h
│ │ ├── win32_window.cpp
│ │ └── win32_window.h
├── lib
│ ├── filesystem_picker.dart
│ └── src
│ │ ├── actions
│ │ ├── action.dart
│ │ ├── new_folder_action.dart
│ │ └── shakeable_dialogs.dart
│ │ ├── breadcrumbs.dart
│ │ ├── common.dart
│ │ ├── desktop_scroller.dart
│ │ ├── filesystem_list.dart
│ │ ├── filesystem_list_tile.dart
│ │ ├── listview_extensions.dart
│ │ ├── mouse_wheel_scroller.dart
│ │ ├── options
│ │ ├── picker_bottom_sheet_options.dart
│ │ ├── picker_dialog_options.dart
│ │ ├── picker_options.dart
│ │ └── theme
│ │ │ ├── _breadcrumbs_theme.dart
│ │ │ ├── _context_actions_button_theme.dart
│ │ │ ├── _context_actions_menu_theme.dart
│ │ │ ├── _context_actions_theme.dart
│ │ │ ├── _filelist_theme.dart
│ │ │ ├── _picker_action_theme.dart
│ │ │ ├── _topbar_theme.dart
│ │ │ ├── theme.dart
│ │ │ ├── theme_auto_system.dart
│ │ │ └── theme_base.dart
│ │ ├── picker_dialog.dart
│ │ ├── picker_page.dart
│ │ ├── progress_indicator.dart
│ │ ├── shortcuts
│ │ ├── shortcut.dart
│ │ ├── shortcuts_list_tile.dart
│ │ └── shortcuts_listview.dart
│ │ └── utils.dart
├── pubspec.lock
├── pubspec.yaml
└── screenshots
│ ├── picker_customization.png
│ └── types_of_picker.png
└── screenshots
├── context_actions.png
├── file_pick.png
├── folder_pick.png
├── picker_customization.png
├── shortcuts.png
└── types_of_picker.png
/.gitignore:
--------------------------------------------------------------------------------
1 | _playground/
2 | _temp/
3 | _doc/
4 | .vscode/
5 | build-doc.cmd
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | // Copyright 2020-2023 Andy Chentsov. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the names of its
14 | // contributors may be used to endorse or promote products derived from
15 | // this software without specific prior written permission.
16 | //
17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FileSystem Picker
2 |
3 | FileSystem file or folder picker dialog.
4 |
5 | Allows the user to browse the file system and pick a folder or file.
6 |
7 | [See more](package/README.md)
8 |
--------------------------------------------------------------------------------
/TODO.md:
--------------------------------------------------------------------------------
1 |
2 | [-] Material 3
3 |
4 | [-] Folder/File properties: DateTime & Size
5 | [?] Customizable FilesystemListTile
6 |
7 | [+] ContextActions Menu Theme
8 | [+] ContextActions Dialog Theme
9 |
--------------------------------------------------------------------------------
/package/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | .dart_tool/
26 | .flutter-plugins
27 | .flutter-plugins-dependencies
28 | .packages
29 | .pub-cache/
30 | .pub/
31 | build/
32 |
33 | # Android related
34 | **/android/**/gradle-wrapper.jar
35 | **/android/.gradle
36 | **/android/captures/
37 | **/android/gradlew
38 | **/android/gradlew.bat
39 | **/android/local.properties
40 | **/android/**/GeneratedPluginRegistrant.java
41 |
42 | # iOS/XCode related
43 | **/ios/**/*.mode1v3
44 | **/ios/**/*.mode2v3
45 | **/ios/**/*.moved-aside
46 | **/ios/**/*.pbxuser
47 | **/ios/**/*.perspectivev3
48 | **/ios/**/*sync/
49 | **/ios/**/.sconsign.dblite
50 | **/ios/**/.tags*
51 | **/ios/**/.vagrant/
52 | **/ios/**/DerivedData/
53 | **/ios/**/Icon?
54 | **/ios/**/Pods/
55 | **/ios/**/.symlinks/
56 | **/ios/**/profile
57 | **/ios/**/xcuserdata
58 | **/ios/.generated/
59 | **/ios/Flutter/App.framework
60 | **/ios/Flutter/Flutter.framework
61 | **/ios/Flutter/Flutter.podspec
62 | **/ios/Flutter/Generated.xcconfig
63 | **/ios/Flutter/app.flx
64 | **/ios/Flutter/app.zip
65 | **/ios/Flutter/flutter_assets/
66 | **/ios/Flutter/flutter_export_environment.sh
67 | **/ios/ServiceDefinitions.json
68 | **/ios/Runner/GeneratedPluginRegistrant.*
69 |
70 | # Exceptions to above rules.
71 | !**/ios/**/default.mode1v3
72 | !**/ios/**/default.mode2v3
73 | !**/ios/**/default.pbxuser
74 | !**/ios/**/default.perspectivev3
75 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
76 |
--------------------------------------------------------------------------------
/package/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 0b8abb4724aa590dd0f429683339b1e045a1594d
8 | channel: stable
9 |
10 | project_type: package
11 |
--------------------------------------------------------------------------------
/package/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 4.1.0
2 |
3 | * Fixed 'Go Up' working on Linux (thanks [@madadam](https://github.com/madadam)).
4 |
5 | ## 4.0.0
6 |
7 | * Added `shortcuts` to allow multiple root drives (as in Windows) or favorites (as in the Linux/MacOS sidebar) on desktop systems.
8 | * Improved breadcrumb behavior on desktop systems (added mouse wheel scrolling).
9 | * The `closeButton` and `automaticallyImplyLeading` parameters have been added to the `FilesystemPicker` widget to allow you to specify a close button.
10 |
11 | ## 3.1.0
12 |
13 | * `rootDirectory` may be equal to directory, otherwise it is impossible to select `/` or `C:\`.
14 | * Breadcrumbs refactor for better compatibility with desktop OS.
15 |
16 | ## 3.0.0
17 |
18 | * Two new picker display modes: popup dialog and bottom sheet.
19 | * Added the ability to specify the directory initially displayed in the dialog (must be a child of the `rootDirectory`).
20 | * Added the ability to set a callback to filter the list of folders and files displayed in the picker.
21 | * Added contextual actions such as "Create Folder".
22 | * Added a theme definition that allows you to customize each part of the picker.
23 | * The `FilesystemPickerDefaultOptions` widget has been added, which allows you to set the default settings and theme for all pickers.
24 |
25 | ## 2.0.1
26 |
27 | * Flutter 3.0 compatibility
28 |
29 | ## 2.0.0
30 |
31 | * Deprecated theme properties have been replaced with their current counterpart.
32 |
33 | ## 2.0.0-nullsafety.0
34 |
35 | * Migrate to null safety.
36 |
37 | ## 1.0.4
38 |
39 | Bug fix: `FilesystemPicker.open()` now returns null if nothing was selected.
40 |
41 | ## 1.0.3
42 |
43 | **Breaking change**
44 | FileSystem Picker no longer checks storage access permissions. If you need it, you must do it via a callback.
45 |
46 | * The explicit dependency on permission_handler has been removed and replaced with a callback.
47 |
48 | ## 1.0.2
49 |
50 | * Added file item selection mode (checkmark or whole tile)
51 |
52 | ## 1.0.1
53 |
54 | * Remove ripple effect on file selection tile
55 | * Added optional folder icon color
56 |
57 | ## 1.0.0+2
58 |
59 | * permission_handler dependency updated to 5.0.1
60 |
61 | ## 1.0.0+1
62 |
63 | * pub.dev maintenance issues resolved.
64 |
65 | ## 1.0.0
66 |
67 | * Initial release.
68 |
--------------------------------------------------------------------------------
/package/LICENSE:
--------------------------------------------------------------------------------
1 | // Copyright 2020-2023 Andy Chentsov. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the names of its
14 | // contributors may be used to endorse or promote products derived from
15 | // this software without specific prior written permission.
16 | //
17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/package/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:flutter_lints/flutter.yaml
2 |
3 | # Additional information about this file can be found at
4 | # https://dart.dev/guides/language/analysis-options
5 |
--------------------------------------------------------------------------------
/package/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .packages
31 | .pub-cache/
32 | .pub/
33 | /build/
34 |
35 | # Web related
36 | lib/generated_plugin_registrant.dart
37 |
38 | # Symbolication related
39 | app.*.symbols
40 |
41 | # Obfuscation related
42 | app.*.map.json
43 |
44 | # Android Studio will place build artifacts here
45 | /android/app/debug
46 | /android/app/profile
47 | /android/app/release
48 |
--------------------------------------------------------------------------------
/package/example/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled.
5 |
6 | version:
7 | revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
8 | channel: stable
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
17 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
18 | - platform: android
19 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
20 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
21 | - platform: ios
22 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
23 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
24 | - platform: linux
25 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
26 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
27 | - platform: macos
28 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
29 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
30 | - platform: web
31 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
32 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
33 | - platform: windows
34 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
35 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/package/example/README.md:
--------------------------------------------------------------------------------
1 | # FilesystemPicker example
2 |
3 | ```dart
4 | import 'dart:io';
5 | import 'package:flutter/material.dart';
6 | import 'package:path_provider/path_provider.dart';
7 | import 'package:permission_handler/permission_handler.dart';
8 | import 'package:filesystem_picker/filesystem_picker.dart';
9 |
10 | void main() {
11 | runApp(const PickerApp());
12 | }
13 |
14 | class PickerApp extends StatelessWidget {
15 | const PickerApp({Key? key}) : super(key: key);
16 |
17 | @override
18 | Widget build(BuildContext context) {
19 | return MaterialApp(
20 | title: 'Picker Example',
21 | theme: ThemeData(
22 | primarySwatch: Colors.teal,
23 | ),
24 | home: const DemoScreen(),
25 | );
26 | }
27 | }
28 |
29 | class DemoScreen extends StatelessWidget {
30 | const DemoScreen({Key? key}) : super(key: key);
31 |
32 | @override
33 | Widget build(BuildContext context) {
34 | return Scaffold(
35 | body: Center(
36 | child: ElevatedButton(
37 | child: const Text('Pick file'),
38 | onPressed: () async {
39 | final Directory rootPath = await getTemporaryDirectory();
40 | String? path = await FilesystemPicker.open(
41 | title: 'Pick file',
42 | context: context,
43 | rootDirectory: rootPath,
44 | fsType: FilesystemType.file,
45 | requestPermission: () async => await Permission.storage.request().isGranted,
46 | );
47 | debugPrint('File: $path');
48 | },
49 | ),
50 | ),
51 | );
52 | }
53 | }
54 | ```
55 |
56 | See more examples in the `example/lib` folder.
57 |
--------------------------------------------------------------------------------
/package/example/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/package/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/package/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion flutter.compileSdkVersion
30 | ndkVersion flutter.ndkVersion
31 |
32 | compileOptions {
33 | sourceCompatibility JavaVersion.VERSION_1_8
34 | targetCompatibility JavaVersion.VERSION_1_8
35 | }
36 |
37 | kotlinOptions {
38 | jvmTarget = '1.8'
39 | }
40 |
41 | sourceSets {
42 | main.java.srcDirs += 'src/main/kotlin'
43 | }
44 |
45 | defaultConfig {
46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47 | applicationId "com.example.filesystem_picker_example"
48 | // You can update the following values to match your application needs.
49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
50 | minSdkVersion flutter.minSdkVersion
51 | targetSdkVersion flutter.targetSdkVersion
52 | versionCode flutterVersionCode.toInteger()
53 | versionName flutterVersionName
54 | }
55 |
56 | buildTypes {
57 | release {
58 | // TODO: Add your own signing config for the release build.
59 | // Signing with the debug keys for now, so `flutter run --release` works.
60 | signingConfig signingConfigs.debug
61 | }
62 | }
63 | }
64 |
65 | flutter {
66 | source '../..'
67 | }
68 |
69 | dependencies {
70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
71 | }
72 |
--------------------------------------------------------------------------------
/package/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/package/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
20 |
24 |
28 |
29 |
30 |
31 |
32 |
33 |
35 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/package/example/android/app/src/main/kotlin/com/example/filesystem_picker_example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.filesystem_picker_example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/package/example/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/package/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/package/example/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/package/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/package/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/package/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.7.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.3.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | tasks.register("clean", Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/package/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/package/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
7 |
--------------------------------------------------------------------------------
/package/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/package/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/package/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 9.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/package/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/package/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/package/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/package/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/package/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/package/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
69 |
71 |
77 |
78 |
79 |
80 |
82 |
83 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/package/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/package/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/package/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/package/example/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/package/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/package/example/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/package/example/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/package/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Filesystem Picker Example
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | filesystem_picker_example
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | UIViewControllerBasedStatusBarAppearance
45 |
46 | CADisableMinimumFrameDurationOnPhone
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/package/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/package/example/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 | import 'package:filesystem_picker_example/screens/breadcrumbs_demo_screen.dart';
3 | import 'package:filesystem_picker_example/screens/custom_theme_demo_screen.dart';
4 | import 'package:filesystem_picker_example/screens/simple_demo_screen.dart';
5 | import 'package:filesystem_picker_example/screens/shortcuts_demo_screen.dart';
6 | import 'package:flutter/material.dart';
7 | import 'package:path_provider/path_provider.dart';
8 |
9 | void main() {
10 | runApp(const PickerDemoApp());
11 | }
12 |
13 | class PickerDemoApp extends StatefulWidget {
14 | const PickerDemoApp({Key? key}) : super(key: key);
15 |
16 | @override
17 | State createState() => _PickerDemoAppState();
18 | }
19 |
20 | class _PickerDemoAppState extends State {
21 | @override
22 | void initState() {
23 | super.initState();
24 |
25 | _prepareStore();
26 | }
27 |
28 | void _prepareStore() async {
29 | final Directory rootPath = await getTemporaryDirectory();
30 |
31 | // Create sample directory if not exists
32 | Directory sampleFolder = Directory('${rootPath.path}/Sample folder');
33 | if (!sampleFolder.existsSync()) {
34 | sampleFolder.createSync();
35 | }
36 |
37 | // Create sample file if not exists
38 | File sampleFile = File('${sampleFolder.path}/Sample.txt');
39 | if (!sampleFile.existsSync()) {
40 | sampleFile.writeAsStringSync('FileSystem Picker sample file.');
41 | }
42 | }
43 |
44 | @override
45 | Widget build(BuildContext context) {
46 | return MaterialApp(
47 | title: 'FileSystemPicker Demo',
48 | debugShowCheckedModeBanner: false,
49 | theme: ThemeData(
50 | primarySwatch: Colors.teal,
51 | ),
52 | home: const StartScreen(),
53 | );
54 | }
55 | }
56 |
57 | class StartScreen extends StatelessWidget {
58 | const StartScreen({Key? key}) : super(key: key);
59 |
60 | @override
61 | Widget build(BuildContext context) {
62 | return Scaffold(
63 | body: SafeArea(
64 | child: Padding(
65 | padding: const EdgeInsets.all(16.0),
66 | child: Center(
67 | child: Column(
68 | mainAxisSize: MainAxisSize.min,
69 | children: [
70 | ElevatedButton(
71 | child: const Text('Simple Demo'),
72 | onPressed: () => Navigator.maybeOf(context)?.push(
73 | MaterialPageRoute(
74 | builder: (context) => SimpleDemoScreen(),
75 | ),
76 | ),
77 | ),
78 |
79 | //
80 | const SizedBox(height: 24),
81 |
82 | //
83 | ElevatedButton(
84 | child: const Text('Custom Theme Demo'),
85 | onPressed: () => Navigator.maybeOf(context)?.push(
86 | MaterialPageRoute(
87 | builder: (context) => CustomThemeDemoScreen(),
88 | ),
89 | ),
90 | ),
91 |
92 | //
93 | const SizedBox(height: 24),
94 |
95 | //
96 | ElevatedButton(
97 | child: const Text('Shortcuts Demo'),
98 | onPressed: () => Navigator.maybeOf(context)?.push(
99 | MaterialPageRoute(
100 | builder: (context) => ShortcutsDemoScreen(),
101 | ),
102 | ),
103 | ),
104 |
105 | //
106 | const SizedBox(height: 24),
107 |
108 | //
109 | ElevatedButton(
110 | child: const Text('Breadcrumbs Demo'),
111 | onPressed: () => Navigator.maybeOf(context)?.push(
112 | MaterialPageRoute(
113 | builder: (context) => const BreadcrumbsDemoScreen(),
114 | ),
115 | ),
116 | ),
117 | ],
118 | ),
119 | ),
120 | ),
121 | ),
122 | );
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/package/example/lib/screens/breadcrumbs_demo_screen.dart:
--------------------------------------------------------------------------------
1 | import 'package:filesystem_picker/filesystem_picker.dart';
2 | import 'package:filesystem_picker_example/screens/widgets/demo_scaffold.dart';
3 | import 'package:filesystem_picker_example/screens/widgets/heading.dart';
4 | import 'package:flutter/material.dart';
5 |
6 | class BreadcrumbsDemoScreen extends StatelessWidget {
7 | const BreadcrumbsDemoScreen({Key? key}) : super(key: key);
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return DemoScaffold(
12 | title: 'Breadcrumbs Demo',
13 | sidePadding: 0,
14 | children: [
15 | const Padding(
16 | padding: EdgeInsets.symmetric(horizontal: 16),
17 | child: Heading(text: 'Default Breadcrumbs'),
18 | ),
19 |
20 | //
21 | Breadcrumbs(
22 | items: ['One', 'Two', 'Thee', 'Four', 'Five', 'Six', 'Seven']
23 | .map((path) => BreadcrumbItem(text: path, data: path))
24 | .toList(growable: false),
25 | onSelect: (String? value) {
26 | debugPrint('* Selected: $value');
27 | },
28 | ),
29 |
30 | //
31 | const Padding(
32 | padding: EdgeInsets.symmetric(horizontal: 16),
33 | child: Heading(text: 'Customized Breadcrumbs'),
34 | ),
35 |
36 | //
37 | Breadcrumbs(
38 | theme: BreadcrumbsThemeData(
39 | itemColor: Colors.white,
40 | inactiveItemColor: Colors.blueGrey.shade100,
41 | itemPadding: const EdgeInsets.symmetric(horizontal: 6),
42 | itemMinimumSize: Size.zero,
43 | itemTapTargetSize: MaterialTapTargetSize.shrinkWrap,
44 | separatorColor: Colors.blueGrey.shade300,
45 | backgroundColor: Colors.blueGrey,
46 | separatorIcon: Icons.arrow_right,
47 | separatorIconSize: 32,
48 | ),
49 | items: ['One', 'Two', 'Thee', 'Four', 'Five', 'Six', 'Seven']
50 | .map((path) => BreadcrumbItem(text: path, data: path))
51 | .toList(growable: false),
52 | onSelect: (String? value) {
53 | debugPrint('* Selected: $value');
54 | },
55 | ),
56 |
57 | //
58 | const SizedBox(height: 32),
59 | ],
60 | );
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/package/example/lib/screens/simple_demo_screen.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 | import 'package:filesystem_picker/filesystem_picker.dart';
3 | import 'package:filesystem_picker_example/screens/widgets/demo_scaffold.dart';
4 | import 'package:filesystem_picker_example/screens/widgets/heading.dart';
5 | import 'package:flutter/material.dart';
6 | import 'package:path_provider/path_provider.dart';
7 | import 'package:permission_handler/permission_handler.dart';
8 |
9 | class SimpleDemoScreen extends StatelessWidget {
10 | SimpleDemoScreen({Key? key}) : super(key: key);
11 |
12 | final ValueNotifier selectedPath = ValueNotifier(null);
13 |
14 | // --- Fullscreen Dialog
15 |
16 | void _pickFolder(BuildContext context) async {
17 | selectedPath.value = null;
18 |
19 | final Directory rootPath = await getTemporaryDirectory();
20 |
21 | debugPrint('Root path: ${rootPath.absolute.path}');
22 |
23 | if (context.mounted) {
24 | String? path = await FilesystemPicker.open(
25 | title: 'Select folder',
26 | context: context,
27 | rootDirectory: rootPath,
28 | fsType: FilesystemType.folder,
29 | pickText: 'Select folder',
30 | requestPermission: () async =>
31 | await Permission.storage.request().isGranted,
32 | );
33 |
34 | selectedPath.value = path;
35 | }
36 | }
37 |
38 | void _pickFile(BuildContext context) async {
39 | selectedPath.value = null;
40 |
41 | final Directory rootPath = await getTemporaryDirectory();
42 |
43 | debugPrint('Root path: ${rootPath.absolute.path}');
44 |
45 | if (context.mounted) {
46 | String? path = await FilesystemPicker.open(
47 | title: 'Open file',
48 | context: context,
49 | rootDirectory: rootPath,
50 | fsType: FilesystemType.file,
51 | requestPermission: () async =>
52 | await Permission.storage.request().isGranted,
53 | );
54 |
55 | selectedPath.value = path;
56 | }
57 | }
58 |
59 | // --- Dialog
60 |
61 | void _pickFolderDialog(BuildContext context) async {
62 | selectedPath.value = null;
63 |
64 | final Directory rootPath = await getTemporaryDirectory();
65 |
66 | debugPrint('Root path: ${rootPath.absolute.path}');
67 |
68 | if (context.mounted) {
69 | String? path = await FilesystemPicker.openDialog(
70 | title: 'Select folder',
71 | context: context,
72 | rootDirectory: rootPath,
73 | fsType: FilesystemType.folder,
74 | pickText: 'Select folder',
75 | requestPermission: () async =>
76 | await Permission.storage.request().isGranted,
77 | constraints: const BoxConstraints(
78 | maxWidth: 280,
79 | maxHeight: 460,
80 | ),
81 | );
82 |
83 | selectedPath.value = path;
84 | }
85 | }
86 |
87 | void _pickFileDialog(BuildContext context) async {
88 | selectedPath.value = null;
89 |
90 | final Directory rootPath = await getTemporaryDirectory();
91 |
92 | debugPrint('Root path: ${rootPath.absolute.path}');
93 |
94 | if (context.mounted) {
95 | String? path = await FilesystemPicker.openDialog(
96 | title: 'Open file',
97 | context: context,
98 | rootDirectory: rootPath,
99 | fsType: FilesystemType.file,
100 | requestPermission: () async =>
101 | await Permission.storage.request().isGranted,
102 | );
103 |
104 | selectedPath.value = path;
105 | }
106 | }
107 |
108 | // --- Bottom Sheet
109 |
110 | void _pickFolderBottomSheet(BuildContext context) async {
111 | selectedPath.value = null;
112 |
113 | final Directory rootPath = await getTemporaryDirectory();
114 |
115 | debugPrint('Root path: ${rootPath.absolute.path}');
116 |
117 | if (context.mounted) {
118 | String? path = await FilesystemPicker.openBottomSheet(
119 | title: 'Select folder',
120 | context: context,
121 | rootDirectory: rootPath,
122 | fsType: FilesystemType.folder,
123 | pickText: 'Select folder',
124 | requestPermission: () async =>
125 | await Permission.storage.request().isGranted,
126 | constraints: const BoxConstraints(
127 | maxWidth: 280,
128 | maxHeight: 460,
129 | ),
130 | );
131 |
132 | selectedPath.value = path;
133 | }
134 | }
135 |
136 | void _pickFileBottomSheet(BuildContext context) async {
137 | selectedPath.value = null;
138 |
139 | final Directory rootPath = await getTemporaryDirectory();
140 |
141 | debugPrint('Root path: ${rootPath.absolute.path}');
142 |
143 | if (context.mounted) {
144 | String? path = await FilesystemPicker.openBottomSheet(
145 | title: 'Open file',
146 | context: context,
147 | rootDirectory: rootPath,
148 | fsType: FilesystemType.file,
149 | requestPermission: () async =>
150 | await Permission.storage.request().isGranted,
151 | );
152 |
153 | selectedPath.value = path;
154 | }
155 | }
156 |
157 | @override
158 | Widget build(BuildContext context) {
159 | return DemoScaffold(
160 | title: 'Simple Demo',
161 | bottom: ValueListenableBuilder(
162 | valueListenable: selectedPath,
163 | builder: (context, value, child) =>
164 | Text('Selected: ${value ?? 'none'}'),
165 | ),
166 | children: [
167 | const Heading(text: 'Fullscreen Dialog'),
168 |
169 | //
170 | ElevatedButton(
171 | child: const Text('Select folder'),
172 | onPressed: () => _pickFolder(context),
173 | ),
174 |
175 | //
176 | const Divider(height: 24),
177 |
178 | ElevatedButton(
179 | child: const Text('Pick file'),
180 | onPressed: () => _pickFile(context),
181 | ),
182 |
183 | //
184 | const Heading(text: 'Dialog'),
185 |
186 | //
187 | ElevatedButton(
188 | child: const Text('Select folder'),
189 | onPressed: () => _pickFolderDialog(context),
190 | ),
191 |
192 | //
193 | const Divider(height: 24),
194 |
195 | ElevatedButton(
196 | child: const Text('Pick file'),
197 | onPressed: () => _pickFileDialog(context),
198 | ),
199 |
200 | //
201 | const Heading(text: 'Bottom Sheet'),
202 |
203 | //
204 | ElevatedButton(
205 | child: const Text('Select folder'),
206 | onPressed: () => _pickFolderBottomSheet(context),
207 | ),
208 |
209 | //
210 | const Divider(height: 24),
211 |
212 | ElevatedButton(
213 | child: const Text('Pick file'),
214 | onPressed: () => _pickFileBottomSheet(context),
215 | ),
216 |
217 | //
218 | const SizedBox(height: 32),
219 | ],
220 | );
221 | }
222 | }
223 |
--------------------------------------------------------------------------------
/package/example/lib/screens/widgets/demo_scaffold.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class DemoScaffold extends StatefulWidget {
4 | final String title;
5 | final List children;
6 | final Widget? bottom;
7 | final double sidePadding;
8 |
9 | const DemoScaffold({
10 | Key? key,
11 | required this.title,
12 | required this.children,
13 | this.bottom,
14 | this.sidePadding = 16.0,
15 | }) : super(key: key);
16 |
17 | @override
18 | State createState() => _DemoScaffoldState();
19 | }
20 |
21 | class _DemoScaffoldState extends State {
22 | final scrollController = ScrollController();
23 |
24 | @override
25 | Widget build(BuildContext context) {
26 | return Scaffold(
27 | appBar: PreferredSize(
28 | preferredSize: const Size.fromHeight(48),
29 | child: SafeArea(
30 | child: Container(
31 | decoration: const BoxDecoration(
32 | border: Border(bottom: BorderSide(color: Colors.black12)),
33 | ),
34 | child: Row(
35 | children: [
36 | const BackButton(),
37 | Expanded(
38 | child: Text(widget.title,
39 | style: Theme.of(context).textTheme.titleLarge),
40 | ),
41 | ],
42 | ),
43 | ),
44 | ),
45 | ),
46 | body: Center(
47 | child: Scrollbar(
48 | thumbVisibility: true,
49 | controller: scrollController,
50 | child: SingleChildScrollView(
51 | controller: scrollController,
52 | child: Padding(
53 | padding: EdgeInsets.symmetric(horizontal: widget.sidePadding) +
54 | const EdgeInsets.symmetric(vertical: 16.0),
55 | child: Column(
56 | mainAxisSize: MainAxisSize.min,
57 | children: widget.children,
58 | ),
59 | ),
60 | ),
61 | ),
62 | ),
63 | bottomNavigationBar: (widget.bottom != null)
64 | ? Container(
65 | decoration: const BoxDecoration(
66 | border: Border(top: BorderSide(color: Colors.black12)),
67 | ),
68 | child: Padding(
69 | padding: const EdgeInsets.only(top: 16, bottom: 16) +
70 | EdgeInsets.symmetric(horizontal: widget.sidePadding),
71 | child: widget.bottom,
72 | ),
73 | )
74 | : null,
75 | );
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/package/example/lib/screens/widgets/heading.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class Heading extends StatelessWidget {
4 | final String text;
5 |
6 | const Heading({
7 | Key? key,
8 | required this.text,
9 | }) : super(key: key);
10 |
11 | @override
12 | Widget build(BuildContext context) {
13 | final color = Theme.of(context).textTheme.bodySmall?.color;
14 |
15 | return Padding(
16 | padding: const EdgeInsets.only(top: 48, bottom: 24),
17 | child: LayoutBuilder(
18 | builder: (context, constraints) => Row(
19 | children: [
20 | Expanded(child: Divider(color: color)),
21 | ConstrainedBox(
22 | constraints: BoxConstraints(maxWidth: constraints.maxWidth - 20),
23 | child: Padding(
24 | padding: const EdgeInsets.symmetric(horizontal: 16),
25 | child: Text(
26 | text.toUpperCase(),
27 | style: Theme.of(context).textTheme.titleSmall?.copyWith(
28 | color: color,
29 | letterSpacing: 2,
30 | ),
31 | textAlign: TextAlign.center,
32 | overflow: TextOverflow.ellipsis,
33 | ),
34 | ),
35 | ),
36 | Expanded(child: Divider(color: color)),
37 | ],
38 | ),
39 | ),
40 | );
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/package/example/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/package/example/linux/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Project-level configuration.
2 | cmake_minimum_required(VERSION 3.10)
3 | project(runner LANGUAGES CXX)
4 |
5 | # The name of the executable created for the application. Change this to change
6 | # the on-disk name of your application.
7 | set(BINARY_NAME "filesystem_picker_example")
8 | # The unique GTK application identifier for this application. See:
9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID
10 | set(APPLICATION_ID "com.example.filesystem_picker_example")
11 |
12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
13 | # versions of CMake.
14 | cmake_policy(SET CMP0063 NEW)
15 |
16 | # Load bundled libraries from the lib/ directory relative to the binary.
17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
18 |
19 | # Root filesystem for cross-building.
20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT)
21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
27 | endif()
28 |
29 | # Define build configuration options.
30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
31 | set(CMAKE_BUILD_TYPE "Debug" CACHE
32 | STRING "Flutter build mode" FORCE)
33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
34 | "Debug" "Profile" "Release")
35 | endif()
36 |
37 | # Compilation settings that should be applied to most targets.
38 | #
39 | # Be cautious about adding new options here, as plugins use this function by
40 | # default. In most cases, you should add new options to specific targets instead
41 | # of modifying this function.
42 | function(APPLY_STANDARD_SETTINGS TARGET)
43 | target_compile_features(${TARGET} PUBLIC cxx_std_14)
44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror)
45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>")
46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>")
47 | endfunction()
48 |
49 | # Flutter library and tool build rules.
50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
51 | add_subdirectory(${FLUTTER_MANAGED_DIR})
52 |
53 | # System-level dependencies.
54 | find_package(PkgConfig REQUIRED)
55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
56 |
57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
58 |
59 | # Define the application target. To change its name, change BINARY_NAME above,
60 | # not the value here, or `flutter run` will no longer work.
61 | #
62 | # Any new source files that you add to the application should be added here.
63 | add_executable(${BINARY_NAME}
64 | "main.cc"
65 | "my_application.cc"
66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
67 | )
68 |
69 | # Apply the standard set of build settings. This can be removed for applications
70 | # that need different build settings.
71 | apply_standard_settings(${BINARY_NAME})
72 |
73 | # Add dependency libraries. Add any application-specific dependencies here.
74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter)
75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
76 |
77 | # Run the Flutter tool portions of the build. This must not be removed.
78 | add_dependencies(${BINARY_NAME} flutter_assemble)
79 |
80 | # Only the install-generated bundle's copy of the executable will launch
81 | # correctly, since the resources must in the right relative locations. To avoid
82 | # people trying to run the unbundled copy, put it in a subdirectory instead of
83 | # the default top-level location.
84 | set_target_properties(${BINARY_NAME}
85 | PROPERTIES
86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
87 | )
88 |
89 | # Generated plugin build rules, which manage building the plugins and adding
90 | # them to the application.
91 | include(flutter/generated_plugins.cmake)
92 |
93 |
94 | # === Installation ===
95 | # By default, "installing" just makes a relocatable bundle in the build
96 | # directory.
97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
100 | endif()
101 |
102 | # Start with a clean build bundle directory every time.
103 | install(CODE "
104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
105 | " COMPONENT Runtime)
106 |
107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
109 |
110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
111 | COMPONENT Runtime)
112 |
113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
114 | COMPONENT Runtime)
115 |
116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
117 | COMPONENT Runtime)
118 |
119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
120 | install(FILES "${bundled_library}"
121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
122 | COMPONENT Runtime)
123 | endforeach(bundled_library)
124 |
125 | # Fully re-copy the assets directory on each build to avoid having stale files
126 | # from a previous install.
127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
128 | install(CODE "
129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
130 | " COMPONENT Runtime)
131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
133 |
134 | # Install the AOT library on non-Debug builds only.
135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
137 | COMPONENT Runtime)
138 | endif()
139 |
--------------------------------------------------------------------------------
/package/example/linux/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file controls Flutter-level build steps. It should not be edited.
2 | cmake_minimum_required(VERSION 3.10)
3 |
4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
5 |
6 | # Configuration provided via flutter tool.
7 | include(${EPHEMERAL_DIR}/generated_config.cmake)
8 |
9 | # TODO: Move the rest of this into files in ephemeral. See
10 | # https://github.com/flutter/flutter/issues/57146.
11 |
12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...),
13 | # which isn't available in 3.10.
14 | function(list_prepend LIST_NAME PREFIX)
15 | set(NEW_LIST "")
16 | foreach(element ${${LIST_NAME}})
17 | list(APPEND NEW_LIST "${PREFIX}${element}")
18 | endforeach(element)
19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
20 | endfunction()
21 |
22 | # === Flutter Library ===
23 | # System-level dependencies.
24 | find_package(PkgConfig REQUIRED)
25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
28 |
29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
30 |
31 | # Published to parent scope for install step.
32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
36 |
37 | list(APPEND FLUTTER_LIBRARY_HEADERS
38 | "fl_basic_message_channel.h"
39 | "fl_binary_codec.h"
40 | "fl_binary_messenger.h"
41 | "fl_dart_project.h"
42 | "fl_engine.h"
43 | "fl_json_message_codec.h"
44 | "fl_json_method_codec.h"
45 | "fl_message_codec.h"
46 | "fl_method_call.h"
47 | "fl_method_channel.h"
48 | "fl_method_codec.h"
49 | "fl_method_response.h"
50 | "fl_plugin_registrar.h"
51 | "fl_plugin_registry.h"
52 | "fl_standard_message_codec.h"
53 | "fl_standard_method_codec.h"
54 | "fl_string_codec.h"
55 | "fl_value.h"
56 | "fl_view.h"
57 | "flutter_linux.h"
58 | )
59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
60 | add_library(flutter INTERFACE)
61 | target_include_directories(flutter INTERFACE
62 | "${EPHEMERAL_DIR}"
63 | )
64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
65 | target_link_libraries(flutter INTERFACE
66 | PkgConfig::GTK
67 | PkgConfig::GLIB
68 | PkgConfig::GIO
69 | )
70 | add_dependencies(flutter flutter_assemble)
71 |
72 | # === Flutter tool backend ===
73 | # _phony_ is a non-existent file to force this command to run every time,
74 | # since currently there's no way to get a full input/output list from the
75 | # flutter tool.
76 | add_custom_command(
77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_
79 | COMMAND ${CMAKE_COMMAND} -E env
80 | ${FLUTTER_TOOL_ENVIRONMENT}
81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
83 | VERBATIM
84 | )
85 | add_custom_target(flutter_assemble DEPENDS
86 | "${FLUTTER_LIBRARY}"
87 | ${FLUTTER_LIBRARY_HEADERS}
88 | )
89 |
--------------------------------------------------------------------------------
/package/example/linux/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void fl_register_plugins(FlPluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/package/example/linux/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void fl_register_plugins(FlPluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/package/example/linux/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | )
10 |
11 | set(PLUGIN_BUNDLED_LIBRARIES)
12 |
13 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
18 | endforeach(plugin)
19 |
20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
23 | endforeach(ffi_plugin)
24 |
--------------------------------------------------------------------------------
/package/example/linux/main.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | int main(int argc, char** argv) {
4 | g_autoptr(MyApplication) app = my_application_new();
5 | return g_application_run(G_APPLICATION(app), argc, argv);
6 | }
7 |
--------------------------------------------------------------------------------
/package/example/linux/my_application.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | #include
4 | #ifdef GDK_WINDOWING_X11
5 | #include
6 | #endif
7 |
8 | #include "flutter/generated_plugin_registrant.h"
9 |
10 | struct _MyApplication {
11 | GtkApplication parent_instance;
12 | char** dart_entrypoint_arguments;
13 | };
14 |
15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
16 |
17 | // Implements GApplication::activate.
18 | static void my_application_activate(GApplication* application) {
19 | MyApplication* self = MY_APPLICATION(application);
20 | GtkWindow* window =
21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
22 |
23 | // Use a header bar when running in GNOME as this is the common style used
24 | // by applications and is the setup most users will be using (e.g. Ubuntu
25 | // desktop).
26 | // If running on X and not using GNOME then just use a traditional title bar
27 | // in case the window manager does more exotic layout, e.g. tiling.
28 | // If running on Wayland assume the header bar will work (may need changing
29 | // if future cases occur).
30 | gboolean use_header_bar = TRUE;
31 | #ifdef GDK_WINDOWING_X11
32 | GdkScreen* screen = gtk_window_get_screen(window);
33 | if (GDK_IS_X11_SCREEN(screen)) {
34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
36 | use_header_bar = FALSE;
37 | }
38 | }
39 | #endif
40 | if (use_header_bar) {
41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
42 | gtk_widget_show(GTK_WIDGET(header_bar));
43 | gtk_header_bar_set_title(header_bar, "filesystem_picker_example");
44 | gtk_header_bar_set_show_close_button(header_bar, TRUE);
45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
46 | } else {
47 | gtk_window_set_title(window, "filesystem_picker_example");
48 | }
49 |
50 | gtk_window_set_default_size(window, 1280, 720);
51 | gtk_widget_show(GTK_WIDGET(window));
52 |
53 | g_autoptr(FlDartProject) project = fl_dart_project_new();
54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
55 |
56 | FlView* view = fl_view_new(project);
57 | gtk_widget_show(GTK_WIDGET(view));
58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
59 |
60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view));
61 |
62 | gtk_widget_grab_focus(GTK_WIDGET(view));
63 | }
64 |
65 | // Implements GApplication::local_command_line.
66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) {
67 | MyApplication* self = MY_APPLICATION(application);
68 | // Strip out the first argument as it is the binary name.
69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
70 |
71 | g_autoptr(GError) error = nullptr;
72 | if (!g_application_register(application, nullptr, &error)) {
73 | g_warning("Failed to register: %s", error->message);
74 | *exit_status = 1;
75 | return TRUE;
76 | }
77 |
78 | g_application_activate(application);
79 | *exit_status = 0;
80 |
81 | return TRUE;
82 | }
83 |
84 | // Implements GObject::dispose.
85 | static void my_application_dispose(GObject* object) {
86 | MyApplication* self = MY_APPLICATION(object);
87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
89 | }
90 |
91 | static void my_application_class_init(MyApplicationClass* klass) {
92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate;
93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
95 | }
96 |
97 | static void my_application_init(MyApplication* self) {}
98 |
99 | MyApplication* my_application_new() {
100 | return MY_APPLICATION(g_object_new(my_application_get_type(),
101 | "application-id", APPLICATION_ID,
102 | "flags", G_APPLICATION_NON_UNIQUE,
103 | nullptr));
104 | }
105 |
--------------------------------------------------------------------------------
/package/example/linux/my_application.h:
--------------------------------------------------------------------------------
1 | #ifndef FLUTTER_MY_APPLICATION_H_
2 | #define FLUTTER_MY_APPLICATION_H_
3 |
4 | #include
5 |
6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
7 | GtkApplication)
8 |
9 | /**
10 | * my_application_new:
11 | *
12 | * Creates a new Flutter-based application.
13 | *
14 | * Returns: a new #MyApplication.
15 | */
16 | MyApplication* my_application_new();
17 |
18 | #endif // FLUTTER_MY_APPLICATION_H_
19 |
--------------------------------------------------------------------------------
/package/example/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/dgph
7 | **/xcuserdata/
8 |
--------------------------------------------------------------------------------
/package/example/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/package/example/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/package/example/macos/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 | import path_provider_foundation
9 |
10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
11 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
12 | }
13 |
--------------------------------------------------------------------------------
/package/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/package/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
69 |
71 |
77 |
78 |
79 |
80 |
82 |
83 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/package/example/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/package/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/package/example/macos/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | @NSApplicationMain
5 | class AppDelegate: FlutterAppDelegate {
6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
7 | return true
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/package/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "16x16",
5 | "idiom" : "mac",
6 | "filename" : "app_icon_16.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "16x16",
11 | "idiom" : "mac",
12 | "filename" : "app_icon_32.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "32x32",
17 | "idiom" : "mac",
18 | "filename" : "app_icon_32.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "32x32",
23 | "idiom" : "mac",
24 | "filename" : "app_icon_64.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "128x128",
29 | "idiom" : "mac",
30 | "filename" : "app_icon_128.png",
31 | "scale" : "1x"
32 | },
33 | {
34 | "size" : "128x128",
35 | "idiom" : "mac",
36 | "filename" : "app_icon_256.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "256x256",
41 | "idiom" : "mac",
42 | "filename" : "app_icon_256.png",
43 | "scale" : "1x"
44 | },
45 | {
46 | "size" : "256x256",
47 | "idiom" : "mac",
48 | "filename" : "app_icon_512.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "512x512",
53 | "idiom" : "mac",
54 | "filename" : "app_icon_512.png",
55 | "scale" : "1x"
56 | },
57 | {
58 | "size" : "512x512",
59 | "idiom" : "mac",
60 | "filename" : "app_icon_1024.png",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/package/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
--------------------------------------------------------------------------------
/package/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
--------------------------------------------------------------------------------
/package/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
--------------------------------------------------------------------------------
/package/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
--------------------------------------------------------------------------------
/package/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
--------------------------------------------------------------------------------
/package/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
--------------------------------------------------------------------------------
/package/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
--------------------------------------------------------------------------------
/package/example/macos/Runner/Configs/AppInfo.xcconfig:
--------------------------------------------------------------------------------
1 | // Application-level settings for the Runner target.
2 | //
3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
4 | // future. If not, the values below would default to using the project name when this becomes a
5 | // 'flutter create' template.
6 |
7 | // The application's name. By default this is also the title of the Flutter window.
8 | PRODUCT_NAME = filesystem_picker_example
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.filesystemPickerExample
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved.
15 |
--------------------------------------------------------------------------------
/package/example/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/package/example/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/package/example/macos/Runner/Configs/Warnings.xcconfig:
--------------------------------------------------------------------------------
1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
2 | GCC_WARN_UNDECLARED_SELECTOR = YES
3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
6 | CLANG_WARN_PRAGMA_PACK = YES
7 | CLANG_WARN_STRICT_PROTOTYPES = YES
8 | CLANG_WARN_COMMA = YES
9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES
10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
12 | GCC_WARN_SHADOW = YES
13 | CLANG_WARN_UNREACHABLE_CODE = YES
14 |
--------------------------------------------------------------------------------
/package/example/macos/Runner/DebugProfile.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.cs.allow-jit
8 |
9 | com.apple.security.network.server
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/package/example/macos/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSHumanReadableCopyright
26 | $(PRODUCT_COPYRIGHT)
27 | NSMainNibFile
28 | MainMenu
29 | NSPrincipalClass
30 | NSApplication
31 |
32 |
33 |
--------------------------------------------------------------------------------
/package/example/macos/Runner/MainFlutterWindow.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | class MainFlutterWindow: NSWindow {
5 | override func awakeFromNib() {
6 | let flutterViewController = FlutterViewController.init()
7 | let windowFrame = self.frame
8 | self.contentViewController = flutterViewController
9 | self.setFrame(windowFrame, display: true)
10 |
11 | RegisterGeneratedPlugins(registry: flutterViewController)
12 |
13 | super.awakeFromNib()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/package/example/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/package/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: filesystem_picker_example
2 | description: Demonstrates how to use 'FileSystemPicker'.
3 | publish_to: 'none'
4 | version: 3.0.0
5 |
6 | environment:
7 | sdk: ">=2.17.0 <3.0.0"
8 |
9 | dependencies:
10 | flutter:
11 | sdk: flutter
12 | cupertino_icons: ^1.0.2
13 | filesystem_picker:
14 | path: ../
15 | path_provider: ^2.0.1
16 | path: ^1.8.0
17 | permission_handler: ^9.2.0
18 |
19 | dev_dependencies:
20 | flutter_test:
21 | sdk: flutter
22 | flutter_lints: ^2.0.0
23 |
24 | flutter:
25 | uses-material-design: true
26 |
--------------------------------------------------------------------------------
/package/example/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility in the flutter_test package. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | import 'package:filesystem_picker_example/main.dart';
12 |
13 | void main() {
14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {
15 | // Build our app and trigger a frame.
16 | await tester.pumpWidget(const PickerDemoApp());
17 |
18 | // Verify that our counter starts at 0.
19 | expect(find.text('0'), findsOneWidget);
20 | expect(find.text('1'), findsNothing);
21 |
22 | // Tap the '+' icon and trigger a frame.
23 | await tester.tap(find.byIcon(Icons.add));
24 | await tester.pump();
25 |
26 | // Verify that our counter has incremented.
27 | expect(find.text('0'), findsNothing);
28 | expect(find.text('1'), findsOneWidget);
29 | });
30 | }
31 |
--------------------------------------------------------------------------------
/package/example/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/web/favicon.png
--------------------------------------------------------------------------------
/package/example/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/package/example/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/package/example/web/icons/Icon-maskable-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/web/icons/Icon-maskable-192.png
--------------------------------------------------------------------------------
/package/example/web/icons/Icon-maskable-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/web/icons/Icon-maskable-512.png
--------------------------------------------------------------------------------
/package/example/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | filesystem_picker_example
33 |
34 |
35 |
39 |
40 |
41 |
42 |
43 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/package/example/web/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "filesystem_picker_example",
3 | "short_name": "filesystem_picker_example",
4 | "start_url": ".",
5 | "display": "standalone",
6 | "background_color": "#0175C2",
7 | "theme_color": "#0175C2",
8 | "description": "A new Flutter project.",
9 | "orientation": "portrait-primary",
10 | "prefer_related_applications": false,
11 | "icons": [
12 | {
13 | "src": "icons/Icon-192.png",
14 | "sizes": "192x192",
15 | "type": "image/png"
16 | },
17 | {
18 | "src": "icons/Icon-512.png",
19 | "sizes": "512x512",
20 | "type": "image/png"
21 | },
22 | {
23 | "src": "icons/Icon-maskable-192.png",
24 | "sizes": "192x192",
25 | "type": "image/png",
26 | "purpose": "maskable"
27 | },
28 | {
29 | "src": "icons/Icon-maskable-512.png",
30 | "sizes": "512x512",
31 | "type": "image/png",
32 | "purpose": "maskable"
33 | }
34 | ]
35 | }
36 |
--------------------------------------------------------------------------------
/package/example/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | x64/
11 | x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/package/example/windows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Project-level configuration.
2 | cmake_minimum_required(VERSION 3.14)
3 | project(filesystem_picker_example LANGUAGES CXX)
4 |
5 | # The name of the executable created for the application. Change this to change
6 | # the on-disk name of your application.
7 | set(BINARY_NAME "filesystem_picker_example")
8 |
9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
10 | # versions of CMake.
11 | cmake_policy(SET CMP0063 NEW)
12 |
13 | # Define build configuration option.
14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
15 | if(IS_MULTICONFIG)
16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
17 | CACHE STRING "" FORCE)
18 | else()
19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
20 | set(CMAKE_BUILD_TYPE "Debug" CACHE
21 | STRING "Flutter build mode" FORCE)
22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
23 | "Debug" "Profile" "Release")
24 | endif()
25 | endif()
26 | # Define settings for the Profile build mode.
27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
31 |
32 | # Use Unicode for all projects.
33 | add_definitions(-DUNICODE -D_UNICODE)
34 |
35 | # Compilation settings that should be applied to most targets.
36 | #
37 | # Be cautious about adding new options here, as plugins use this function by
38 | # default. In most cases, you should add new options to specific targets instead
39 | # of modifying this function.
40 | function(APPLY_STANDARD_SETTINGS TARGET)
41 | target_compile_features(${TARGET} PUBLIC cxx_std_17)
42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
43 | target_compile_options(${TARGET} PRIVATE /EHsc)
44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>")
46 | endfunction()
47 |
48 | # Flutter library and tool build rules.
49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
50 | add_subdirectory(${FLUTTER_MANAGED_DIR})
51 |
52 | # Application build; see runner/CMakeLists.txt.
53 | add_subdirectory("runner")
54 |
55 | # Generated plugin build rules, which manage building the plugins and adding
56 | # them to the application.
57 | include(flutter/generated_plugins.cmake)
58 |
59 |
60 | # === Installation ===
61 | # Support files are copied into place next to the executable, so that it can
62 | # run in place. This is done instead of making a separate bundle (as on Linux)
63 | # so that building and running from within Visual Studio will work.
64 | set(BUILD_BUNDLE_DIR "$")
65 | # Make the "install" step default, as it's required to run.
66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
69 | endif()
70 |
71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
73 |
74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
75 | COMPONENT Runtime)
76 |
77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
78 | COMPONENT Runtime)
79 |
80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
81 | COMPONENT Runtime)
82 |
83 | if(PLUGIN_BUNDLED_LIBRARIES)
84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
86 | COMPONENT Runtime)
87 | endif()
88 |
89 | # Fully re-copy the assets directory on each build to avoid having stale files
90 | # from a previous install.
91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
92 | install(CODE "
93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
94 | " COMPONENT Runtime)
95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
97 |
98 | # Install the AOT library on non-Debug builds only.
99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
100 | CONFIGURATIONS Profile;Release
101 | COMPONENT Runtime)
102 |
--------------------------------------------------------------------------------
/package/example/windows/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file controls Flutter-level build steps. It should not be edited.
2 | cmake_minimum_required(VERSION 3.14)
3 |
4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
5 |
6 | # Configuration provided via flutter tool.
7 | include(${EPHEMERAL_DIR}/generated_config.cmake)
8 |
9 | # TODO: Move the rest of this into files in ephemeral. See
10 | # https://github.com/flutter/flutter/issues/57146.
11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
12 |
13 | # === Flutter Library ===
14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
15 |
16 | # Published to parent scope for install step.
17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
21 |
22 | list(APPEND FLUTTER_LIBRARY_HEADERS
23 | "flutter_export.h"
24 | "flutter_windows.h"
25 | "flutter_messenger.h"
26 | "flutter_plugin_registrar.h"
27 | "flutter_texture_registrar.h"
28 | )
29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
30 | add_library(flutter INTERFACE)
31 | target_include_directories(flutter INTERFACE
32 | "${EPHEMERAL_DIR}"
33 | )
34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
35 | add_dependencies(flutter flutter_assemble)
36 |
37 | # === Wrapper ===
38 | list(APPEND CPP_WRAPPER_SOURCES_CORE
39 | "core_implementations.cc"
40 | "standard_codec.cc"
41 | )
42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
44 | "plugin_registrar.cc"
45 | )
46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
47 | list(APPEND CPP_WRAPPER_SOURCES_APP
48 | "flutter_engine.cc"
49 | "flutter_view_controller.cc"
50 | )
51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
52 |
53 | # Wrapper sources needed for a plugin.
54 | add_library(flutter_wrapper_plugin STATIC
55 | ${CPP_WRAPPER_SOURCES_CORE}
56 | ${CPP_WRAPPER_SOURCES_PLUGIN}
57 | )
58 | apply_standard_settings(flutter_wrapper_plugin)
59 | set_target_properties(flutter_wrapper_plugin PROPERTIES
60 | POSITION_INDEPENDENT_CODE ON)
61 | set_target_properties(flutter_wrapper_plugin PROPERTIES
62 | CXX_VISIBILITY_PRESET hidden)
63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
64 | target_include_directories(flutter_wrapper_plugin PUBLIC
65 | "${WRAPPER_ROOT}/include"
66 | )
67 | add_dependencies(flutter_wrapper_plugin flutter_assemble)
68 |
69 | # Wrapper sources needed for the runner.
70 | add_library(flutter_wrapper_app STATIC
71 | ${CPP_WRAPPER_SOURCES_CORE}
72 | ${CPP_WRAPPER_SOURCES_APP}
73 | )
74 | apply_standard_settings(flutter_wrapper_app)
75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter)
76 | target_include_directories(flutter_wrapper_app PUBLIC
77 | "${WRAPPER_ROOT}/include"
78 | )
79 | add_dependencies(flutter_wrapper_app flutter_assemble)
80 |
81 | # === Flutter tool backend ===
82 | # _phony_ is a non-existent file to force this command to run every time,
83 | # since currently there's no way to get a full input/output list from the
84 | # flutter tool.
85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
87 | add_custom_command(
88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
90 | ${CPP_WRAPPER_SOURCES_APP}
91 | ${PHONY_OUTPUT}
92 | COMMAND ${CMAKE_COMMAND} -E env
93 | ${FLUTTER_TOOL_ENVIRONMENT}
94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
95 | windows-x64 $
96 | VERBATIM
97 | )
98 | add_custom_target(flutter_assemble DEPENDS
99 | "${FLUTTER_LIBRARY}"
100 | ${FLUTTER_LIBRARY_HEADERS}
101 | ${CPP_WRAPPER_SOURCES_CORE}
102 | ${CPP_WRAPPER_SOURCES_PLUGIN}
103 | ${CPP_WRAPPER_SOURCES_APP}
104 | )
105 |
--------------------------------------------------------------------------------
/package/example/windows/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 | #include
10 |
11 | void RegisterPlugins(flutter::PluginRegistry* registry) {
12 | PermissionHandlerWindowsPluginRegisterWithRegistrar(
13 | registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
14 | }
15 |
--------------------------------------------------------------------------------
/package/example/windows/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void RegisterPlugins(flutter::PluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/package/example/windows/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | permission_handler_windows
7 | )
8 |
9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
10 | )
11 |
12 | set(PLUGIN_BUNDLED_LIBRARIES)
13 |
14 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
19 | endforeach(plugin)
20 |
21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
24 | endforeach(ffi_plugin)
25 |
--------------------------------------------------------------------------------
/package/example/windows/runner/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.14)
2 | project(runner LANGUAGES CXX)
3 |
4 | # Define the application target. To change its name, change BINARY_NAME in the
5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
6 | # work.
7 | #
8 | # Any new source files that you add to the application should be added here.
9 | add_executable(${BINARY_NAME} WIN32
10 | "flutter_window.cpp"
11 | "main.cpp"
12 | "utils.cpp"
13 | "win32_window.cpp"
14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
15 | "Runner.rc"
16 | "runner.exe.manifest"
17 | )
18 |
19 | # Apply the standard set of build settings. This can be removed for applications
20 | # that need different build settings.
21 | apply_standard_settings(${BINARY_NAME})
22 |
23 | # Add preprocessor definitions for the build version.
24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
29 |
30 | # Disable Windows macros that collide with C++ standard library functions.
31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
32 |
33 | # Add dependency libraries and include directories. Add any application-specific
34 | # dependencies here.
35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
36 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
37 |
38 | # Run the Flutter tool portions of the build. This must not be removed.
39 | add_dependencies(${BINARY_NAME} flutter_assemble)
40 |
--------------------------------------------------------------------------------
/package/example/windows/runner/Runner.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #pragma code_page(65001)
4 | #include "resource.h"
5 |
6 | #define APSTUDIO_READONLY_SYMBOLS
7 | /////////////////////////////////////////////////////////////////////////////
8 | //
9 | // Generated from the TEXTINCLUDE 2 resource.
10 | //
11 | #include "winres.h"
12 |
13 | /////////////////////////////////////////////////////////////////////////////
14 | #undef APSTUDIO_READONLY_SYMBOLS
15 |
16 | /////////////////////////////////////////////////////////////////////////////
17 | // English (United States) resources
18 |
19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21 |
22 | #ifdef APSTUDIO_INVOKED
23 | /////////////////////////////////////////////////////////////////////////////
24 | //
25 | // TEXTINCLUDE
26 | //
27 |
28 | 1 TEXTINCLUDE
29 | BEGIN
30 | "resource.h\0"
31 | END
32 |
33 | 2 TEXTINCLUDE
34 | BEGIN
35 | "#include ""winres.h""\r\n"
36 | "\0"
37 | END
38 |
39 | 3 TEXTINCLUDE
40 | BEGIN
41 | "\r\n"
42 | "\0"
43 | END
44 |
45 | #endif // APSTUDIO_INVOKED
46 |
47 |
48 | /////////////////////////////////////////////////////////////////////////////
49 | //
50 | // Icon
51 | //
52 |
53 | // Icon with lowest ID value placed first to ensure application icon
54 | // remains consistent on all systems.
55 | IDI_APP_ICON ICON "resources\\app_icon.ico"
56 |
57 |
58 | /////////////////////////////////////////////////////////////////////////////
59 | //
60 | // Version
61 | //
62 |
63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
65 | #else
66 | #define VERSION_AS_NUMBER 1,0,0,0
67 | #endif
68 |
69 | #if defined(FLUTTER_VERSION)
70 | #define VERSION_AS_STRING FLUTTER_VERSION
71 | #else
72 | #define VERSION_AS_STRING "1.0.0"
73 | #endif
74 |
75 | VS_VERSION_INFO VERSIONINFO
76 | FILEVERSION VERSION_AS_NUMBER
77 | PRODUCTVERSION VERSION_AS_NUMBER
78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
79 | #ifdef _DEBUG
80 | FILEFLAGS VS_FF_DEBUG
81 | #else
82 | FILEFLAGS 0x0L
83 | #endif
84 | FILEOS VOS__WINDOWS32
85 | FILETYPE VFT_APP
86 | FILESUBTYPE 0x0L
87 | BEGIN
88 | BLOCK "StringFileInfo"
89 | BEGIN
90 | BLOCK "040904e4"
91 | BEGIN
92 | VALUE "CompanyName", "com.example" "\0"
93 | VALUE "FileDescription", "filesystem_picker_example" "\0"
94 | VALUE "FileVersion", VERSION_AS_STRING "\0"
95 | VALUE "InternalName", "filesystem_picker_example" "\0"
96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0"
97 | VALUE "OriginalFilename", "filesystem_picker_example.exe" "\0"
98 | VALUE "ProductName", "filesystem_picker_example" "\0"
99 | VALUE "ProductVersion", VERSION_AS_STRING "\0"
100 | END
101 | END
102 | BLOCK "VarFileInfo"
103 | BEGIN
104 | VALUE "Translation", 0x409, 1252
105 | END
106 | END
107 |
108 | #endif // English (United States) resources
109 | /////////////////////////////////////////////////////////////////////////////
110 |
111 |
112 |
113 | #ifndef APSTUDIO_INVOKED
114 | /////////////////////////////////////////////////////////////////////////////
115 | //
116 | // Generated from the TEXTINCLUDE 3 resource.
117 | //
118 |
119 |
120 | /////////////////////////////////////////////////////////////////////////////
121 | #endif // not APSTUDIO_INVOKED
122 |
--------------------------------------------------------------------------------
/package/example/windows/runner/flutter_window.cpp:
--------------------------------------------------------------------------------
1 | #include "flutter_window.h"
2 |
3 | #include
4 |
5 | #include "flutter/generated_plugin_registrant.h"
6 |
7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project)
8 | : project_(project) {}
9 |
10 | FlutterWindow::~FlutterWindow() {}
11 |
12 | bool FlutterWindow::OnCreate() {
13 | if (!Win32Window::OnCreate()) {
14 | return false;
15 | }
16 |
17 | RECT frame = GetClientArea();
18 |
19 | // The size here must match the window dimensions to avoid unnecessary surface
20 | // creation / destruction in the startup path.
21 | flutter_controller_ = std::make_unique(
22 | frame.right - frame.left, frame.bottom - frame.top, project_);
23 | // Ensure that basic setup of the controller was successful.
24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) {
25 | return false;
26 | }
27 | RegisterPlugins(flutter_controller_->engine());
28 | SetChildContent(flutter_controller_->view()->GetNativeWindow());
29 | return true;
30 | }
31 |
32 | void FlutterWindow::OnDestroy() {
33 | if (flutter_controller_) {
34 | flutter_controller_ = nullptr;
35 | }
36 |
37 | Win32Window::OnDestroy();
38 | }
39 |
40 | LRESULT
41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
42 | WPARAM const wparam,
43 | LPARAM const lparam) noexcept {
44 | // Give Flutter, including plugins, an opportunity to handle window messages.
45 | if (flutter_controller_) {
46 | std::optional result =
47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
48 | lparam);
49 | if (result) {
50 | return *result;
51 | }
52 | }
53 |
54 | switch (message) {
55 | case WM_FONTCHANGE:
56 | flutter_controller_->engine()->ReloadSystemFonts();
57 | break;
58 | }
59 |
60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
61 | }
62 |
--------------------------------------------------------------------------------
/package/example/windows/runner/flutter_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_FLUTTER_WINDOW_H_
2 | #define RUNNER_FLUTTER_WINDOW_H_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include "win32_window.h"
10 |
11 | // A window that does nothing but host a Flutter view.
12 | class FlutterWindow : public Win32Window {
13 | public:
14 | // Creates a new FlutterWindow hosting a Flutter view running |project|.
15 | explicit FlutterWindow(const flutter::DartProject& project);
16 | virtual ~FlutterWindow();
17 |
18 | protected:
19 | // Win32Window:
20 | bool OnCreate() override;
21 | void OnDestroy() override;
22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
23 | LPARAM const lparam) noexcept override;
24 |
25 | private:
26 | // The project to run.
27 | flutter::DartProject project_;
28 |
29 | // The Flutter instance hosted by this window.
30 | std::unique_ptr flutter_controller_;
31 | };
32 |
33 | #endif // RUNNER_FLUTTER_WINDOW_H_
34 |
--------------------------------------------------------------------------------
/package/example/windows/runner/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "flutter_window.h"
6 | #include "utils.h"
7 |
8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
9 | _In_ wchar_t *command_line, _In_ int show_command) {
10 | // Attach to console when present (e.g., 'flutter run') or create a
11 | // new console when running with a debugger.
12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
13 | CreateAndAttachConsole();
14 | }
15 |
16 | // Initialize COM, so that it is available for use in the library and/or
17 | // plugins.
18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
19 |
20 | flutter::DartProject project(L"data");
21 |
22 | std::vector command_line_arguments =
23 | GetCommandLineArguments();
24 |
25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
26 |
27 | FlutterWindow window(project);
28 | Win32Window::Point origin(10, 10);
29 | Win32Window::Size size(1280, 720);
30 | if (!window.CreateAndShow(L"filesystem_picker_example", origin, size)) {
31 | return EXIT_FAILURE;
32 | }
33 | window.SetQuitOnClose(true);
34 |
35 | ::MSG msg;
36 | while (::GetMessage(&msg, nullptr, 0, 0)) {
37 | ::TranslateMessage(&msg);
38 | ::DispatchMessage(&msg);
39 | }
40 |
41 | ::CoUninitialize();
42 | return EXIT_SUCCESS;
43 | }
44 |
--------------------------------------------------------------------------------
/package/example/windows/runner/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Runner.rc
4 | //
5 | #define IDI_APP_ICON 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/package/example/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/example/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/package/example/windows/runner/runner.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PerMonitorV2
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/package/example/windows/runner/utils.cpp:
--------------------------------------------------------------------------------
1 | #include "utils.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | void CreateAndAttachConsole() {
11 | if (::AllocConsole()) {
12 | FILE *unused;
13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
14 | _dup2(_fileno(stdout), 1);
15 | }
16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
17 | _dup2(_fileno(stdout), 2);
18 | }
19 | std::ios::sync_with_stdio();
20 | FlutterDesktopResyncOutputStreams();
21 | }
22 | }
23 |
24 | std::vector GetCommandLineArguments() {
25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use.
26 | int argc;
27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
28 | if (argv == nullptr) {
29 | return std::vector();
30 | }
31 |
32 | std::vector command_line_arguments;
33 |
34 | // Skip the first argument as it's the binary name.
35 | for (int i = 1; i < argc; i++) {
36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i]));
37 | }
38 |
39 | ::LocalFree(argv);
40 |
41 | return command_line_arguments;
42 | }
43 |
44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) {
45 | if (utf16_string == nullptr) {
46 | return std::string();
47 | }
48 | int target_length = ::WideCharToMultiByte(
49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
50 | -1, nullptr, 0, nullptr, nullptr);
51 | std::string utf8_string;
52 | if (target_length == 0 || target_length > utf8_string.max_size()) {
53 | return utf8_string;
54 | }
55 | utf8_string.resize(target_length);
56 | int converted_length = ::WideCharToMultiByte(
57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
58 | -1, utf8_string.data(),
59 | target_length, nullptr, nullptr);
60 | if (converted_length == 0) {
61 | return std::string();
62 | }
63 | return utf8_string;
64 | }
65 |
--------------------------------------------------------------------------------
/package/example/windows/runner/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_UTILS_H_
2 | #define RUNNER_UTILS_H_
3 |
4 | #include
5 | #include
6 |
7 | // Creates a console for the process, and redirects stdout and stderr to
8 | // it for both the runner and the Flutter library.
9 | void CreateAndAttachConsole();
10 |
11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string
12 | // encoded in UTF-8. Returns an empty std::string on failure.
13 | std::string Utf8FromUtf16(const wchar_t* utf16_string);
14 |
15 | // Gets the command line arguments passed in as a std::vector,
16 | // encoded in UTF-8. Returns an empty std::vector on failure.
17 | std::vector GetCommandLineArguments();
18 |
19 | #endif // RUNNER_UTILS_H_
20 |
--------------------------------------------------------------------------------
/package/example/windows/runner/win32_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_WIN32_WINDOW_H_
2 | #define RUNNER_WIN32_WINDOW_H_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be
11 | // inherited from by classes that wish to specialize with custom
12 | // rendering and input handling
13 | class Win32Window {
14 | public:
15 | struct Point {
16 | unsigned int x;
17 | unsigned int y;
18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {}
19 | };
20 |
21 | struct Size {
22 | unsigned int width;
23 | unsigned int height;
24 | Size(unsigned int width, unsigned int height)
25 | : width(width), height(height) {}
26 | };
27 |
28 | Win32Window();
29 | virtual ~Win32Window();
30 |
31 | // Creates and shows a win32 window with |title| and position and size using
32 | // |origin| and |size|. New windows are created on the default monitor. Window
33 | // sizes are specified to the OS in physical pixels, hence to ensure a
34 | // consistent size to will treat the width height passed in to this function
35 | // as logical pixels and scale to appropriate for the default monitor. Returns
36 | // true if the window was created successfully.
37 | bool CreateAndShow(const std::wstring& title,
38 | const Point& origin,
39 | const Size& size);
40 |
41 | // Release OS resources associated with window.
42 | void Destroy();
43 |
44 | // Inserts |content| into the window tree.
45 | void SetChildContent(HWND content);
46 |
47 | // Returns the backing Window handle to enable clients to set icon and other
48 | // window properties. Returns nullptr if the window has been destroyed.
49 | HWND GetHandle();
50 |
51 | // If true, closing this window will quit the application.
52 | void SetQuitOnClose(bool quit_on_close);
53 |
54 | // Return a RECT representing the bounds of the current client area.
55 | RECT GetClientArea();
56 |
57 | protected:
58 | // Processes and route salient window messages for mouse handling,
59 | // size change and DPI. Delegates handling of these to member overloads that
60 | // inheriting classes can handle.
61 | virtual LRESULT MessageHandler(HWND window,
62 | UINT const message,
63 | WPARAM const wparam,
64 | LPARAM const lparam) noexcept;
65 |
66 | // Called when CreateAndShow is called, allowing subclass window-related
67 | // setup. Subclasses should return false if setup fails.
68 | virtual bool OnCreate();
69 |
70 | // Called when Destroy is called.
71 | virtual void OnDestroy();
72 |
73 | private:
74 | friend class WindowClassRegistrar;
75 |
76 | // OS callback called by message pump. Handles the WM_NCCREATE message which
77 | // is passed when the non-client area is being created and enables automatic
78 | // non-client DPI scaling so that the non-client area automatically
79 | // responsponds to changes in DPI. All other messages are handled by
80 | // MessageHandler.
81 | static LRESULT CALLBACK WndProc(HWND const window,
82 | UINT const message,
83 | WPARAM const wparam,
84 | LPARAM const lparam) noexcept;
85 |
86 | // Retrieves a class instance pointer for |window|
87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept;
88 |
89 | bool quit_on_close_ = false;
90 |
91 | // window handle for top level window.
92 | HWND window_handle_ = nullptr;
93 |
94 | // window handle for hosted content.
95 | HWND child_content_ = nullptr;
96 | };
97 |
98 | #endif // RUNNER_WIN32_WINDOW_H_
99 |
--------------------------------------------------------------------------------
/package/lib/filesystem_picker.dart:
--------------------------------------------------------------------------------
1 | library filesystem_picker;
2 |
3 | export 'src/common.dart';
4 |
5 | export 'src/options/theme/theme.dart';
6 | export 'src/options/picker_options.dart';
7 |
8 | export 'src/actions/action.dart';
9 | export 'src/actions/new_folder_action.dart';
10 |
11 | export 'src/picker_page.dart';
12 |
13 | export 'src/breadcrumbs.dart';
14 | export 'src/filesystem_list.dart';
15 | export 'src/filesystem_list_tile.dart';
16 |
17 | export 'src/shortcuts/shortcut.dart';
18 |
--------------------------------------------------------------------------------
/package/lib/src/actions/action.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 | import 'package:flutter/widgets.dart';
3 |
4 | /// Handler of the specified action signature.
5 | typedef FilesystemPickerContextActionCallback = Future Function(
6 | BuildContext context, Directory path);
7 |
8 | /// Defines an action that can be called for the current path, such as "Create Folder".
9 | class FilesystemPickerContextAction {
10 | /// Action icon.
11 | final Widget icon;
12 |
13 | /// Action name.
14 | final String text;
15 |
16 | /// The handler called for the action.
17 | final FilesystemPickerContextActionCallback? action;
18 |
19 | /// Creates an action definition.
20 | FilesystemPickerContextAction({
21 | required this.icon,
22 | required this.text,
23 | this.action,
24 | });
25 |
26 | /// Called when the user tapped on a button or menu item of a contextual action.
27 | Future call(BuildContext context, Directory path) {
28 | return action?.call(context, path) ?? Future.value(false);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/package/lib/src/actions/new_folder_action.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 | import 'package:path/path.dart' as p;
3 | import 'package:filesystem_picker/src/actions/action.dart';
4 | import 'package:filesystem_picker/src/actions/shakeable_dialogs.dart';
5 | import 'package:flutter/material.dart';
6 |
7 | /// The signature of the error message string interpolator when the folder being created already exists.
8 | typedef FilesystemPickerNewFolderMessageBuilder = String Function(String value);
9 |
10 | /// Defines the action to create a new folder.
11 | class FilesystemPickerNewFolderContextAction
12 | extends FilesystemPickerContextAction {
13 | /// Title of the dialog for creating a new folder.
14 | final String? dialogTitle;
15 |
16 | /// Message in the dialog for creating a new folder.
17 | final String? dialogPrompt;
18 |
19 | /// The text of the "OK" button in the dialog for creating a new folder.
20 | final String? dialogOkText;
21 |
22 | /// The text of the "Cancel" button in the dialog for creating a new folder.
23 | final String? dialogCancelText;
24 |
25 | /// The interpolator of the error message string when the folder being created already exists.
26 | /// Default message: 'The folder with the name "<new folder name>" already exists. Please use another name.'
27 | final FilesystemPickerNewFolderMessageBuilder? alreadyExistsMessage;
28 |
29 | /// The theme that is passed to the dialog.
30 | final ThemeData? theme;
31 |
32 | /// Creates an action definition.
33 | FilesystemPickerNewFolderContextAction({
34 | super.icon = const Icon(Icons.create_new_folder),
35 | super.text = 'New folder',
36 | this.dialogTitle,
37 | this.dialogPrompt,
38 | this.dialogOkText,
39 | this.dialogCancelText,
40 | this.alreadyExistsMessage,
41 | this.theme,
42 | }) : super();
43 |
44 | /// Called when the user tapped on a button or menu item of a contextual action.
45 | @override
46 | Future call(BuildContext context, Directory path) async {
47 | Widget dialog = FilesystemPickerNewFolderDialog(
48 | title: dialogTitle,
49 | prompt: dialogPrompt,
50 | okText: dialogOkText,
51 | cancelText: dialogCancelText,
52 | onDone: (value) async {
53 | if (value != null) {
54 | try {
55 | if (!await _createFolder(path, value)) {
56 | final message = (alreadyExistsMessage != null)
57 | ? alreadyExistsMessage!.call(value)
58 | : 'The folder with the name "$value" already exists. Please use another name.';
59 |
60 | if (context.mounted) {
61 | await _showError(context, message);
62 | }
63 | return;
64 | }
65 | } catch (e) {
66 | // debugPrint('Error: ${e.runtimeType}');
67 |
68 | if (context.mounted) {
69 | await _showError(context, '$e');
70 | }
71 | return;
72 | }
73 | }
74 |
75 | if (context.mounted) {
76 | Navigator.maybeOf(context)?.pop(true);
77 | }
78 | },
79 | );
80 |
81 | if (theme != null) {
82 | dialog = Theme(
83 | data: theme!,
84 | child: dialog,
85 | );
86 | }
87 |
88 | final result = await showDialog(
89 | context: context,
90 | builder: (context) => dialog,
91 | );
92 | return (result == true);
93 | }
94 |
95 | Future _showError(BuildContext context, String message) async {
96 | return showDialog(
97 | context: context,
98 | builder: (context) => AlertDialog(
99 | content: Text(message),
100 | actions: [
101 | TextButton(
102 | child: const Text('OK'),
103 | onPressed: () => Navigator.maybeOf(context)?.pop(),
104 | ),
105 | ],
106 | ),
107 | );
108 | }
109 |
110 | Future _createFolder(Directory parent, String folderName) async {
111 | // debugPrint('Create folder: "$folderName" in "$parent".');
112 |
113 | final newDirectory = Directory(p.join(parent.path, folderName));
114 |
115 | if (await newDirectory.exists()) {
116 | return false;
117 | } else {
118 | await newDirectory.create();
119 | return true;
120 | }
121 | }
122 | }
123 |
124 | /// A dialog asking for a name for the new folder.
125 | class FilesystemPickerNewFolderDialog extends StatefulWidget {
126 | /// Dialog title.
127 | final String? title;
128 |
129 | /// Dialog message before the new folder name input field.
130 | final String? prompt;
131 |
132 | /// The text of the "OK" button.
133 | final String? okText;
134 |
135 | /// The text of the "Cancel" button.
136 | final String? cancelText;
137 |
138 | /// The handler called when the user specified the name of the new folder and clicked the "OK" button.
139 | final ValueChanged onDone;
140 |
141 | /// Creates a dialog asking for a name for the new folder.
142 | const FilesystemPickerNewFolderDialog({
143 | Key? key,
144 | this.title,
145 | this.prompt,
146 | this.okText,
147 | this.cancelText,
148 | required this.onDone,
149 | }) : super(key: key);
150 |
151 | @override
152 | State createState() =>
153 | _FilesystemPickerNewFolderDialogState();
154 | }
155 |
156 | class _FilesystemPickerNewFolderDialogState
157 | extends State {
158 | final ShakeableController _shakeController = ShakeableController();
159 | String? _folderName;
160 |
161 | @override
162 | Widget build(BuildContext context) {
163 | return ShakeableAnimation(
164 | controller: _shakeController,
165 | child: AlertDialog(
166 | title: Text(widget.title ?? 'New folder'),
167 | content: Column(
168 | crossAxisAlignment: CrossAxisAlignment.stretch,
169 | mainAxisSize: MainAxisSize.min,
170 | children: [
171 | if (widget.prompt?.isNotEmpty ?? true)
172 | Text(
173 | widget.prompt ?? 'Please enter new folder name',
174 | ),
175 | TextField(
176 | autofocus: true,
177 | onChanged: (value) => _folderName = value,
178 | ),
179 | ],
180 | ),
181 | actions: [
182 | TextButton(
183 | child: Text((widget.cancelText ?? 'Cancel').toUpperCase()),
184 | // style: TextButton.styleFrom(
185 | // // foregroundColor: Theme.of(context).textTheme.button?.color,
186 | // foregroundColor: Theme.of(context).dialogTheme.contentTextStyle?.color ??
187 | // Theme.of(context).textTheme.bodyMedium?.color,
188 | // ),
189 | onPressed: () {
190 | Navigator.maybeOf(context)?.pop();
191 | },
192 | ),
193 | TextButton(
194 | child: Text((widget.okText ?? 'OK').toUpperCase()),
195 | // style: TextButton.styleFrom(
196 | // foregroundColor: Theme.of(context).primaryColor,
197 | // ),
198 | onPressed: () {
199 | if (_folderName?.isNotEmpty ?? false) {
200 | widget.onDone.call(_folderName);
201 | } else {
202 | _shakeController.shake();
203 | }
204 | },
205 | ),
206 | ],
207 | ),
208 | );
209 | }
210 | }
211 |
--------------------------------------------------------------------------------
/package/lib/src/actions/shakeable_dialogs.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math' as math;
2 | import 'package:flutter/material.dart';
3 |
4 | class ShakeableController with ChangeNotifier {
5 | void shake() {
6 | notifyListeners();
7 | }
8 | }
9 |
10 | class ShakeableAnimation extends StatefulWidget {
11 | final ShakeableController controller;
12 | final Widget child;
13 | final Curve curve;
14 | final Duration duration;
15 | final double distance;
16 | final int count;
17 |
18 | const ShakeableAnimation({
19 | Key? key,
20 | required this.controller,
21 | required this.child,
22 | this.curve = Curves.bounceOut,
23 | this.duration = const Duration(milliseconds: 100),
24 | this.distance = 12.0,
25 | this.count = 2,
26 | }) : super(key: key);
27 |
28 | @override
29 | State createState() => _ShakeableAnimationState();
30 | }
31 |
32 | class _ShakeableAnimationState extends State
33 | with SingleTickerProviderStateMixin {
34 | late final _controller = AnimationController(
35 | vsync: this,
36 | duration: widget.duration,
37 | );
38 | late final Animation _animation = CurvedAnimation(
39 | parent: _controller,
40 | curve: widget.curve,
41 | );
42 |
43 | @override
44 | void initState() {
45 | super.initState();
46 |
47 | widget.controller.addListener(_doShake);
48 | }
49 |
50 | @override
51 | void didUpdateWidget(covariant ShakeableAnimation oldWidget) {
52 | super.didUpdateWidget(oldWidget);
53 |
54 | if (oldWidget.controller != widget.controller) {
55 | oldWidget.controller.removeListener(_doShake);
56 | widget.controller.addListener(_doShake);
57 | }
58 | }
59 |
60 | @override
61 | void dispose() {
62 | widget.controller.removeListener(_doShake);
63 |
64 | _controller.dispose();
65 | super.dispose();
66 | }
67 |
68 | Future _doShake() async {
69 | for (var i = 0; i < widget.count; i++) {
70 | await _controller.forward(from: 0.0);
71 | }
72 | }
73 |
74 | @override
75 | Widget build(BuildContext context) {
76 | return AnimatedBuilder(
77 | animation: _animation,
78 | builder: (context, child) {
79 | final dx = math.sin(_controller.value * 2 * math.pi) * widget.distance;
80 | return Transform.translate(
81 | offset: Offset(dx, 0),
82 | child: child,
83 | );
84 | },
85 | child: widget.child,
86 | );
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/package/lib/src/breadcrumbs.dart:
--------------------------------------------------------------------------------
1 | import 'package:filesystem_picker/src/desktop_scroller.dart';
2 | import 'package:flutter/foundation.dart';
3 | import 'package:flutter/material.dart';
4 | import 'listview_extensions.dart';
5 | import 'options/theme/_breadcrumbs_theme.dart';
6 |
7 | /// Path element description class for breadcrumbs
8 | class BreadcrumbItem with Diagnosticable {
9 | /// Item text
10 | final String text;
11 |
12 | /// Item related data
13 | final T? data;
14 |
15 | /// Called when an item is selected
16 | final ValueChanged? onSelect;
17 |
18 | /// Creates an item of breadcrumbs
19 | BreadcrumbItem({
20 | required this.text,
21 | this.data,
22 | this.onSelect,
23 | });
24 |
25 | @override
26 | void debugFillProperties(DiagnosticPropertiesBuilder properties) {
27 | super.debugFillProperties(properties);
28 | properties.add(StringProperty('text', text));
29 | properties.add(DiagnosticsProperty('data', data));
30 | properties
31 | .add(ObjectFlagProperty?>.has('onSelect', onSelect));
32 | }
33 | }
34 |
35 | /// Horizontally scrollable breadcrumbs with `Icons.chevron_right` separator and fade on the right.
36 | class Breadcrumbs extends StatelessWidget {
37 | static const double defaultHeight = 50;
38 |
39 | /// List of items of breadcrumbs
40 | final List> items;
41 |
42 | /// Height of the breadcrumbs panel
43 | final double height;
44 |
45 | /// List item text color
46 | final Color? textColor;
47 |
48 | /// Called when an item is selected
49 | final ValueChanged? onSelect;
50 |
51 | /// The theme for Breadcrumbs.
52 | final BreadcrumbsThemeData? theme;
53 |
54 | final ScrollController _scrollController = ScrollController();
55 |
56 | /// Creates horizontally scrollable breadcrumbs with `Icons.chevron_right` separator and fade on the right.
57 | Breadcrumbs({
58 | Key? key,
59 | required this.items,
60 | this.height = defaultHeight,
61 | this.textColor,
62 | this.onSelect,
63 | this.theme,
64 | }) : super(key: key);
65 |
66 | _scrollToEnd() async {
67 | if (_scrollController.hasClients) {
68 | _scrollController.jumpTo(_scrollController.position.maxScrollExtent);
69 | }
70 | }
71 |
72 | @override
73 | Widget build(BuildContext context) {
74 | WidgetsBinding.instance.addPostFrameCallback((_) => _scrollToEnd());
75 |
76 | final effectiveTheme = theme ?? BreadcrumbsThemeData();
77 | final textStyle = effectiveTheme.getTextStyle(context);
78 | final activeColor = effectiveTheme.getItemColor(context, textColor);
79 | final inactiveColor =
80 | effectiveTheme.getInactiveItemColor(context, textColor);
81 | final separatorColor = effectiveTheme.getSeparatorColor(context, textColor);
82 | final overlayColor = effectiveTheme.getOverlayColor(context, textColor);
83 |
84 | return DecoratedBox(
85 | decoration: BoxDecoration(
86 | color: effectiveTheme.backgroundColor,
87 | ),
88 | child: ShaderMask(
89 | shaderCallback: (Rect bounds) {
90 | return const LinearGradient(
91 | begin: Alignment(0.7, 0.5),
92 | end: Alignment.centerRight,
93 | colors: [Colors.white, Colors.transparent],
94 | ).createShader(bounds);
95 | },
96 | blendMode: BlendMode.dstIn,
97 | child: Container(
98 | alignment: Alignment.topLeft,
99 | height: height,
100 | child: DesktopScroller(
101 | scrollController: _scrollController,
102 | builder: (context, scrollController) {
103 | return ListViewExtended.separatedWithHeaderFooter(
104 | controller: scrollController,
105 | shrinkWrap: true,
106 | scrollDirection: Axis.horizontal,
107 | itemCount: items.length,
108 | itemBuilder: (BuildContext context, int index) {
109 | final textColor = (index == (items.length - 1))
110 | ? activeColor
111 | : inactiveColor;
112 |
113 | return TextButton(
114 | style: ButtonStyle(
115 | overlayColor: MaterialStateProperty.all(overlayColor),
116 | minimumSize: (effectiveTheme.itemMinimumSize != null)
117 | ? MaterialStateProperty.all(
118 | effectiveTheme.itemMinimumSize)
119 | : null,
120 | padding: (effectiveTheme.itemPadding != null)
121 | ? MaterialStateProperty.all(
122 | effectiveTheme.itemPadding)
123 | : null,
124 | tapTargetSize:
125 | effectiveTheme.getItemTapTargetSize(context),
126 | ),
127 | child: Text(
128 | items[index].text,
129 | style: textStyle.copyWith(color: textColor),
130 | ),
131 | onPressed: () {
132 | items[index].onSelect?.call(items[index].data);
133 | onSelect?.call(items[index].data);
134 | },
135 | );
136 | },
137 | separatorBuilder: (_, __) => Align(
138 | alignment: Alignment.center,
139 | child: Icon(
140 | effectiveTheme.getSeparatorIcon(context),
141 | color: separatorColor,
142 | size: effectiveTheme.getSeparatorIconSize(context),
143 | ),
144 | ),
145 | headerBuilder: (_) => SizedBox(
146 | width: effectiveTheme.getLeadingSpacing(context)),
147 | footerBuilder: (_) => SizedBox(
148 | width: effectiveTheme.getTrailingSpacing(context)),
149 | );
150 | }),
151 | ),
152 | ),
153 | );
154 | }
155 | }
156 |
--------------------------------------------------------------------------------
/package/lib/src/common.dart:
--------------------------------------------------------------------------------
1 | /// Enumeration with options for display types of the file system.
2 | enum FilesystemType {
3 | /// Folders and files
4 | all,
5 |
6 | /// Folders only
7 | folder,
8 |
9 | /// Files only
10 | file,
11 | }
12 |
13 | /// Value selection signature.
14 | typedef ValueSelected = void Function(String value);
15 |
16 | /// Access permission request signature.
17 | typedef RequestPermission = Future Function();
18 |
19 | /// Mode for selecting files. Either only the button in the trailing
20 | /// of row, or onTap of the whole row.
21 | enum FileTileSelectMode {
22 | /// The file is selected only by tapping the button to the right of the file name.
23 | checkButton,
24 |
25 | /// The file is selected by tapping on the entire row of the list.
26 | wholeTile,
27 | }
28 |
--------------------------------------------------------------------------------
/package/lib/src/desktop_scroller.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/foundation.dart';
2 | import 'package:flutter/gestures.dart';
3 | import 'package:flutter/widgets.dart';
4 |
5 | import 'mouse_wheel_scroller.dart';
6 |
7 | typedef DesktopScrollerBuilder = Widget Function(
8 | BuildContext context, ScrollController controller);
9 |
10 | class DesktopScroller extends StatefulWidget {
11 | final DesktopScrollerBuilder builder;
12 | final ScrollController? scrollController;
13 |
14 | const DesktopScroller({
15 | super.key,
16 | required this.builder,
17 | this.scrollController,
18 | });
19 |
20 | @override
21 | State createState() => _DesktopScrollerState();
22 | }
23 |
24 | class _DesktopScrollerState extends State {
25 | ScrollController? _scrollController;
26 | ScrollController get scrollController =>
27 | widget.scrollController ?? (_scrollController ??= ScrollController());
28 |
29 | @override
30 | Widget build(BuildContext context) {
31 | final isMobile = (defaultTargetPlatform == TargetPlatform.iOS ||
32 | defaultTargetPlatform == TargetPlatform.android);
33 | if (isMobile) return widget.builder(context, scrollController);
34 |
35 | return ScrollConfiguration(
36 | behavior: ScrollConfiguration.of(context).copyWith(dragDevices: {
37 | PointerDeviceKind.touch,
38 | PointerDeviceKind.mouse,
39 | PointerDeviceKind.trackpad,
40 | }),
41 | child: MouseWheelScroller(
42 | scrollController: scrollController,
43 | builder: (context, controller) {
44 | return widget.builder(context, controller);
45 | },
46 | ),
47 | );
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/package/lib/src/filesystem_list_tile.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 | import 'package:flutter/material.dart';
3 | import 'package:path/path.dart' as path;
4 | import 'common.dart';
5 | import 'options/theme/_filelist_theme.dart';
6 |
7 | /// A single row displaying a folder or file, the corresponding icon and the trailing
8 | /// selection button for the file (configured in the `fileTileSelectMode` parameter).
9 | ///
10 | /// Used in conjunction with the `FilesystemList` widget.
11 | class FilesystemListTile extends StatelessWidget {
12 | /// The type of view (folder and files, folder only or files only), by default `FilesystemType.all`.
13 | final FilesystemType fsType;
14 |
15 | /// The entity of the file system that should be displayed by the widget.
16 | final FileSystemEntity item;
17 |
18 | /// The color of the folder icon in the list.
19 | final Color? folderIconColor;
20 |
21 | /// Called when the user has touched a subfolder list item.
22 | final ValueChanged onChange;
23 |
24 | /// Called when a file system item is selected.
25 | final ValueSelected onSelect;
26 |
27 | /// Specifies how to files can be selected (either tapping on the whole tile or only on trailing button).
28 | final FileTileSelectMode fileTileSelectMode;
29 |
30 | /// Specifies a list theme in which colors, fonts, icons, etc. can be customized.
31 | final FilesystemPickerFileListThemeData? theme;
32 |
33 | /// Specifies the extension comparison mode to determine the icon specified for the file types in the theme,
34 | /// case-sensitive or case-insensitive, by default it is insensitive.
35 | final bool caseSensitiveFileExtensionComparison;
36 |
37 | /// Creates a file system entity list tile.
38 | const FilesystemListTile({
39 | Key? key,
40 | this.fsType = FilesystemType.all,
41 | required this.item,
42 | this.folderIconColor,
43 | required this.onChange,
44 | required this.onSelect,
45 | required this.fileTileSelectMode,
46 | this.theme,
47 | this.caseSensitiveFileExtensionComparison = false,
48 | }) : super(key: key);
49 |
50 | Widget _leading(BuildContext context, FilesystemPickerFileListThemeData theme,
51 | bool isFile) {
52 | if (item is Directory) {
53 | return Icon(
54 | theme.getFolderIcon(context),
55 | color: theme.getFolderIconColor(context, folderIconColor),
56 | size: theme.getIconSize(context),
57 | );
58 | } else {
59 | return _fileIcon(context, theme, item.path, isFile);
60 | }
61 | }
62 |
63 | /// Set the icon for a file
64 | Icon _fileIcon(BuildContext context, FilesystemPickerFileListThemeData theme,
65 | String filename, bool isFile,
66 | [Color? color]) {
67 | final entryExtension = filename.split(".").last;
68 | IconData icon = theme.getFileIcon(
69 | context, entryExtension, caseSensitiveFileExtensionComparison);
70 |
71 | return Icon(
72 | icon,
73 | color: theme.getFileIconColor(context, color),
74 | size: theme.getIconSize(context),
75 | );
76 | }
77 |
78 | Widget? _trailing(BuildContext context,
79 | FilesystemPickerFileListThemeData theme, bool isFile) {
80 | final isCheckable = ((fsType == FilesystemType.all) ||
81 | ((fsType == FilesystemType.file) &&
82 | (item is File) &&
83 | (fileTileSelectMode != FileTileSelectMode.wholeTile)));
84 |
85 | if (isCheckable) {
86 | final iconTheme = theme.getCheckIconTheme(context);
87 | return InkResponse(
88 | child: Icon(
89 | theme.getCheckIcon(context),
90 | color: iconTheme.color,
91 | size: iconTheme.size,
92 | ),
93 | onTap: () => onSelect(item.absolute.path),
94 | );
95 | } else {
96 | return null;
97 | }
98 | }
99 |
100 | @override
101 | Widget build(BuildContext context) {
102 | final effectiveTheme = theme ?? FilesystemPickerFileListThemeData();
103 | final isFile = (fsType == FilesystemType.file) && (item is File);
104 | final style = !isFile
105 | ? effectiveTheme.getFolderTextStyle(context)
106 | : effectiveTheme.getFileTextStyle(context);
107 |
108 | return ListTile(
109 | key: Key(item.absolute.path),
110 | leading: _leading(context, effectiveTheme, isFile),
111 | trailing: _trailing(context, effectiveTheme, isFile),
112 | title: Text(path.basename(item.path),
113 | style: style,
114 | textScaleFactor: effectiveTheme.getTextScaleFactor(context, isFile)),
115 | onTap: (item is Directory)
116 | ? () => onChange(item as Directory)
117 | : ((fsType == FilesystemType.file &&
118 | fileTileSelectMode == FileTileSelectMode.wholeTile)
119 | ? () => onSelect(item.absolute.path)
120 | : null),
121 | );
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/package/lib/src/listview_extensions.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'dart:math' as math;
3 |
4 | extension ListViewExtended on ListView {
5 | /// Creates a fixed-length scrollable linear array of list "items" separated
6 | /// by list item "separators".
7 | ///
8 | /// This constructor is appropriate for list views with a large number of
9 | /// item and separator children because the builders are only called for
10 | /// the children that are actually visible.
11 | ///
12 | /// The `itemBuilder` callback will be called with indices greater than
13 | /// or equal to zero and less than `itemCount`.
14 | ///
15 | /// Separators only appear between list items: separator 0 appears after item
16 | /// 0 and the last separator appears before the last item.
17 | ///
18 | /// The `separatorBuilder` callback will be called with indices greater than
19 | /// or equal to zero and less than `itemCount - 1`.
20 | ///
21 | /// The `itemBuilder` and `separatorBuilder` callbacks should actually create
22 | /// widget instances when called. Avoid using a builder that returns a
23 | /// previously-constructed widget; if the list view's children are created in
24 | /// advance, or all at once when the [ListView] itself is created, it is more
25 | /// efficient to use [ListView].
26 | ///
27 | /// {@tool sample}
28 | ///
29 | /// This example shows how to create [ListView] whose [ListTile] list items
30 | /// are separated by [Divider]s.
31 | ///
32 | /// ```dart
33 | /// ListView.separatedWithHeaderFooter(
34 | /// itemCount: 25,
35 | /// separatorBuilder: (BuildContext context, int index) => Divider(),
36 | /// itemBuilder: (BuildContext context, int index) {
37 | /// return ListTile(
38 | /// title: Text('item $index'),
39 | /// );
40 | /// },
41 | /// )
42 | /// ```
43 | /// {@end-tool}
44 | ///
45 | /// The `addAutomaticKeepAlives` argument corresponds to the
46 | /// [SliverChildBuilderDelegate.addAutomaticKeepAlives] property. The
47 | /// `addRepaintBoundaries` argument corresponds to the
48 | /// [SliverChildBuilderDelegate.addRepaintBoundaries] property. The
49 | /// `addSemanticIndexes` argument corresponds to the
50 | /// [SliverChildBuilderDelegate.addSemanticIndexes] property. None may be
51 | /// null.
52 | static ListView separatedWithHeaderFooter({
53 | Key? key,
54 | Axis scrollDirection = Axis.vertical,
55 | bool reverse = false,
56 | ScrollController? controller,
57 | bool? primary,
58 | ScrollPhysics? physics,
59 | bool shrinkWrap = false,
60 | EdgeInsetsGeometry? padding,
61 | required IndexedWidgetBuilder itemBuilder,
62 | required IndexedWidgetBuilder separatorBuilder,
63 | WidgetBuilder? headerBuilder,
64 | WidgetBuilder? footerBuilder,
65 | required int itemCount,
66 | bool addAutomaticKeepAlives = true,
67 | bool addRepaintBoundaries = true,
68 | bool addSemanticIndexes = true,
69 | double? cacheExtent,
70 | }) {
71 | assert(itemCount >= 0);
72 | final int childCount =
73 | _computeSemanticChildCount(itemCount, headerBuilder, footerBuilder);
74 |
75 | SliverChildBuilderDelegate childrenDelegate = SliverChildBuilderDelegate(
76 | (BuildContext context, int index) {
77 | // final int itemIndex = (index ~/ 2);
78 | final int delta = ((headerBuilder != null) ? 1 : 0);
79 | final int itemIndex = (index - delta) ~/ 2;
80 | Widget widget;
81 | if ((headerBuilder != null) && (index == 0)) {
82 | widget = headerBuilder(context);
83 | } else if ((footerBuilder != null) && (index == (childCount - 1))) {
84 | widget = footerBuilder(context);
85 | } else if ((index - delta).isEven) {
86 | widget = itemBuilder(context, itemIndex);
87 | } else {
88 | widget = separatorBuilder(context, itemIndex);
89 | }
90 | return widget;
91 | },
92 | childCount: childCount,
93 | addAutomaticKeepAlives: addAutomaticKeepAlives,
94 | addRepaintBoundaries: addRepaintBoundaries,
95 | addSemanticIndexes: addSemanticIndexes,
96 | semanticIndexCallback: (Widget _, int index) {
97 | return index.isEven
98 | ? ((((headerBuilder != null) ? 1 : 0) + index) ~/ 2)
99 | : null;
100 | },
101 | );
102 | return ListView.custom(
103 | key: key,
104 | scrollDirection: scrollDirection,
105 | reverse: reverse,
106 | controller: controller,
107 | primary: primary,
108 | physics: physics,
109 | shrinkWrap: shrinkWrap,
110 | padding: padding,
111 | itemExtent: null,
112 | childrenDelegate: childrenDelegate,
113 | semanticChildCount: childCount,
114 | );
115 | }
116 |
117 | // Helper method to compute the semantic child count for the separated constructor.
118 | static int _computeSemanticChildCount(int itemCount,
119 | WidgetBuilder? headerBuilder, WidgetBuilder? footerBuilder) {
120 | return math.max(0, itemCount * 2 - 1) +
121 | ((headerBuilder != null) ? 1 : 0) +
122 | ((footerBuilder != null) ? 1 : 0);
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/package/lib/src/mouse_wheel_scroller.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math' as math;
2 | import 'package:flutter/foundation.dart';
3 | import 'package:flutter/gestures.dart';
4 | import 'package:flutter/widgets.dart';
5 |
6 | typedef MouseWheelScrollerBuilder = Widget Function(
7 | BuildContext context, ScrollController controller);
8 |
9 | class MouseWheelScroller extends StatefulWidget {
10 | final MouseWheelScrollerBuilder builder;
11 | final ScrollController? scrollController;
12 |
13 | const MouseWheelScroller({
14 | super.key,
15 | required this.builder,
16 | this.scrollController,
17 | });
18 |
19 | @override
20 | State createState() => _MouseWheelScrollerState();
21 | }
22 |
23 | class _MouseWheelScrollerState extends State {
24 | ScrollController? _scrollController;
25 | ScrollController get scrollController =>
26 | widget.scrollController ?? (_scrollController ??= ScrollController());
27 |
28 | final double scrollAmountMultiplier = 3.0;
29 | final scrollDuration = const Duration(milliseconds: 400);
30 | final scrollCurve = Curves.linearToEaseOut;
31 | final int mouseWheelTurnsThrottleTimeMs = 80;
32 |
33 | late final Throttler mouseWheelForwardThrottler;
34 | late final Throttler mouseWheelBackwardThrottler;
35 |
36 | @override
37 | void initState() {
38 | super.initState();
39 | mouseWheelForwardThrottler = Throttler(mouseWheelTurnsThrottleTimeMs);
40 | mouseWheelBackwardThrottler = Throttler(mouseWheelTurnsThrottleTimeMs);
41 | }
42 |
43 | @override
44 | void dispose() {
45 | super.dispose();
46 | }
47 |
48 | @override
49 | Widget build(BuildContext context) {
50 | final child = widget.builder(context, scrollController);
51 |
52 | final isMobile = (defaultTargetPlatform == TargetPlatform.iOS ||
53 | defaultTargetPlatform == TargetPlatform.android);
54 | if (isMobile) return child;
55 |
56 | return Listener(
57 | onPointerSignal: (event) {
58 | if (event is PointerScrollEvent &&
59 | event.kind == PointerDeviceKind.mouse) {
60 | final scrollDelta = event.scrollDelta.dy;
61 |
62 | final newOffset =
63 | scrollController.offset + scrollDelta * scrollAmountMultiplier;
64 |
65 | final duration = scrollDuration;
66 | final curve = scrollCurve;
67 |
68 | if (scrollDelta.isNegative) {
69 | mouseWheelForwardThrottler.run(() {
70 | scrollController.animateTo(
71 | math.max(0.0, newOffset),
72 | duration: duration,
73 | curve: curve,
74 | );
75 | });
76 | } else {
77 | mouseWheelBackwardThrottler.run(() {
78 | scrollController.animateTo(
79 | math.min(scrollController.position.maxScrollExtent, newOffset),
80 | duration: duration,
81 | curve: curve,
82 | );
83 | });
84 | }
85 | }
86 | },
87 | behavior: HitTestBehavior.opaque,
88 | child: child,
89 | );
90 | }
91 | }
92 |
93 | /// Throttle some action by a specified amount of milliseconds
94 | class Throttler {
95 | /// Throttle value
96 | Throttler(this._throttleTimeMs);
97 |
98 | final int _throttleTimeMs;
99 | int? _lastRunTimeMs;
100 |
101 | /// Run the function which needs to be throttled
102 | void run(void Function() action) {
103 | if (_lastRunTimeMs == null) {
104 | action();
105 | _lastRunTimeMs = DateTime.now().millisecondsSinceEpoch;
106 | } else {
107 | if (DateTime.now().millisecondsSinceEpoch - _lastRunTimeMs! >
108 | _throttleTimeMs) {
109 | action();
110 | _lastRunTimeMs = DateTime.now().millisecondsSinceEpoch;
111 | }
112 | }
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/package/lib/src/options/picker_bottom_sheet_options.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/foundation.dart';
2 | import 'package:flutter/widgets.dart';
3 |
4 | @immutable
5 | class FilesystemPickerBottomSheetOptions with Diagnosticable {
6 | static const BoxConstraints defaultConstraints = BoxConstraints(
7 | minWidth: 280,
8 | maxWidth: 300,
9 | );
10 | static const Color defaultBarrierColor = Color(0x00000000);
11 | static const ShapeBorder defaultShape = RoundedRectangleBorder(
12 | borderRadius: BorderRadius.vertical(
13 | top: Radius.circular(8),
14 | ),
15 | );
16 | static const double defaultElevation = 24;
17 |
18 | static const double defaultInitialChildSize = 0.8;
19 | static const double defaultMinChildSize = 0.6;
20 | static const double defaultMaxChildSize = 0.96;
21 |
22 | final BoxConstraints constraints;
23 | final Color barrierColor;
24 | final ShapeBorder shape;
25 | final double elevation;
26 |
27 | final double initialChildSize;
28 | final double minChildSize;
29 | final double maxChildSize;
30 |
31 | const FilesystemPickerBottomSheetOptions({
32 | this.constraints = defaultConstraints,
33 | this.barrierColor = defaultBarrierColor,
34 | this.shape = defaultShape,
35 | this.elevation = defaultElevation,
36 | this.initialChildSize = defaultInitialChildSize,
37 | this.minChildSize = defaultMinChildSize,
38 | this.maxChildSize = defaultMaxChildSize,
39 | });
40 |
41 | @override
42 | int get hashCode {
43 | return Object.hash(
44 | constraints,
45 | barrierColor,
46 | shape,
47 | elevation,
48 | initialChildSize,
49 | minChildSize,
50 | maxChildSize,
51 | );
52 | }
53 |
54 | @override
55 | bool operator ==(Object other) {
56 | if (identical(this, other)) return true;
57 | if (other.runtimeType != runtimeType) return false;
58 | return other is FilesystemPickerBottomSheetOptions &&
59 | other.constraints == constraints &&
60 | other.barrierColor == barrierColor &&
61 | other.shape == shape &&
62 | other.elevation == elevation &&
63 | other.initialChildSize == initialChildSize &&
64 | other.minChildSize == minChildSize &&
65 | other.maxChildSize == maxChildSize;
66 | }
67 |
68 | @override
69 | void debugFillProperties(DiagnosticPropertiesBuilder properties) {
70 | super.debugFillProperties(properties);
71 | properties.add(DiagnosticsProperty(
72 | 'constraints', constraints,
73 | defaultValue: defaultConstraints));
74 | properties.add(DiagnosticsProperty('barrierColor', barrierColor,
75 | defaultValue: defaultBarrierColor));
76 | properties.add(DiagnosticsProperty('shape', shape,
77 | defaultValue: defaultShape));
78 | properties.add(DiagnosticsProperty('elevation', elevation,
79 | defaultValue: defaultElevation));
80 | properties.add(DiagnosticsProperty(
81 | 'initialChildSize', initialChildSize,
82 | defaultValue: defaultInitialChildSize));
83 | properties.add(DiagnosticsProperty('minChildSize', minChildSize,
84 | defaultValue: defaultMinChildSize));
85 | properties.add(DiagnosticsProperty('maxChildSize', maxChildSize,
86 | defaultValue: defaultMaxChildSize));
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/package/lib/src/options/picker_dialog_options.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/foundation.dart';
2 | import 'package:flutter/widgets.dart';
3 |
4 | @immutable
5 | class FilesystemPickerDialogOptions with Diagnosticable {
6 | static const BoxConstraints defaultConstraints = BoxConstraints(
7 | minWidth: 280,
8 | minHeight: 460,
9 | maxWidth: 690,
10 | maxHeight: 690,
11 | );
12 |
13 | final BoxConstraints constraints;
14 |
15 | const FilesystemPickerDialogOptions({
16 | this.constraints = defaultConstraints,
17 | });
18 |
19 | @override
20 | int get hashCode {
21 | return constraints.hashCode;
22 | }
23 |
24 | @override
25 | bool operator ==(Object other) {
26 | if (identical(this, other)) return true;
27 | if (other.runtimeType != runtimeType) return false;
28 | return other is FilesystemPickerDialogOptions &&
29 | other.constraints == constraints;
30 | }
31 |
32 | @override
33 | void debugFillProperties(DiagnosticPropertiesBuilder properties) {
34 | super.debugFillProperties(properties);
35 | properties.add(DiagnosticsProperty(
36 | 'constraints', constraints,
37 | defaultValue: defaultConstraints));
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/package/lib/src/options/theme/_breadcrumbs_theme.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/foundation.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | /// Defines a theme for the breadcrumbs used in the picker and [Breadcrumbs] widget.
5 | ///
6 | /// Here you can set the color and style of the items, icons and their size, etc.
7 | @immutable
8 | class BreadcrumbsThemeData with Diagnosticable {
9 | /// The default separator icon.
10 | static const defaultSeparatorIcon = Icons.chevron_right;
11 |
12 | /// The default size for the separator icon.
13 | static const double defaultSeparatorIconSize = 24;
14 |
15 | /// Leading spacing by default.
16 | static const double defaultLeadingSpacing = 8;
17 |
18 | /// Trailing spacing by default.
19 | static const double defaultTrailingSpacing = 70;
20 |
21 | /// The default minimum size of the area within which the button may be pressed.
22 | static const MaterialTapTargetSize defaultItemTapTargetSize =
23 | MaterialTapTargetSize.padded;
24 |
25 | /// The color of the last (active) item.
26 | final Color? itemColor;
27 |
28 | /// The color of the inactive item.
29 | final Color? inactiveItemColor;
30 |
31 | /// The padding between the item's boundary and its content.
32 | final EdgeInsetsGeometry? itemPadding;
33 |
34 | /// The minimum size of the item itself.
35 | final Size? itemMinimumSize;
36 |
37 | /// Configures the minimum size of the area within which the item may be pressed.
38 | ///
39 | /// If the [tapTargetSize] is larger than [minimumSize], the item will include
40 | /// a transparent margin that responds to taps.
41 | final MaterialTapTargetSize? itemTapTargetSize;
42 |
43 | /// The highlight color that's typically used to indicate that
44 | /// the item is focused, hovered, or pressed.
45 | final Color? overlayColor;
46 |
47 | /// The separator icon that is placed between the breadcrumb items.
48 | final IconData? separatorIcon;
49 |
50 | /// The size of the [separatorIcon].
51 | final double? separatorIconSize;
52 |
53 | /// The color of the [separatorIcon].
54 | final Color? separatorColor;
55 |
56 | /// The background fill color under the breadcrumbs.
57 | final Color? backgroundColor;
58 |
59 | /// The text style for the items of the breadcrumbs.
60 | final TextStyle? textStyle;
61 |
62 | /// Leading spacing before breadcrumbs.
63 | final double? leadingSpacing;
64 |
65 | /// Trailing spacing after breadcrumbs.
66 | final double? trailingSpacing;
67 |
68 | /// Creates a theme that can be used in [FilesystemPickerTopBarThemeData] and [Breadcrumbs].
69 | BreadcrumbsThemeData({
70 | this.itemColor,
71 | this.inactiveItemColor,
72 | this.itemPadding,
73 | this.itemMinimumSize,
74 | this.itemTapTargetSize,
75 | this.overlayColor,
76 | this.separatorIcon,
77 | this.separatorIconSize,
78 | this.separatorColor,
79 | this.backgroundColor,
80 | this.textStyle,
81 | this.leadingSpacing,
82 | this.trailingSpacing,
83 | });
84 |
85 | /// Returns the text color of the breadcrumbs item.
86 | ///
87 | /// If no value is set in the theme, the color of the [textTheme] button is returned
88 | /// (the app theme is taken from the `context`).
89 | Color getItemColor(BuildContext context, [Color? color]) {
90 | final effectiveItemColor = color ??
91 | itemColor ??
92 | Theme.of(context).textTheme.labelLarge?.color ??
93 | const Color(0xFF000000);
94 | return effectiveItemColor;
95 | }
96 |
97 | /// Returns the text color of the inactive breadcrumbs item.
98 | ///
99 | /// If no value is set in the theme, the color of the item is returned with opacity 0.75
100 | /// (the app theme is taken from the `context`).
101 | Color getInactiveItemColor(BuildContext context, [Color? color]) {
102 | return inactiveItemColor ??
103 | (color ?? getItemColor(context, color)).withOpacity(0.75);
104 | }
105 |
106 | /// Returns the color of the [separatorIcon].
107 | ///
108 | /// If no value is set in the theme, the color of the item is returned with opacity 0.45
109 | /// (the app theme is taken from the `context`).
110 | Color getSeparatorColor(BuildContext context, [Color? color]) {
111 | return separatorColor ??
112 | (color ?? getItemColor(context, color)).withOpacity(0.45);
113 | }
114 |
115 | /// Returns the minimum size of the area within which the item may be pressed.
116 | MaterialTapTargetSize getItemTapTargetSize(BuildContext context) {
117 | return itemTapTargetSize ?? defaultItemTapTargetSize;
118 | }
119 |
120 | /// Returns the highlight color that's typically used to indicate that
121 | /// the item is focused, hovered, or pressed.
122 | ///
123 | /// If no value is set in the theme, the color of the item is returned with opacity 0.12
124 | /// (the app theme is taken from the `context`).
125 | Color getOverlayColor(BuildContext context, [Color? color]) {
126 | return overlayColor ??
127 | (color ?? getItemColor(context, color)).withOpacity(0.12);
128 | }
129 |
130 | /// Returns the separator icon that is placed between the breadcrumb items.
131 | ///
132 | /// If no value is set in the theme, the [Icons.chevron_right] icon is returned.
133 | IconData getSeparatorIcon(BuildContext context) {
134 | return separatorIcon ?? Icons.chevron_right;
135 | }
136 |
137 | /// Returns the size of the [separatorIcon].
138 | double getSeparatorIconSize(BuildContext context) {
139 | return separatorIconSize ?? defaultSeparatorIconSize;
140 | }
141 |
142 | /// Returns the text style for the items of the breadcrumbs.
143 | ///
144 | /// If no value is set in the theme, the [toolbarTextStyle] of the [AppBarTheme] is returned
145 | /// (the app theme is taken from the `context`).
146 | TextStyle getTextStyle(BuildContext context) {
147 | return textStyle ??
148 | AppBarTheme.of(context).toolbarTextStyle ??
149 | const TextStyle();
150 | }
151 |
152 | /// Returns the leading spacing before breadcrumbs.
153 | double getLeadingSpacing(BuildContext context) {
154 | return leadingSpacing ?? defaultLeadingSpacing;
155 | }
156 |
157 | /// Returns the trailing spacing after breadcrumbs.
158 | double getTrailingSpacing(BuildContext context) {
159 | return trailingSpacing ?? defaultTrailingSpacing;
160 | }
161 |
162 | /// Returns a new breadcrumbs theme that matches this theme but with some values
163 | /// replaced by the non-null parameters of the given theme.
164 | ///
165 | /// If the given theme is null, simply returns this theme.
166 | BreadcrumbsThemeData merge(BreadcrumbsThemeData? base) {
167 | if (base == null) return this;
168 |
169 | return BreadcrumbsThemeData(
170 | itemColor: itemColor ?? base.itemColor,
171 | inactiveItemColor: inactiveItemColor ?? base.inactiveItemColor,
172 | itemPadding: itemPadding ?? base.itemPadding,
173 | itemMinimumSize: itemMinimumSize ?? base.itemMinimumSize,
174 | itemTapTargetSize: itemTapTargetSize ?? base.itemTapTargetSize,
175 | overlayColor: overlayColor ?? base.overlayColor,
176 | separatorIcon: separatorIcon ?? base.separatorIcon,
177 | separatorIconSize: separatorIconSize ?? base.separatorIconSize,
178 | separatorColor: separatorColor ?? base.separatorColor,
179 | backgroundColor: backgroundColor ?? base.backgroundColor,
180 | textStyle: textStyle?.merge(base.textStyle) ?? base.textStyle,
181 | leadingSpacing: leadingSpacing ?? base.leadingSpacing,
182 | trailingSpacing: trailingSpacing ?? base.trailingSpacing,
183 | );
184 | }
185 | }
186 |
--------------------------------------------------------------------------------
/package/lib/src/options/theme/_context_actions_button_theme.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/foundation.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | /// Defines the theme for the action button or the button that opens the popup menu
5 | /// if more than one action is specified.
6 | @immutable
7 | class FilesystemPickerContextActionsButtonThemeData with Diagnosticable {
8 | /// The theme for the button icon.
9 | final IconThemeData? iconTheme;
10 |
11 | /// Creates a theme for the action button or the button that opens the popup menu
12 | /// if more than one action is specified.
13 | const FilesystemPickerContextActionsButtonThemeData({
14 | this.iconTheme,
15 | });
16 |
17 | /// Returns the theme for the button icon.
18 | IconThemeData getIconTheme(BuildContext context) {
19 | final effectiveValue = IconThemeData(
20 | color: Theme.of(context).appBarTheme.foregroundColor ??
21 | Theme.of(context).primaryTextTheme.titleLarge?.color,
22 | ).merge(iconTheme);
23 | return effectiveValue;
24 | }
25 |
26 | /// Returns a new context action button theme that matches this theme but with some values
27 | /// replaced by the non-null parameters of the given theme.
28 | ///
29 | /// If the given theme is null, simply returns this theme.
30 | FilesystemPickerContextActionsButtonThemeData merge(
31 | FilesystemPickerContextActionsButtonThemeData? base) {
32 | if (base == null) return this;
33 |
34 | return FilesystemPickerContextActionsButtonThemeData(
35 | iconTheme: iconTheme?.merge(base.iconTheme) ?? base.iconTheme,
36 | );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/package/lib/src/options/theme/_context_actions_menu_theme.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/foundation.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | /// Defines the theme for the actions popup menu.
5 | @immutable
6 | class FilesystemPickerContextActionsMenuThemeData with Diagnosticable {
7 | /// The theme for the menu item icon.
8 | final IconThemeData? iconTheme;
9 |
10 | /// The text style for the menu item.
11 | final TextStyle? textStyle;
12 |
13 | /// The elevation of the popup menu.
14 | final double? elevation;
15 |
16 | /// The shape of the popup menu.
17 | final ShapeBorder? shape;
18 |
19 | /// The color of the popup menu icon and text.
20 | final Color? foregroundColor;
21 |
22 | /// The color of the background selection of the popup menu item.
23 | final Color? highlightBackgroundColor;
24 |
25 | /// The background color of the popup menu.
26 | final Color? backgroundColor;
27 |
28 | /// Creates a theme for the actions popup menu.
29 | const FilesystemPickerContextActionsMenuThemeData({
30 | this.iconTheme,
31 | this.textStyle,
32 | this.elevation,
33 | this.shape,
34 | this.foregroundColor,
35 | this.highlightBackgroundColor,
36 | this.backgroundColor,
37 | });
38 |
39 | Color? getForegroundColor(BuildContext context) {
40 | final effectiveColor = foregroundColor ??
41 | Theme.of(context).popupMenuTheme.textStyle?.color ??
42 | Theme.of(context).textTheme.bodyMedium?.color;
43 | return effectiveColor;
44 | }
45 |
46 | /// Returns the theme for the menu item icon.
47 | IconThemeData getIconTheme(BuildContext context) {
48 | final effectiveValue = const IconThemeData()
49 | .copyWith(color: getForegroundColor(context))
50 | .merge(iconTheme);
51 | return effectiveValue;
52 | }
53 |
54 | /// Returns the text style for the menu item.
55 | TextStyle getTextStyle(BuildContext context) {
56 | final effectiveValue = const TextStyle()
57 | .copyWith(color: getForegroundColor(context))
58 | .merge(textStyle);
59 | return effectiveValue;
60 | }
61 |
62 | /// Returns the elevation of the popup menu.
63 | double? getElevation(BuildContext context) {
64 | return elevation;
65 | }
66 |
67 | /// Returns the shape of the popup menu.
68 | ShapeBorder? getShape(BuildContext context) {
69 | return shape;
70 | }
71 |
72 | /// Returns the color of the background selection of the popup menu item.
73 | Color? getHighlightBackgroundColor(BuildContext context) {
74 | return highlightBackgroundColor;
75 | }
76 |
77 | /// Returns the background color of the popup menu.
78 | Color? getBackgroundColor(BuildContext context) {
79 | return backgroundColor;
80 | }
81 |
82 | /// Returns a new context actions menu theme that matches this theme but with some values
83 | /// replaced by the non-null parameters of the given theme.
84 | ///
85 | /// If the given theme is null, simply returns this theme.
86 | FilesystemPickerContextActionsMenuThemeData merge(
87 | FilesystemPickerContextActionsMenuThemeData? base) {
88 | if (base == null) return this;
89 |
90 | return FilesystemPickerContextActionsMenuThemeData(
91 | iconTheme: iconTheme?.merge(base.iconTheme) ?? base.iconTheme,
92 | textStyle: textStyle?.merge(base.textStyle) ?? base.textStyle,
93 | elevation: elevation ?? base.elevation,
94 | shape: shape ?? base.shape,
95 | foregroundColor: foregroundColor ?? base.foregroundColor,
96 | highlightBackgroundColor:
97 | highlightBackgroundColor ?? base.highlightBackgroundColor,
98 | backgroundColor: backgroundColor ?? base.backgroundColor,
99 | );
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/package/lib/src/options/theme/_context_actions_theme.dart:
--------------------------------------------------------------------------------
1 | import 'package:filesystem_picker/src/options/theme/_context_actions_button_theme.dart';
2 | import 'package:flutter/foundation.dart';
3 | import 'package:flutter/material.dart';
4 |
5 | import '_context_actions_menu_theme.dart';
6 |
7 | /// Defines the theme for the button and the menu of contextual actions
8 | /// called from the upper-right corner of the picker.
9 | @immutable
10 | class FilesystemPickerContextActionsThemeData with Diagnosticable {
11 | /// Sets the theme for the popup menu with a list of actions if more than one action is specified.
12 | final FilesystemPickerContextActionsMenuThemeData? menuTheme;
13 |
14 | /// Sets the theme for the action button or the button that opens the popup menu
15 | /// if more than one action is specified.
16 | final FilesystemPickerContextActionsButtonThemeData? buttonTheme;
17 |
18 | /// Creates a theme that can be used to customize the contextual actions button and popup menu.
19 | const FilesystemPickerContextActionsThemeData({
20 | this.menuTheme,
21 | this.buttonTheme,
22 | });
23 |
24 | /// Returns the theme for the popup menu with a list of actions if more than one action is specified.
25 | FilesystemPickerContextActionsMenuThemeData getMenuTheme(
26 | BuildContext context) {
27 | return menuTheme ?? const FilesystemPickerContextActionsMenuThemeData();
28 | }
29 |
30 | /// Returns the theme for the action button or the button that opens the popup menu
31 | /// if more than one action is specified.
32 | FilesystemPickerContextActionsButtonThemeData getButtonTheme(
33 | BuildContext context) {
34 | return buttonTheme ?? const FilesystemPickerContextActionsButtonThemeData();
35 | }
36 |
37 | /// Returns a new context actions theme that matches this theme but with some values
38 | /// replaced by the non-null parameters of the given theme.
39 | ///
40 | /// If the given theme is null, simply returns this theme.
41 | FilesystemPickerContextActionsThemeData merge(
42 | FilesystemPickerContextActionsThemeData? base) {
43 | if (base == null) return this;
44 |
45 | return FilesystemPickerContextActionsThemeData(
46 | menuTheme: menuTheme?.merge(base.menuTheme) ?? base.menuTheme,
47 | buttonTheme: buttonTheme?.merge(base.buttonTheme) ?? base.buttonTheme,
48 | );
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/package/lib/src/options/theme/theme_auto_system.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/foundation.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | import 'theme.dart';
5 |
6 | /// Defines a theme for the `FilesystemPicker`, which adapts to the light or dark
7 | /// theme of the application.
8 | @immutable
9 | class FilesystemPickerAutoSystemTheme
10 | with Diagnosticable
11 | implements FilesystemPickerThemeBase {
12 | static const bool _kDefaultInherit = true;
13 |
14 | /// Create an adaptive theme that can be used to customize the `FilesystemPicker` presentation
15 | const FilesystemPickerAutoSystemTheme({
16 | this.inherit = _kDefaultInherit,
17 | this.lightTheme,
18 | this.darkTheme,
19 | });
20 |
21 | /// Whether to use unspecified values from `FilesystemPickerDefaultOptions`.
22 | final bool inherit;
23 |
24 | /// Specifies the light theme for the `FilesystemPicker`.
25 | final FilesystemPickerTheme? lightTheme;
26 |
27 | /// Specifies the dark theme for the `FilesystemPicker`.
28 | final FilesystemPickerTheme? darkTheme;
29 |
30 | @protected
31 | Brightness getBrightness(BuildContext context) {
32 | return Theme.of(context).brightness;
33 | }
34 |
35 | @protected
36 | FilesystemPickerThemeBase getEffectiveTheme(BuildContext context) {
37 | final brightness = getBrightness(context);
38 |
39 | final FilesystemPickerThemeBase effectiveTheme =
40 | (brightness == Brightness.light)
41 | ? (lightTheme ?? const FilesystemPickerTheme())
42 | : (darkTheme ?? const FilesystemPickerTheme());
43 |
44 | return effectiveTheme;
45 | }
46 |
47 | /// See [FilesystemPickerTheme.getBackgroundColor].
48 | @override
49 | Color getBackgroundColor(BuildContext context, [Color? color]) {
50 | return getEffectiveTheme(context).getBackgroundColor(context, color);
51 | }
52 |
53 | /// See [FilesystemPickerTheme.getTopBar].
54 | @override
55 | FilesystemPickerTopBarThemeData getTopBar(BuildContext context) {
56 | return getEffectiveTheme(context).getTopBar(context);
57 | }
58 |
59 | /// See [FilesystemPickerTheme.getMessageTextStyle].
60 | @override
61 | TextStyle getMessageTextStyle(BuildContext context) {
62 | return getEffectiveTheme(context).getMessageTextStyle(context);
63 | }
64 |
65 | /// See [FilesystemPickerTheme.getFileList].
66 | @override
67 | FilesystemPickerFileListThemeData getFileList(BuildContext context) {
68 | return getEffectiveTheme(context).getFileList(context);
69 | }
70 |
71 | /// See [FilesystemPickerTheme.getPickerAction].
72 | @override
73 | FilesystemPickerActionThemeData getPickerAction(BuildContext context) {
74 | return getEffectiveTheme(context).getPickerAction(context);
75 | }
76 |
77 | @override
78 | FilesystemPickerContextActionsThemeData getContextActions(
79 | BuildContext context) {
80 | return getEffectiveTheme(context).getContextActions(context);
81 | }
82 |
83 | /// See [FilesystemPickerTheme.merge].
84 | @override
85 | FilesystemPickerThemeBase merge(
86 | BuildContext context, FilesystemPickerThemeBase? base) {
87 | if (inherit && base is FilesystemPickerAutoSystemTheme) {
88 | return FilesystemPickerAutoSystemTheme(
89 | lightTheme: (lightTheme?.merge(context, base.lightTheme)
90 | as FilesystemPickerTheme?) ??
91 | base.lightTheme,
92 | darkTheme: (darkTheme?.merge(context, base.darkTheme)
93 | as FilesystemPickerTheme?) ??
94 | base.darkTheme,
95 | );
96 | }
97 |
98 | return this;
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/package/lib/src/options/theme/theme_base.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/foundation.dart';
2 | import 'package:flutter/widgets.dart';
3 |
4 | import '_context_actions_theme.dart';
5 | import '_filelist_theme.dart';
6 | import '_picker_action_theme.dart';
7 | import '_topbar_theme.dart';
8 |
9 | /// An abstract base class for defining the picker theme interface.
10 | abstract class FilesystemPickerThemeBase with Diagnosticable {
11 | /// Returns the background color of the picker.
12 | Color getBackgroundColor(BuildContext context, [Color? color]);
13 |
14 | /// Returns the theme for the Picker's `AppBar`.
15 | FilesystemPickerTopBarThemeData getTopBar(BuildContext context);
16 |
17 | /// Returns the text style for messages in the center of the picker.
18 | TextStyle getMessageTextStyle(BuildContext context);
19 |
20 | /// Returns the theme for the FilesystemList widget used in the picker.
21 | FilesystemPickerFileListThemeData getFileList(BuildContext context);
22 |
23 | /// Returns the theme for the picker action.
24 | FilesystemPickerActionThemeData getPickerAction(BuildContext context);
25 |
26 | FilesystemPickerContextActionsThemeData getContextActions(
27 | BuildContext context);
28 |
29 | /// Returns a new picker theme that matches this picker theme but with some values
30 | /// replaced by the non-null parameters of the given picker theme.
31 | ///
32 | /// If the given picker theme is null, simply returns this picker theme.
33 | FilesystemPickerThemeBase merge(
34 | BuildContext context, FilesystemPickerThemeBase? base);
35 | }
36 |
--------------------------------------------------------------------------------
/package/lib/src/picker_dialog.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import 'options/picker_options.dart';
4 |
5 | class FilesystemPickerDialog extends StatelessWidget {
6 | final Widget child;
7 | final BoxConstraints? constraints;
8 |
9 | const FilesystemPickerDialog({
10 | Key? key,
11 | required this.child,
12 | this.constraints,
13 | }) : super(key: key);
14 |
15 | @override
16 | Widget build(BuildContext context) {
17 | final options = FilesystemPickerDefaultOptions.of(context);
18 |
19 | return Dialog(
20 | clipBehavior: Clip.antiAliasWithSaveLayer,
21 | child: ConstrainedBox(
22 | constraints: constraints ?? options.dialog.constraints,
23 | child: child,
24 | ),
25 | );
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/package/lib/src/progress_indicator.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'package:flutter/material.dart';
3 | import 'options/theme/_filelist_theme.dart';
4 |
5 | class FilesystemProgressIndicator extends StatefulWidget {
6 | final FilesystemPickerFileListThemeData? theme;
7 |
8 | const FilesystemProgressIndicator({
9 | Key? key,
10 | this.theme,
11 | }) : super(key: key);
12 |
13 | @override
14 | State createState() =>
15 | _FilesystemProgressIndicatorState();
16 | }
17 |
18 | class _FilesystemProgressIndicatorState
19 | extends State {
20 | static const double _defaultSize = 32;
21 | static const double _defaultPadding = 8;
22 | static const Duration _delay = Duration(milliseconds: 100);
23 |
24 | Timer? _timer;
25 | bool _visible = false;
26 |
27 | void _start() {
28 | _timer = Timer(_delay, () {
29 | if (mounted) {
30 | setState(() {
31 | _visible = true;
32 | });
33 | }
34 | });
35 | }
36 |
37 | @override
38 | void initState() {
39 | super.initState();
40 |
41 | _start();
42 | }
43 |
44 | @override
45 | void dispose() {
46 | _timer?.cancel();
47 | super.dispose();
48 | }
49 |
50 | @override
51 | Widget build(BuildContext context) {
52 | final effectiveTheme = widget.theme ?? FilesystemPickerFileListThemeData();
53 |
54 | return _visible
55 | ? Padding(
56 | padding: const EdgeInsets.all(_defaultPadding),
57 | child: Center(
58 | child: SizedBox(
59 | width: _defaultSize,
60 | height: _defaultSize,
61 | child: CircularProgressIndicator(
62 | color: effectiveTheme.getProgressIndicatorColor(context),
63 | ),
64 | ),
65 | ),
66 | )
67 | : const SizedBox(
68 | width: _defaultSize + _defaultPadding,
69 | height: _defaultSize + _defaultPadding,
70 | );
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/package/lib/src/shortcuts/shortcut.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 | import 'package:filesystem_picker/src/utils.dart';
3 | import 'package:flutter/foundation.dart';
4 | import 'package:flutter/widgets.dart';
5 |
6 | /// Shortcut - a specific path of the file system, it can be the root of a disk,
7 | /// a user folder, a folder with a photo, etc.
8 | ///
9 | /// You can set a name for it to be displayed in the FilesystemPicker,
10 | /// as well as specify whether it can be selected in the picker.
11 | class FilesystemPickerShortcut with Diagnosticable {
12 | /// The name of the shortcut displayed in the picker.
13 | final String name;
14 |
15 | /// Shortcut icon, if not specified, the icon from the theme will be displayed.
16 | final IconData? icon;
17 |
18 | /// File system path.
19 | final Directory path;
20 |
21 | /// Specify whether this shortcut can be selected as the resulting path in the picker.
22 | final bool isSelectable;
23 |
24 | /// Creates a shortcut.
25 | FilesystemPickerShortcut({
26 | required this.name,
27 | this.icon,
28 | required Directory path,
29 | this.isSelectable = true,
30 | }) : path = normalizeRootPath(path);
31 |
32 | @override
33 | void debugFillProperties(DiagnosticPropertiesBuilder properties) {
34 | super.debugFillProperties(properties);
35 | properties.add(StringProperty('name', name));
36 | properties.add(DiagnosticsProperty('icon', icon));
37 | properties.add(DiagnosticsProperty('path', path));
38 | properties.add(DiagnosticsProperty('isSelectable', isSelectable));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/package/lib/src/shortcuts/shortcuts_list_tile.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import '../common.dart';
3 | import '../options/theme/_filelist_theme.dart';
4 | import 'shortcut.dart';
5 |
6 | /// A single row displaying a file system shortcut, the corresponding icon and the trailing
7 | /// selection button.
8 | ///
9 | /// Used in conjunction with the `FilesystemShortcutsListView` widget.
10 | class FilesystemShortcutListTile extends StatelessWidget {
11 | final FilesystemPickerShortcut shortcut;
12 | final ValueChanged onChange;
13 | final ValueChanged onSelect;
14 | final FilesystemPickerFileListThemeData? theme;
15 | final FilesystemType fsType;
16 |
17 | const FilesystemShortcutListTile({
18 | super.key,
19 | required this.shortcut,
20 | required this.onChange,
21 | required this.onSelect,
22 | required this.fsType,
23 | this.theme,
24 | });
25 |
26 | Widget _leading(
27 | BuildContext context, FilesystemPickerFileListThemeData theme) {
28 | return Icon(
29 | shortcut.icon ?? theme.getShortcutIcon(context),
30 | color: theme.getShortcutIconColor(context),
31 | size: theme.getIconSize(context),
32 | );
33 | }
34 |
35 | Widget? _trailing(
36 | BuildContext context, FilesystemPickerFileListThemeData theme) {
37 | if (fsType != FilesystemType.file && shortcut.isSelectable) {
38 | final iconTheme = theme.getCheckIconTheme(context);
39 | return InkResponse(
40 | child: Icon(
41 | theme.getCheckIcon(context),
42 | color: iconTheme.color,
43 | size: iconTheme.size,
44 | ),
45 | onTap: () => onSelect(shortcut),
46 | );
47 | } else {
48 | return null;
49 | }
50 | }
51 |
52 | @override
53 | Widget build(BuildContext context) {
54 | final effectiveTheme = theme ?? FilesystemPickerFileListThemeData();
55 | final style = effectiveTheme.getShortcutTextStyle(context);
56 |
57 | return ListTile(
58 | key: Key(shortcut.path.path),
59 | leading: _leading(context, effectiveTheme),
60 | trailing: _trailing(context, effectiveTheme),
61 | title: Text(shortcut.name,
62 | style: style,
63 | textScaleFactor: effectiveTheme.getTextScaleFactor(context, false)),
64 | onTap: () => onChange(shortcut),
65 | );
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/package/lib/src/shortcuts/shortcuts_listview.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import '../common.dart';
3 | import 'shortcut.dart';
4 | import 'shortcuts_list_tile.dart';
5 | import '../options/theme/_filelist_theme.dart';
6 |
7 | /// A widget that displays a list of file system shortcuts.
8 | class FilesystemShortcutsListView extends StatelessWidget {
9 | final List shortcuts;
10 | final ScrollController? scrollController;
11 | final FilesystemPickerFileListThemeData? theme;
12 | final FilesystemType fsType;
13 | final ValueChanged onChange;
14 | final ValueChanged onSelect;
15 |
16 | const FilesystemShortcutsListView({
17 | super.key,
18 | required this.shortcuts,
19 | this.scrollController,
20 | this.theme,
21 | required this.fsType,
22 | required this.onChange,
23 | required this.onSelect,
24 | });
25 |
26 | @override
27 | Widget build(BuildContext context) {
28 | final effectiveTheme = theme ?? FilesystemPickerFileListThemeData();
29 |
30 | return ListView.builder(
31 | controller: scrollController,
32 | shrinkWrap: true,
33 | itemCount: shortcuts.length,
34 | itemBuilder: (context, index) => FilesystemShortcutListTile(
35 | shortcut: shortcuts[index],
36 | theme: effectiveTheme,
37 | fsType: fsType,
38 | onChange: onChange,
39 | onSelect: onSelect,
40 | ),
41 | );
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/package/lib/src/utils.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | /// Normalizes root paths, making them valid for path navigation
4 | Directory normalizeRootPath(Directory path) {
5 | // Add a trailing path separator to the root of a drive in Windows
6 | if (Platform.isWindows &&
7 | (path.path.length == 2) &&
8 | (path.path.substring(1, 2) == ':')) {
9 | return Directory(path.path + Platform.pathSeparator);
10 | } else {
11 | return path;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/package/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | async:
5 | dependency: transitive
6 | description:
7 | name: async
8 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
9 | url: "https://pub.dev"
10 | source: hosted
11 | version: "2.11.0"
12 | boolean_selector:
13 | dependency: transitive
14 | description:
15 | name: boolean_selector
16 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
17 | url: "https://pub.dev"
18 | source: hosted
19 | version: "2.1.1"
20 | characters:
21 | dependency: transitive
22 | description:
23 | name: characters
24 | sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
25 | url: "https://pub.dev"
26 | source: hosted
27 | version: "1.3.0"
28 | clock:
29 | dependency: transitive
30 | description:
31 | name: clock
32 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
33 | url: "https://pub.dev"
34 | source: hosted
35 | version: "1.1.1"
36 | collection:
37 | dependency: transitive
38 | description:
39 | name: collection
40 | sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
41 | url: "https://pub.dev"
42 | source: hosted
43 | version: "1.17.2"
44 | fake_async:
45 | dependency: transitive
46 | description:
47 | name: fake_async
48 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
49 | url: "https://pub.dev"
50 | source: hosted
51 | version: "1.3.1"
52 | flutter:
53 | dependency: "direct main"
54 | description: flutter
55 | source: sdk
56 | version: "0.0.0"
57 | flutter_lints:
58 | dependency: "direct dev"
59 | description:
60 | name: flutter_lints
61 | sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04
62 | url: "https://pub.dev"
63 | source: hosted
64 | version: "2.0.3"
65 | flutter_test:
66 | dependency: "direct dev"
67 | description: flutter
68 | source: sdk
69 | version: "0.0.0"
70 | lints:
71 | dependency: transitive
72 | description:
73 | name: lints
74 | sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
75 | url: "https://pub.dev"
76 | source: hosted
77 | version: "2.1.1"
78 | matcher:
79 | dependency: transitive
80 | description:
81 | name: matcher
82 | sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
83 | url: "https://pub.dev"
84 | source: hosted
85 | version: "0.12.16"
86 | material_color_utilities:
87 | dependency: transitive
88 | description:
89 | name: material_color_utilities
90 | sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
91 | url: "https://pub.dev"
92 | source: hosted
93 | version: "0.5.0"
94 | meta:
95 | dependency: transitive
96 | description:
97 | name: meta
98 | sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
99 | url: "https://pub.dev"
100 | source: hosted
101 | version: "1.9.1"
102 | path:
103 | dependency: "direct main"
104 | description:
105 | name: path
106 | sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
107 | url: "https://pub.dev"
108 | source: hosted
109 | version: "1.8.3"
110 | sky_engine:
111 | dependency: transitive
112 | description: flutter
113 | source: sdk
114 | version: "0.0.99"
115 | source_span:
116 | dependency: transitive
117 | description:
118 | name: source_span
119 | sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
120 | url: "https://pub.dev"
121 | source: hosted
122 | version: "1.10.0"
123 | stack_trace:
124 | dependency: transitive
125 | description:
126 | name: stack_trace
127 | sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
128 | url: "https://pub.dev"
129 | source: hosted
130 | version: "1.11.0"
131 | stream_channel:
132 | dependency: transitive
133 | description:
134 | name: stream_channel
135 | sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
136 | url: "https://pub.dev"
137 | source: hosted
138 | version: "2.1.1"
139 | string_scanner:
140 | dependency: transitive
141 | description:
142 | name: string_scanner
143 | sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
144 | url: "https://pub.dev"
145 | source: hosted
146 | version: "1.2.0"
147 | term_glyph:
148 | dependency: transitive
149 | description:
150 | name: term_glyph
151 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
152 | url: "https://pub.dev"
153 | source: hosted
154 | version: "1.2.1"
155 | test_api:
156 | dependency: transitive
157 | description:
158 | name: test_api
159 | sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
160 | url: "https://pub.dev"
161 | source: hosted
162 | version: "0.6.0"
163 | vector_math:
164 | dependency: transitive
165 | description:
166 | name: vector_math
167 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
168 | url: "https://pub.dev"
169 | source: hosted
170 | version: "2.1.4"
171 | web:
172 | dependency: transitive
173 | description:
174 | name: web
175 | sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
176 | url: "https://pub.dev"
177 | source: hosted
178 | version: "0.1.4-beta"
179 | sdks:
180 | dart: ">=3.1.0-185.0.dev <4.0.0"
181 | flutter: ">=3.0.0"
182 |
--------------------------------------------------------------------------------
/package/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: filesystem_picker
2 | description: FileSystem file or folder picker dialog. Allows the user to browse the file system and pick a folder or file.
3 | version: 4.1.0
4 | author: Andy Chentsov
5 | homepage: https://github.com/andyduke/filesystem_picker/tree/master/package
6 | repository: https://github.com/andyduke/filesystem_picker
7 | issue_tracker: https://github.com/andyduke/filesystem_picker/issues
8 |
9 | screenshots:
10 | - description: "Types of pickers: full screen, dialog, bottom sheet"
11 | path: screenshots/types_of_picker.png
12 | - description: Picker customization
13 | path: screenshots/picker_customization.png
14 |
15 | topics:
16 | - picker
17 | - files
18 | - file-selection
19 | - file-selector
20 | - ui
21 |
22 | environment:
23 | flutter: ">=3.0.0"
24 | sdk: '>=2.17.0 <4.0.0'
25 |
26 | dependencies:
27 | flutter:
28 | sdk: flutter
29 | path: ^1.8.0
30 |
31 | dev_dependencies:
32 | flutter_test:
33 | sdk: flutter
34 | flutter_lints: ^2.0.0
35 |
36 | flutter:
37 |
--------------------------------------------------------------------------------
/package/screenshots/picker_customization.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/screenshots/picker_customization.png
--------------------------------------------------------------------------------
/package/screenshots/types_of_picker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/package/screenshots/types_of_picker.png
--------------------------------------------------------------------------------
/screenshots/context_actions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/screenshots/context_actions.png
--------------------------------------------------------------------------------
/screenshots/file_pick.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/screenshots/file_pick.png
--------------------------------------------------------------------------------
/screenshots/folder_pick.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/screenshots/folder_pick.png
--------------------------------------------------------------------------------
/screenshots/picker_customization.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/screenshots/picker_customization.png
--------------------------------------------------------------------------------
/screenshots/shortcuts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/screenshots/shortcuts.png
--------------------------------------------------------------------------------
/screenshots/types_of_picker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyduke/filesystem_picker/1ff57910de42ca083e0c4572ae6ab04fbde09fc6/screenshots/types_of_picker.png
--------------------------------------------------------------------------------