~/talk

Practical Tips and Tricks to Improve Your Compose Previews

Talkat droidcon Berlin 2024 · 2024-07-03..07-05· [android, developer-experience]
slides:none on file

Shows concrete fixes: use showBackground=true and UI mode parameters to get light/dark screenshots in Android Studio, group variants with MultiPreview annotations to avoid dozens of standalone previews, and build reusable widgets like a preview box and preview column that defer composition‑local reads (pass background as a lambda) so themes render correctly. Notes tooling gaps: Compose Desktop/Multiplatform and Fleet lack annotation params, R8 strips unused previews, and screenshot testing currently needs a separate source set.

AI-written summary · about

  1. 0:00Compose Previews intro
  2. 1:30Why previews need code
  3. 4:22DevX challenges with previews
  4. 5:28Fix background visibility
  5. 7:36Custom background colors
  6. 10:09Dark mode previews
  7. 11:56Group and name previews
  8. 13:43Multi-preview annotations
  9. 15:30Compose preview templates
  10. 17:58Multiplatform limitations
  11. 19:04Theming importance in previews
  12. 20:28Reusable preview box
  13. 24:41Preview column for components
  14. 25:47Override composition locals
  15. 27:35Advanced preview tooling
  16. 29:01Inject composables via params
  17. 30:26Previews for screenshot tests
  18. 31:09Worth improving previews?
  19. 32:13Resources and closing
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.