jetc.dev Newsletter Issue #234
Published: 2024-10-01
This week, we look at lazy grids, focus management, autocomplete, and expandable
ContextualFlowRow()
implementations. Plus, we peek at a Compose Multiplatform
camera library and learn about Compose Multiplatform accessibility.
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
What Is it
?
Making sense of Compose also sometimes requires you to make sense of Kotlin. This
is particularly true when we use generic types with composables (e.g., fun <T> MyComposable(...)
),
then pair those with producer function types as parameters to that composable
(e.g., color: (T) -> Unit
). It is easy to lose track, see an { it.color }
lambda
being passed into a composable, and wondering what it
is. See a concrete example
in this week’s highlighted Stack Overflow question.
When Should We Use @NonRestartableComposable
?
There are a lot of micro optimizations available to us in Compose. Adding
@NonRestartableComposable
to a composable can save a bit of generated code. However,
where should we use it? In particular, does it make sense for root composables
(e.g., screens)? Learn more in this week’s highlighted Kotlinlang #compose
Slack
thread.
Composable Commentary
Posts, videos, and other new information related to Jetpack Compose!
Video: Lazy grids
Google’s Simona Milanovic demonstrates how grids can be a better choice for adaptive layouts than other types of containers, plus how to implement them in Compose.
Nailing Focus in Jetpack Compose: A Technology Expert‘s Guide
Google’s Shane Barker walks us through Compose’s focus APIs, such as FocusRequester
and the focusOrder()
modifier, using focusTarget()
to help guide Compose as to
which of your composable widgets should participate in focus, onFocusChanged()
,
and more!
Video: Unpacking Compose Multiplatform Accessibility
There has been a fair amount of material published on accessibility in Compose, but mostly it has been centered around classic Compose for Android. In this GDG Seattle presentation, Colin Marsch (@colinmarsch@androiddev.social) explores what accessibility options presently work for Compose Multiplatform, particularly how Compose accessibility structures get mapped to iOS’s accessibility APIs. Colin’s slides are available here.
Medium: Building a Custom AutoComplete Component with Jetpack Compose Using BasicTextField & LazyColumn
Ramadan Sayed walks us through building an autocomplete-style field using Compose
Foundation widgets like BasicTextField()
and LazyColumn()
.
Medium: Expandable FlowRow with Indicator
Stefano Natali returns, this time adding expand/collapse mechanics to a ContextualFlowRow()
,
so it can show more or fewer items based upon user interaction.
Medium: Optimized Image Loading for Compose and Kotlin Multiplatform
Jaewoong Eum (@skydoves@androiddev.social) is back, this time looking at Landscapist, a long-time image loading library for Compose, now with Compose Multiplatform support.
Custom Sliders in Jetpack Compose
sinasamaki (@sinasamaki@androiddev.social) explores the Compose Material3 Slider()
composable, including its options
for custom thumbs and tracks, animated effects on value changes, and more.
How to Ripple Outside of Compose Material
I wanted to use the Compose Material implementation of the ripple for touch feedback…
in a non-Material design system. In this post, I show how to use material-ripple
in other design systems, mostly by cloning and tweaking some Compose Material3 glue code.
Other Interesting Links
- First steps using material3 in a WearOS Android App
- Medium: Animation and Masking in Jetpack Compose with the grahpicsLayer() and Drawing Modifiers
- Medium: Building a Custom Animated Expandable/Collapsed List Component with Jetpack Compose Using LazyColumn
- Medium: Building Better UIs with Jetpack Compose: Best Practices and Techniques
- Medium: Building UIs for Wear OS with Jetpack Compose
- Medium: Carousel Jetpack Compose with Material 3
- Medium: Differences Between
collectAsState()
andcollectAsStateWithLifecycle()
in Jetpack Compose - Medium: Drawing a custom speedometer on compose canvas in android
- Medium: Flickering Effect Due to Unnecessary Recomposition
- Medium: Google Maps in Compose Multiplatform
- Medium: How to Implement an Upload Photo Button with Camera and Gallery Access in Jetpack Compose
- Medium: How to Integrate Google Maps in Jetpack Compose with Ola Maps API
- Medium: Mastering Material3 Colors in Jetpack Compose
- Medium: Mastering State Management in Jetpack Compose
- Medium: No Dry Dates Here! A Guide to DatePickers in Jetpack Compose
- Medium: Paint the Stars — Drawing with Compose and Canvas
- Medium: Share TopAppBar Across Screens with Dynamic Content and Actions — Jetpack Compose and Compose Multiplatform
- Medium: Understanding Flow Row/Column vs. Contextual Flow Row/Column in Jetpack Compose
- Medium: Visualizing updated data in MVVM with JetpackCompose
- Our journey with compose animations
- Understanding Jetpack Compose
- Video: How easy is it to draw on GoogleMaps using Compose?
Resource Roundup
100% pure code!
GitHub: Kashif-E / CameraK
Kashif Mehmood is working on adding camera support to Compose Multiplatform, starting with Android and iOS. The current implementation supports preview and image capture.
GitHub: eygraber / compose-permissionx
Eliezer Graber has a library that simplifies requesting runtime permissions, designed to address a few issues with Accompanist’s permission library.
GitHub: eygraber / vice
Eliezer Graber also has an MVI framework for Compose Multiplatform, including a Compose-centric API for providing source data for states.
Composables Core: Scroll Area
Alex Styl has added scrolling to Composables Core, including a ScrollArea()
and VerticalScrollbar()
/HorizontalScrollbar()
composables. These are able to
be styled to match your custom design system, from simple rendering to when and how the
scrollbar thumb gets hidden.
Other Interesting Links
- Gist: Sypers / ComposeScrollbar.kt (short
verticalScrollbar()
modifier) - GitHub: hamurcuabi / compose-metric-reporter (Compose metrics to HTML)
- GitHub: jimlyas / reflection-navigation (type-safe navigation)
- GitHub: jimmyale3102 / compose-calendar (calendar widget)
- GitHub: Tweener / kmp-charts (Compose Multiplatform charts)
Or, you can subscribe to the Atom feed or follow Mark Murphy in the Fediverse.
Recent Issues:
- 2024-12-10: A Compose Multiplatform alpha! Hot reload! Presentation! Sprites! Calendars!
- 2024-12-03: Rebecca Franks on clipping and masking! Stefano Natali on graphicsLayer()! FunkyMuse on type-safe nav results! And... if we have enough maps, do we need to store our maps in a Map?!?
- 2024-11-26: Math! Shared element transitions! Custom modifiers! Macrobenchmark! Adapting to platform-specific design systems! And... why does wrapContentSize() not wrap my content size?!?