I’m going to add compose in a project where we use...
# compose-android
t
I’m going to add compose in a project where we use some material things and some custom stuff, but I’ve a few questions: • All material 2 components are already in material 3 compose dependency? • Is the material 2 still being updated with improved things or it’s just in maintenance mode? • I don’t want to have two material dependencies and handle both in the project, is it better to add MD2 or MD3? 🤔
s
• Not 100% sure but at this point it should almost be there. For those where it’s not (Pull to refresh for example) you can extract the code yourself and make it build without m2, it’s not that hard. • I would guess here that it’s mostly maintenance, but could be wrong, you can check the latest release notes to get an idea of what is being changed there • If you are to go to m3 eventually anyway, just do yourself a favor and use 3 directly. Or else you’ll have to spend time to migrate anyway. But yeah m2 + m3 at the same would actually work, most of your problems will be from accidentally referencing the wrong thing, and from having to define both color schemes. We do that as we started just with m2 ~2 years ago, and the migration is still slooowly but surely being done. But if you can avoid it, avoid it.
t
What concerts me the most is the last point, I can’t be sure because they are going to implement a design system that’s not really connected with a specific material language, so it’s kinda hard to pick one or another. For sure we are not using the m3 dynamic color but I imagine the new visual stuff is going to be m3 and in the long run m2 can be stuck with old components 🫠
s
Yeah so what do you mean by being concerned? Why not just go with m3 in the first place then? For those components that are steering away from the material specs, no matter what you will need to build your own components anyway. The material components don’t allow for a lot of customization anyway, and that is on purpose. Those times, you just copy the implementation and adjust, or look at the implementation and use the same composables from inside the foundation package instead, and build your own layer on top.
t
I think I can take a proper decision after they finalise the design system but an example would be showing the m2 toggle when it’s different from the m3 toggle. Then I would need to manually create this one in m3. But I think that me trying to guess what they are doing won’t solve much for me, so the next step of taking a decision I’ll need to look at the designs first 😅
s
I’d take the m2 toggle, copy all the source code into your project, and replace all colors and other m2 references to their m3 equivalent. And you’re done.
t
Cool, I’ll keep this in mind! Thanks for the help fist bump
s
That’s exactly what I did with the pull-to-refresh that I linked above for example. Take the code, remove all M2, replace with M3, boom you got the m2 look but without the m2 dependency + you can use the m3 color scheme 😊
gratitude thank you 1
🙌 1