Android Compose library without Material
Closed this issue · 10 comments
About this issue
Markdown() composable has a strong dependency on material components like androidx.compose.material.MaterialTheme.
For Wear these should be avoided and instead use Wear Material versions.
See https://developer.android.com/training/wearables/compose#different
Is it feasible to pull these Color and Typography factories that default to mobile material to a separate dependency?
Details
0.11
Wear (Android)
Checklist
- Searched for similar issues
- Checked out the sample application
- Read the README
- Checked out the CHANGELOG
- Read the FAQ
- Checked out the MIGRATION GUIDE
n.b, FAQ is missing? https://github.com/mikepenz/multiplatform-markdown-renderer/blob/develop/FAQ.md
Good day @yschimke
Thank you very much for the report. The MaterialTheme
is already only used in the default factories, allowing you to replace all of them with alternative variants:
- hhttps://github.com/mikepenz/multiplatform-markdown-renderer/blob/develop/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/model/MarkdownTypography.kt
- https://github.com/mikepenz/multiplatform-markdown-renderer/blob/develop/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/model/MarkdownColors.kt
- https://github.com/mikepenz/multiplatform-markdown-renderer/blob/develop/app/src/main/java/com/mikepenz/markdown/ui/Theme.kt
If you adjust all of these, wouldn't R8 be capable of removing all references for Material
classes?
Yep, I'm not blocked. I would feel safer not relying on R8 to drop dependencies. Feel free to close if you feel strongly about it.
And nice library.
@yschimke mostly curious on it. haven't shaped a decision on it yet. Do you have an example of a library which includes compose ui and splits to a wear module and other modules due to material theme?
The whole of Wear Compose is like that :)
It has a Wear Material Text
instead of Material Text
. Wear MaterialTheme
instead of MaterialTheme
.
But honestly, I think it's about supporting more than just Material. There are other possible design systems, and I'd personally prefer to be able to import multiplatform-markdown-renderer
without any explicit material assumptions. And a markdown-material
for mobile, and markdown-wear
for Wear.
I sort of got the impression you are making most of the decisions upfront, so using BasicText directly might be the right thing.
Wear Material actually doesn't have Surface at all. So maybe uplifting those to the m2 or m3 impls might be the solution?
Thanks for attempting this, I hope overall it's a clean up and more correct as people switch between m2, m3, wear.
Thank you for the additional input @yschimke
I would highly appreciate if you could review the PR #107
Decided to have wrappers (basically similar to what you mentioned on uplifting the m2/m3 impls) based on the normal surface/text components: https://github.com/mikepenz/multiplatform-markdown-renderer/pull/107/files#diff-8142270f21ac4367be27d783daec3cdff3fafe3e4e498bf9e046932a901b1dab - allowing the full removal of the Material
dependency.
For everyone looking for this. There is a first pre-release available with the individual m2 and m3 artifact.
v0.13.0-a01
- https://github.com/mikepenz/multiplatform-markdown-renderer/tree/v0.13.0-a01