<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Isaac Akakpo</title>
    <description>The latest articles on DEV Community by Isaac Akakpo (@devnerd).</description>
    <link>https://dev.to/devnerd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F768581%2F5475f404-d0a9-4bef-9136-fe354b412cc8.png</url>
      <title>DEV Community: Isaac Akakpo</title>
      <link>https://dev.to/devnerd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/devnerd"/>
    <language>en</language>
    <item>
      <title>Dependency Gaps in Compose Multiplatform (and how I solved them)</title>
      <dc:creator>Isaac Akakpo</dc:creator>
      <pubDate>Thu, 18 Sep 2025 22:33:55 +0000</pubDate>
      <link>https://dev.to/devnerd/dependency-gaps-in-compose-multiplatform-and-how-i-solved-them-15bj</link>
      <guid>https://dev.to/devnerd/dependency-gaps-in-compose-multiplatform-and-how-i-solved-them-15bj</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7abo67c8hhiqa24fe96v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7abo67c8hhiqa24fe96v.png" alt="Header " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;JetBrains' flagship framework for mobile platforms, Kotlin Multiplatform, has come a long way, evolving to offer the promise of "write once, run everywhere." The framework allows you to share business logic across platforms, which required native UI implementations for each platform. With the advent of Compose Multiplatform, JetBrains has taken this concept even further, enabling a true "write once, run everywhere" experience. Built on top of Kotlin Multiplatform, Compose Multiplatform allows developers to share both UI and business logic across all supported platforms, including Android, iOS, Web (via Wasm), and Desktop (via JVM).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnq4ptc5qqu8xfzlxvh84.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnq4ptc5qqu8xfzlxvh84.png" alt="KMP" width="800" height="517"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While this is a major leap forward, it’s important to acknowledge that Compose Multiplatform doesn't fully solve the challenge of a one-codebase approach for all platforms. There are still some gaps that developers need to address. JetBrains has done a commendable job in creating a unified experience, but platform-specific adjustments are often necessary.&lt;/p&gt;

&lt;p&gt;One of the key tools in achieving this is the expect/actual mechanism. Simply put, this approach allows developers to define common logic in the "expect" block, while providing platform-specific implementations in the "actual" block. This means that if Compose Multiplatform doesn’t meet the needs of a particular platform, developers can define platform-specific functionality with the actual keyword.&lt;/p&gt;

&lt;p&gt;As a result, it’s mandatory to have an actual function for each platform in your Compose Multiplatform project to fill these gaps. This ensures that your application can fully leverage platform-specific features while maintaining the core benefits of code sharing&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhqs7tqg9kxv0740nd29j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhqs7tqg9kxv0740nd29j.png" alt="Expect function for getPaymentDetails() in commonMain" width="800" height="190"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Gap?
&lt;/h2&gt;

&lt;p&gt;You may have to write expect/actual functions for each platform. For instance,the Google's &lt;a href="https://developer.android.com/kotlin/multiplatform" rel="noopener noreferrer"&gt;androidx-libraries&lt;/a&gt; made for KMP are usually made to support just the mobile platforms (and maybe for JVM) however the Wasm targets lack. Hence having duplicate actuals for iOS, Android, &amp;amp; Desktop just doesn't comply to standard coding practices and can result in code repition. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk2n1h5218ab8exou4k4w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk2n1h5218ab8exou4k4w.png" alt="Error Screenshot" width="800" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;An example, showing the RevenueCat SDK used in commomMain results in a &lt;code&gt;Could not resolve&lt;/code&gt; error for Wasm and Desktop targets&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Gradle module to the Rescue
&lt;/h3&gt;

&lt;p&gt;To address this issue, we can create simple, dedicated modules and designate the root directory as a source root. This structure will house all the common code shared across specific platforms, providing a clean and effective solution. Let’s use the Room Database library as an example, which works across iOS, Android, and Desktop (JVM) platforms&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyfofnbxfcxnj99uatzya.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyfofnbxfcxnj99uatzya.png" alt="make folder source root" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We create a nonWasmModule. While the name may seem unusual, it serves its purpose. This module contains just one actual function for the expect method (defined in commonMain), and for Wasm, we can use the web’s local storage as an alternative. This approach solves the problem.&lt;/p&gt;

&lt;p&gt;Similarly, for the mobile platforms (iOS and Android), we create a &lt;code&gt;mobileModule&lt;/code&gt;, set it as the source root, and include the actual functions, objects, or classes specific to mobile.&lt;/p&gt;

&lt;p&gt;Finally, we update the Gradle file at the app level to ensure the new modules depend on the common module, inheriting all shared dependencies between platforms.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2978sgo4l1hlkueng2e1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2978sgo4l1hlkueng2e1.png" alt="Gradle Setup" width="800" height="623"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>revenuecat</category>
      <category>shipaton</category>
      <category>composemultiplatform</category>
    </item>
    <item>
      <title>Animating Composables. (Bonus - Creating a Clock View with Canvas Api)</title>
      <dc:creator>Isaac Akakpo</dc:creator>
      <pubDate>Sat, 05 Feb 2022 16:53:21 +0000</pubDate>
      <link>https://dev.to/devnerd/animating-composables-bonus-creating-a-clock-view-with-canvas-api-gmf</link>
      <guid>https://dev.to/devnerd/animating-composables-bonus-creating-a-clock-view-with-canvas-api-gmf</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5TebLwsX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/derr9tlswv437vhkavwe.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5TebLwsX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/derr9tlswv437vhkavwe.gif" alt="Image description" width="600" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/develNerd/AnimatingCompoables/blob/main/app/src/main/java/ebook/iak/compose/clock/Android12ClockWithTicks.kt"&gt;Link to Source Code&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Animating Position Changes</title>
      <dc:creator>Isaac Akakpo</dc:creator>
      <pubDate>Sat, 05 Feb 2022 16:44:37 +0000</pubDate>
      <link>https://dev.to/devnerd/animating-position-changes-1h96</link>
      <guid>https://dev.to/devnerd/animating-position-changes-1h96</guid>
      <description>&lt;p&gt;We'll be looking at how to animate position changes using Dp in this series. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sHzZP6hs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zpecnaylhydspzhh509z.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sHzZP6hs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zpecnaylhydspzhh509z.gif" alt="Image description" width="464" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's define the card position as Enum's&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//

enum class CardPosition {
    IS_LEFT,
    IS_RIGHT
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We'll be using a &lt;em&gt;BoxWithConstraints&lt;/em&gt; for this mainly it returns as the current size of the box where we could use the offset modifier to set the current position&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;BoxWithConstraints(
        modifier = Modifier
            .fillMaxWidth()
            .padding(5.dp)
            .border(width = 2.dp, shape = RoundedCornerShape(15), color = Blue)
            .background(color = Color.Transparent, shape = RoundedCornerShape(15))
    ) {

      // --&amp;gt; 1
        var currentState by remember { mutableStateOf(CardPosition.IS_LEFT) }
// --&amp;gt; 2
        val transition = updateTransition(currentState, label = "First Trans")
// --&amp;gt; 3
        val color by transition.animateColor(transitionSpec = {
            tween(800, easing = LinearOutSlowInEasing)
        }, label = "") {
            when (it) {
                CardPosition.IS_RIGHT -&amp;gt;
                    Blue
                else -&amp;gt; Green
            }
        }

// --&amp;gt; 4
        val xOffset by transition.animateDp(
            transitionSpec = {
                tween(800, easing = LinearOutSlowInEasing)


            }, label = "xOffset"
        ) { state -&amp;gt;
            when (state) {
                CardPosition.IS_LEFT -&amp;gt; 0.dp
                CardPosition.IS_RIGHT -&amp;gt; this.maxWidth - 165.dp
            }
        }




        Card(
            elevation = 3.dp,
            shape = RoundedCornerShape(100),
            backgroundColor = color,
            onClick = {
                currentState = if (currentState == CardPosition.IS_LEFT) {
                    CardPosition.IS_RIGHT
                } else {
                    CardPosition.IS_LEFT

                }
            }, indication = rememberRipple(),
            modifier = Modifier
// --&amp;gt; 5
                .offset(x = xOffset, 0.dp)
                .padding(vertical = 15.dp, horizontal = 5.dp)
                .width(150.dp)
        ) {
            Text(
                text = if (currentState == CardPosition.IS_LEFT) "Move To Right" else "Move To Left",
                textAlign = TextAlign.Center,
                color = White,
                modifier = Modifier
                    .fillMaxWidth()
                    .padding(horizontal = 20.dp, vertical = 5.dp)
            )
        }

    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;We set the current position of the Card.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use the updateTransition.. animations api to hold the current position.&lt;br&gt;
&lt;a href="https://developer.android.com/jetpack/compose/animation#updateTransition"&gt;Learn more about updateTransition&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Since we want to change the color on whether the card is at the right or left we declare a color variable update the current color accordingly&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We need an xOffSet to determine and set the current position of the card.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finally we set this using the offset modifier in Dp. (NB: This could also be done with IntOffSet{} for int values)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://github.com/develNerd/AnimatingCompoables/blob/main/app/src/main/java/ebook/iak/compose/series1/AnimatePosition.kt"&gt;Link to Source Code&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Animating Composables (animateDpAsState)</title>
      <dc:creator>Isaac Akakpo</dc:creator>
      <pubDate>Fri, 04 Feb 2022 19:56:04 +0000</pubDate>
      <link>https://dev.to/devnerd/animating-composables-series-2-1a8a</link>
      <guid>https://dev.to/devnerd/animating-composables-series-2-1a8a</guid>
      <description>&lt;p&gt;For this Series, We're going to animate the size of a box based on changing sizes. &lt;br&gt;
We'll try to create something like a size palette.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--88_2_EcQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f2skw17fuy1ighmskxf4.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--88_2_EcQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f2skw17fuy1ighmskxf4.gif" alt="Image description" width="464" height="364"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This follows same procedure as animateColorAsState but here we specify a Dp instead.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// --&amp;gt; 1
 val realCardSize = remember {
        mutableStateOf(100)
    }

//--&amp;gt;2
    val stateCardSize = animateDpAsState(targetValue = realCardSize.value.dp )


// --&amp;gt; 3
    Column(modifier = Modifier.fillMaxSize()) {
        Card(
            modifier = Modifier
                .align(Alignment.CenterHorizontally)
                .padding(10.dp)
                .size(stateCardSize.value),
            backgroundColor = Green,
            elevation = 3.dp
        ) {
            Box(modifier = Modifier.fillMaxSize()) {
                Text(text = "Current Size : ", modifier = Modifier.align(Alignment.Center))
            }
        }

// --&amp;gt; 4
        val cardSizes = listOf(100, 300, 500)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Declare the size of the box as an Integer(this could also be in Dp primarily so there's no need for conversion)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Define animateDpAsState variable and give it a targetValue of &lt;em&gt;realCardSize&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Here we create a Column parent view to host the Card and the list of size buttons.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We then declare a list of sizes we want the Box to take.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's now build the Chips &lt;strong&gt;sizeButtonItems&lt;/strong&gt; at the bottom of the card&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@ExperimentalMaterialApi
@Composable
fun ChipSizeItem(
    index: Int,
    isChecked: Boolean,
    size: Int,
    onChecked: (index: Int, size: Int) -&amp;gt; Unit
) {

// --&amp;gt; 5
    val chipColour = animateColorAsState(targetValue = if (isChecked) Green else White)
    Card(
        backgroundColor = chipColour.value,
        elevation = 3.dp,
        shape = RoundedCornerShape(100),
        modifier = Modifier.padding(5.dp).toggleable(value = isChecked,onValueChange = {
           // --&amp;gt; 6
            onChecked(index, size)
        })
    ) {
        Text(text = "$size.dp", modifier = Modifier.padding(horizontal = 20.dp, vertical = 5.dp))
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Set the chip Color based on the current selected chip size.&lt;/li&gt;
&lt;li&gt;Return the index and size of the box when a chip is selected.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// --&amp;gt; 7

        Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Center) {
            var currentIndex by remember {
                mutableStateOf(0)
            }

            cardSizes.forEachIndexed { cardIndex, cardSize -&amp;gt;
                ChipSizeItem(
                    index = cardIndex,
                    isChecked = cardIndex == currentIndex,
                    size = cardSize
                ) { index, size -&amp;gt;
                    currentIndex = index
                    realCardSize.value = size
                }
            }
        }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Add Code block 7 under cardSizes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Get Full Code At: &lt;br&gt;
&lt;a href="https://github.com/develNerd/AnimatingCompoables/blob/main/app/src/main/java/ebook/iak/compose/series1/AnimateDpAsState.kt"&gt;GitHub link&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Animating Composables Made Easy </title>
      <dc:creator>Isaac Akakpo</dc:creator>
      <pubDate>Fri, 04 Feb 2022 19:24:24 +0000</pubDate>
      <link>https://dev.to/devnerd/animating-composables-made-easy-4i7f</link>
      <guid>https://dev.to/devnerd/animating-composables-made-easy-4i7f</guid>
      <description>&lt;p&gt;Animations in android hasn't always been straight forward to implement. The introduction of jetpack compose makes animations a bit more enjoyable and easier to implement.&lt;/p&gt;

&lt;p&gt;In this article we'll be looking at the &lt;strong&gt;animateValueAsState&lt;/strong&gt;  api. Values currently supported are Color,Float,Dp,Rect,Int,Inoffset and Instize.&lt;/p&gt;

&lt;p&gt;Let's take a look at animating color states for this series. We'll be creating something like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1h28Vymv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7yp4r741a2fjmg1zj5gg.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1h28Vymv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7yp4r741a2fjmg1zj5gg.gif" alt="Image description" width="464" height="276"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
// --&amp;gt; 1

val Purple = Color(0xFF6200EE)
val Orange = Color(0xFFFF5722)
val White =  Color(0xFFFFFFFF)
val Blue =  Color(0xFF4052B8)
val Green =  Color(0xFF4CAF50)
val Yellow =  Color(0xFFFFEB3B)



// --&amp;gt; 2
 var currentColor by remember {
        mutableStateOf(White)
    }

// --&amp;gt; 3
    val colors by remember {
        mutableStateOf(listOf(White, Orange, Purple200, Blue, Green,Yellow))
    }

val cardBackground by animateColorAsState(targetValue = currentColor)


    Box(modifier = Modifier.fillMaxSize()) {
        Card(
            modifier = Modifier
                .fillMaxWidth()
                .padding(10.dp)
                .height(200.dp),
            onClick = { 
                // --&amp;gt; 4
                currentColor = colors.random()
             },
            backgroundColor = cardBackground,
            elevation = 3.dp, indication = rememberRipple()
        ) {
            Box(modifier = Modifier.fillMaxSize()) {
                Text(text = "Click to Change Color", modifier = Modifier.align(Alignment.Center))
            }
        }

    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;We declare the colors we want to set the box as we click it.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Animate*AsState&lt;/em&gt; requires a target state that is mutable.
NB : &lt;em&gt;Animate*AsState&lt;/em&gt; in it self needs immutable&lt;/li&gt;
&lt;li&gt;Make a list from all defined colors&lt;/li&gt;
&lt;li&gt;Assign &lt;em&gt;currentColor&lt;/em&gt; a new value on click&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Happy Coding, See you in the next series !&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://github.com/develNerd/AnimatingCompoables/blob/main/app/src/main/java/ebook/iak/compose/series1/AnimateColorAsState.kt"&gt;Code Link&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
