Changing the Status Bar Color in Jetpack Compose
<p><strong><em>Every problem solved is a lesson learned. </em></strong><em>#AndroidTips #SolvedProblemToday</em></p>
<p><img alt="" src="https://miro.medium.com/v2/resize:fit:480/0*4rLL0-QMm6Nu8eS2" style="height:325px; width:480px" /></p>
<p>Jetpack Compose</p>
<p>Changing the status bar color is a common task when designing Android applications. With Jetpack Compose, it’s a simple process that can be done in just a few lines of code. (Only for Material Design 2. If you are using Material Design 3, please check the section below after Material Design 2)</p>
<blockquote>
<p>Material Design 2</p>
</blockquote>
<p><img alt="" src="https://miro.medium.com/v2/resize:fit:700/1*pt6_uVoE0bvifh6GcI39OQ.png" style="height:162px; width:700px" /></p>
<p>Changing the Status Bar Color in Jetpack Compose</p>
<p>To change the status bar color in Jetpack Compose, we can use the <code>SystemUiController</code> provided by the <code>androidx.compose.ui.platform</code> package.</p>
<p>First, we need <strong>accompanist-systemuicontroller,</strong> Add the dependency to your app’s build.gradle file:</p>
<pre>
dependencies {
implementation "com.google.accompanist:accompanist-systemuicontroller:x.y.z"
}</pre>
<p><strong><em>Note</em></strong><em>: Replace </em><code><em>x.y.z</em></code><em> with the latest version number of </em><code><em>accompanist</em></code></p>
<p><a href="https://rivaldy.medium.com/changing-the-status-bar-color-in-jetpack-compose-a88d2778bc89">Visit Now</a></p>