jetc.dev Newsletter Issue #23
Published: 2020-07-21
The sleepy (Northern Hemisphere) summer of Compose continues, so there is not a lot of news this week. But, we look at more on the padding-versus-margin conundrum, when to worry about composable duplication, FABs, a Hacker News client, and a JetBrains experiment for Compose on the Web.
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
How to add Margin in Jetpack Compose?
This question follows up on a One Off the Slack item from two weeks ago.
The padding-versus-margin confusion will be an issue for a while. The current
Compose implementation is fairly simple: use Modifier.padding()
to add whitespace
around a composable, and remember that everything is nested composables. However,
due to the “padding” name, developers are going to make unfortunate inferences.
Deduplication and Composables
Given that composables wrap composables, which wrap yet more composables, one
concern is: at what point do we need to think about having common composable
implementations versus having some redundant code. In this week’s highlighted Slack
thread, we explore that, why there is no Circle
composable, and why Compose
apps might wind up building a custom library of core composable wrappers.
Composable Commentary
Posts, videos, and other new information related to Jetpack Compose!
Floating Action Button App
Akshay Sawant is back with the first of two posts looking at floating
action button, with the second looking at ExtendedFloatingActionButton()
.
Resource Roundup
100% pure code!
GitHub: robotsquidward / hn-compose
A.J. Kueterman delivered a presentation on Jetpack Compose where he demonstrated creating a Hacker News client. This repo contains both the evolution of the app and a PDF of the presentation slides.
…And One More Thing
JetBrains, like a lot of larger firms, holds internal hackathons from time to time, to allow developers to experiment in work that is adjacent to, or perhaps well outside of, their normal area of responsibilty. They recently concluded JetBrains Hackathon: Home Edition, and one of the projects was:
Compose for Web which aimed at porting the Jetpack Compose to the web.
I wrote in this space a few months ago about the ui-desktop
module
and mentioned the Web as a possible target. Apparently, some developers at
JetBrains agreed… perhaps.
The problem is, as I wrote about a couple of months ago, there are two possible interpretations of Compose being “cross-platform”.
It could be that the JetBrains hackathon was experimenting with using the
androidx.compose
engine to be able to deliver rendering instructions from
a server to a browser, such as is seen in this demo project.
Or, it could be that they were experimenting getting androidx.ui
working
in a browser, perhaps using the same Skia-for-the-Web that Flutter uses (as I understand it).
Or, maybe they had a completely different take on what a Web edition of
Compose might do.
Regardless, I find these experiments to be very interesting, particularly JetBrains
involvement in ui-desktop
. Perhaps in 2021 we will see if this turns into a production-grade
option for desktop app development. That assumes, though, that between now and then,
the world is not destroyed by a 50-foot tall cyborg replica of a dead painter, with laser eyes.
(hey, it’s 2020 — given the way this year is going, can you really rule it out?)
Or, you can subscribe to the Atom feed or follow Mark Murphy in the Fediverse.
Recent Issues:
- 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?!?
- 2024-11-19: Compose alphas! Compose Multiplatform patch! PaddingValues! Graphics layers! Swiping! Heatmaps! Navigation! And... why did we get a new production Compose BOM?!?