admin管理员组文章数量:1305092
I have a kotlin multiplatform app, where I use isSystemInDarkTheme() to determine if the system has dark mode set. However, for the generated webapp, isSystemInDarkTheme() always returns false. I tested this on Firefox and Chromium.
Is this a bug? Do I need to use another function for web?
I have a kotlin multiplatform app, where I use isSystemInDarkTheme() to determine if the system has dark mode set. However, for the generated webapp, isSystemInDarkTheme() always returns false. I tested this on Firefox and Chromium.
Is this a bug? Do I need to use another function for web?
Share Improve this question edited Feb 4 at 10:05 VLAZ 29.1k9 gold badges63 silver badges84 bronze badges asked Feb 4 at 9:55 Julian EgnerJulian Egner 2814 silver badges9 bronze badges 2- similar issue youtrack.jetbrains/issue/CMP-5871 – lisonge Commented Feb 4 at 16:23
- @lisonge No, thats not the same issue. In the page linked by you, it is said that "isSystemInDarkTheme returns the correct value in desktop mac apps. However, changing the system theme does not trigger recomposition." My problem is that in web, the isSystemInDarkTheme() function always returns false and NEVER the correct value. It has nothing to to with updating the value like the iOS Problem you stated and also other findings. – Julian Egner Commented Feb 5 at 8:00
1 Answer
Reset to default 0I upgraded to the latest kotlin version (2.1) and now isSystemInDarkTheme() works as expected.
My way to upgrading was generating a new kotlin multiplatform app (https://kmp.jetbrains/) and then putting the relevant import statements into my project.
本文标签: kotlinisSystemInDarkTheme() always returns false on webStack Overflow
版权声明:本文标题:kotlin - isSystemInDarkTheme() always returns false on web - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741775678a2397010.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论