Continuing on with the tradition of weekly Android challenges.
This time I decided to deviate away from the coroutine world into Jetpack Compose.
🤔 I’ve recently worked with some complex modifier chains in Jetpack Compose and noticed just how much the precedence of Modifiers matters.
This led to me creating this challenge to help you understand Modifier chaining.
🏆 Challenge details:
Take a look at the image. Your task is to insert two modifiers to achieve the desired composable on the right.
The modifiers that are missing are:
1️⃣ .padding(24.dp)
2️⃣ .clip(RoundedCornerShape(16.dp))
Now comes the hard part. There are five possible locations where you can insert these modifiers. They can be placed together or separately.
Think hard about where you need to put them.
💡 Hint - the order of modifiers DOES matter in Jetpack Compose.
After that:
- Post your answers in the comments below. 💬
- Explain your reasoning for what will be printed. 🖊️
- Feel free to discuss and debate! 👥
🔎 An answer with an explanation will be posted in 48 hours.
🌟 Those who get it right and explain it will get a shout-out in the next post with the solution!
I will be closely watching your answers and helping.
Looking forward to seeing your solutions and discussions in the comments! 👇
What do you guys think of these new challenges compared to coroutines ones? Would love to hear your feedback.
コメント