

GitHub - Wavesonics/compose-multiplatform-file-picker: A multiplatform compose w...
source link: https://github.com/Wavesonics/compose-multiplatform-file-picker
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Compose Multiplatform File Picker
A multiplatform compose widget for picking files with each platform's Native File Picker Dialog.
Currently supports: Desktop and Android.
Desktop/JVM Implementation
The native desktop dialog implementation is derived from the Pacmc project
See FileChooser.kt
as well as the lwjgl
gradle filter.
Include in your project:
implementation("com.darkrockstudios:mpfilepicker:1.0.0")
How to use
In your shared jetbrains compose multiplatform code, add one of the following.
To show the dialog, simply set the boolean state to true via a button or what ever you want.
Pick a file with a filter:
var showFilePicker by remember { mutableStateOf(false) }
val fileType = "jpg"
FilePicker(showFilePicker, fileExtension = fileType) { path ->
showFilePicker = false
// do something with path
}
Pick a directory:
var showDirPicker by remember { mutableStateOf(false) }
DirectoryPicker(showDirPicker) { path ->
showDirPicker = false
// do something with path
}
On each supported platform, it will update the platform native file picker dialog. On desktop it will fall back to the Swing file picker if the native one can't be use for some reason.
Windows
Android
Known Bugs
- Setting the initial directory doesn't seem to effect Android's file picker at all, not sure why that is yet.
Recommend
-
6
News Compose Multiplatform goes Alpha, unifying Desktop, Web, and Android UIs
-
8
News Compose Multiplatform Goes Beta: Stabilized APIs, Compatibility with Google’s Compose Artifacts, and More ...
-
4
JetBrains Compose Multiplatform Reaches Beta Oct 31, 2021 2...
-
9
News Compose Multiplatform 1.0 is going live!
-
5
跨平台开发框架Compose Multiplatform 1.0发布-InfoQ
-
10
How to use Kotlin Multiplatform ViewModel in SwiftUI and Jetpack ComposeWe at IceRock Development have been using the MVVM approach for man...
-
7
Creating an MVI architecture in Compose Multiplatform30 May, 2022Recently I've gotten very interested in Jetpack Compose. I mistakenly thought it was just a way of declaratively building a UI and having it automatically...
-
6
Improving shared architecture for a Kotlin Multiplatform, Jetpack Compose and SwiftUI app26 June 2022 · 8 minA couple of years ago I started working on a pet project to manage personal finances, named
-
8
How to build a time picker with Jetpack Compose In this article I’ll show you how to build a 24h time picker dialog using Jetpack Compose.
-
10
Compose Look And Feel
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK