文章

Jetpack Compose 实现 BottomSheetDialog

引入 Compose 其实是提供了 BottomSheet 的实现方式的,就是用官方的 BottomSheetScaffold ,但是却没有实现 BottomSheetDialog ,导致想要像 Dialog 那样使用 BottomSheetDialog 难以实现,每次都要在外面套一层 BottomSheetScaffold 大大加重了心智负担与嵌套复杂性。因此我将官方的 BottomSheet 实现直接全部 Copy 出来了一份稍作修改,实现独立的 BottomSheetDialog。

8 分钟阅读

macOS Ventura 安装 sshfs

今天在调试 Atri 错把过滤器当处理函数的惨痛教训 的时候为了方便快速将构建出来的插件安装,于是灵机一动想到了 sshfs,但是 sshfs 在 macOS 安装还是有点小坑,特此记录一下 不要使用 Homebrew 安装 sshfs 安装 OSXFUSE 在 macOS 上安装 sshfs 首先需要安装 osxfuse ,但是 osxfuse 使用 brew install oxsfuse 会出现报错提示版本不兼容

2 分钟阅读

Jetpack Compose 中ComposeView 绑定到Dialog中遇到的问题

在Compose 1.2.0-alpha08 以前,可以使用以下代码 Kotlin复制val dialog = Dialog(context) dialog.window?.decorView?.apply { ViewTreeLifecycleOwner.set(this, this@MainActivity) ViewTreeViewModelStoreOwner.set(this, this@MainActivity) ViewTreeSavedStateRegistryOwner.set(this, this@MainActivity) } 在Compose 1.2.0-alpha08以后,ViewTreeSavedStateRegistryOwner的API发生了变更 Kotlin复制val dialog = BottomSheetDialog(this@MainActivity) dialog.window?.decorView?.apply { ViewTreeLifecycleOwner.set(this, this@MainActivity) ViewTreeViewModelStoreOwner.set(this, this@MainActivity) setViewTreeSavedStateRegistryOwner(this@MainActivity) } 参考内容 更新日志: Update ViewTreeSavedStateRegistryOwner use in Compose UI

1 分钟阅读