There are also other option properties, including a Modifier and a TwoPane(įoldAwareConfiguration: FoldAwareConfiguration = FoldAwareConfiguration.AllFolds To use the TwoPane component in your Compose apps, you need to pass Composable content to the first and second slots, as well as specify a TwoPaneStrategy and a list of displayFeatures. Note that the latest version depends on Compose 1.3.0-beta02, so you’ll have to make sure all your dependencies are up to date! Implementation ":accompanist-adaptive:0.26.3-beta" You can import the latest version of the Adaptive library in your project: If you instead only want to place one or the other, that should be controlled at a higher level and not calling TwoPane if placing both is not desired.” “The TwoPane layout will always place both first and second, based on the provided strategy and window environment. As mentioned in the TwoPane API documentation: The TwoPane component from the Adaptive Accompanist library helps you place exactly two groups of content on the screen and it uses Jetpack Window Manager to provide foldable support.įor those of you who are familiar with our Microsoft TwoPaneLayout component, you may notice that the main difference here is that TwoPane always shows these two groups of content, whereas with TwoPaneLayout, you show only one group of content at a time when no fold is present. In this blog post, we’ll focus on Adaptive, the last library, but if you want to learn more about the others, you can check out these FAQS or this library review. Right now, Accompanist offers the following libraries: Picture of the Accompanist overview page. These libraries are considered to be more experimental, which is why they’re not yet part of AndroidX, but according to Google, the eventual goal is to “upstream them into the official toolkit, at which point they will be deprecated and removed from Accompanist”.įigure 1. If you’re unfamiliar with Accompanist, it’s a group of support/utility libraries built for Jetpack Compose. Not to be confused with our own Microsoft Compose SDK TwoPaneLayout component, TwoPane from Accompanist is a fold-aware UI component that works great for cases when you always want to show two pieces of content. This week, we’d like to talk about the TwoPane layout from Google’s Accompanist Adaptive library!
0 Comments
Leave a Reply. |