Fixed: Extra top margin in KiwixAppBar when opening KiwixSearchView.

* The issue occurred because our application already has `Edge-To-Edge` mode enabled, but Compose's `TopAppBar` automatically adds a top margin when insets change. This resulted in double padding in the toolbar.
* To fix this, we now apply only the side insets to the toolbar, as the top insets are already handled.
This commit is contained in:
MohitMaliFtechiz 2025-04-02 15:22:58 +05:30
parent 852849389e
commit 630446c2e2

View File

@ -22,8 +22,12 @@ import androidx.annotation.StringRes
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBars
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
@ -78,7 +82,11 @@ fun KiwixAppBar(
colors = TopAppBarDefaults.topAppBarColors(
containerColor = Black,
scrolledContainerColor = Black
)
),
// Edge-to-Edge mode is already enabled in our application,
// so we don't need to apply additional top insets.
// This prevents unwanted extra margin at the top.
windowInsets = WindowInsets.statusBars.only(WindowInsetsSides.Horizontal)
)
}
}